Merge lp:~ken-vandine/chromium-browser/chromium-browser.quantal into lp:~chromium-team/chromium-browser/chromium-browser.quantal

Proposed by Ken VanDine
Status: Merged
Merged at revision: 747
Proposed branch: lp:~ken-vandine/chromium-browser/chromium-browser.quantal
Merge into: lp:~chromium-team/chromium-browser/chromium-browser.quantal
Diff against target: 2850 lines (+2555/-102)
15 files modified
debian/apport/chromium-browser.py (+9/-8)
debian/changelog (+64/-0)
debian/control (+6/-2)
debian/patches/1-infobars.patch (+193/-0)
debian/patches/2-get-domain-tld.patch (+255/-0)
debian/patches/3-chrome-xid.patch (+38/-0)
debian/patches/arm.patch (+50/-0)
debian/patches/chromeless-window-launch-option.patch (+860/-0)
debian/patches/desktop-integration-settings.patch (+1031/-0)
debian/patches/dlopen_sonamed_gl.patch (+3/-16)
debian/patches/fix-armhf-ftbfs.patch (+3/-27)
debian/patches/grd_parse_fix.patch (+12/-0)
debian/patches/series (+7/-2)
debian/patches/ubuntu_dont_overwrite_default_download_directory.patch (+0/-47)
debian/rules (+24/-0)
To merge this branch: bzr merge lp:~ken-vandine/chromium-browser/chromium-browser.quantal
Reviewer Review Type Date Requested Status
Chromium team Pending
Review via email: mp+113785@code.launchpad.net

Description of the change

Force building with gcc 4.6 to at least get a build into quantal and fix ftbfs (LP: #992212)

To post a comment you must log in.
737. By Ken VanDine

* New upstream release from the Stable Channel
* debian/control
  - Added build depends binutils-gold, libssl-dev and subversion
* -debian/patches/ubuntu_dont_overwrite_default_download_directory.patch
  - no longer needed
* debian/rules
  - force to build with gcc 4.6 to fix ftbfs (LP: #992212)
  - don't build with -Werror
* debian/control
  - add build depends for g++-4.6-multilib

738. By Ken VanDine

* debian/patches/grd_parse_fix.patch
  - Patched to fix broken XML until we can get a proper fix for
    chromium-translation-tools.

739. By Ken VanDine

Bumped standards version to 3.9.3

740. By Ken VanDine

merged

741. By Ken VanDine

* debian/rules
  - explicitly set arm_float_abi=hard for armhf builds and let the rest
    fallback to softfp
  - do not use third_party/gold as the linker.
  - enable compile-time dependency on gnome-keyring
* debian/patches/vpx.patch
  - patch from debian to fix FTBFS on armel
* debian/patches/arm.patch
  - patch from debian to fix FTBFS on armel

742. By Ken VanDine

Added build depends binutils-gold, libvpx-dev,libssl-dev and subversion

743. By Ken VanDine

don't build depend on binutils-gold for armel

744. By Ken VanDine

releasing version 20.0.1132.47~r144678-0ubuntu1

745. By Ken VanDine

* debian/control
  - Dropped build depends for libvpx-dev
* debian/apport:
 - Update apport hook for python3 (LP: #1013171)
    patch made with the help of Edward Donovan

746. By Ken VanDine

releasing version 20.0.1132.47~r144678-0ubuntu2

747. By Ken VanDine

releasing version 20.0.1132.47~r144678-0ubuntu3

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/apport/chromium-browser.py'
--- debian/apport/chromium-browser.py 2011-05-09 17:41:33 +0000
+++ debian/apport/chromium-browser.py 2012-08-06 17:52:22 +0000
@@ -11,6 +11,7 @@
11the full text of the license.11the full text of the license.
12'''12'''
1313
14from __future__ import print_function
14import os, sys, getopt, codecs15import os, sys, getopt, codecs
15import time16import time
16from stat import *17from stat import *
@@ -57,7 +58,7 @@
57 report['RelatedPackagesPolicy'] = ''58 report['RelatedPackagesPolicy'] = ''
58 for pkg in pkgs:59 for pkg in pkgs:
59 script = subprocess.Popen(['apt-cache', 'policy', pkg], stdout=subprocess.PIPE)60 script = subprocess.Popen(['apt-cache', 'policy', pkg], stdout=subprocess.PIPE)
60 report['RelatedPackagesPolicy'] += script.communicate()[0] + "\n"61 report['RelatedPackagesPolicy'] += str(script.communicate()[0]) + "\n"
6162
62def gconf_values(report, keys):63def gconf_values(report, keys):
63 report['gconf-keys'] = ''64 report['gconf-keys'] = ''
@@ -67,7 +68,7 @@
67 except OSError:68 except OSError:
68 report['gconf-keys'] = "gconftool-2 not found"69 report['gconf-keys'] = "gconftool-2 not found"
69 return70 return
70 out = script.communicate()[0]71 out = str(script.communicate()[0])
71 if out == "":72 if out == "":
72 out = "**unset**\n"73 out = "**unset**\n"
73 report['gconf-keys'] += key + " = " + out74 report['gconf-keys'] += key + " = " + out
@@ -105,7 +106,7 @@
105 # list entensions+versions106 # list entensions+versions
106 report['ChromiumPrefs'] += "extensions/settings =\n"107 report['ChromiumPrefs'] += "extensions/settings =\n"
107 if 'settings' in entry['extensions']:108 if 'settings' in entry['extensions']:
108 for ext in entry['extensions']['settings'].keys():109 for ext in list(entry['extensions']['settings'].keys()):
109 report['ChromiumPrefs'] += " - '" + ext + "'\n"110 report['ChromiumPrefs'] += " - '" + ext + "'\n"
110 if 'manifest' in entry['extensions']['settings'][ext]:111 if 'manifest' in entry['extensions']['settings'][ext]:
111 for k in [ 'name', 'description', 'version', 'update_url' ]:112 for k in [ 'name', 'description', 'version', 'update_url' ]:
@@ -243,17 +244,17 @@
243244
244 # Disk usage245 # Disk usage
245 script = subprocess.Popen([ 'df', '-Th' ], stdout=subprocess.PIPE)246 script = subprocess.Popen([ 'df', '-Th' ], stdout=subprocess.PIPE)
246 report['DiskUsage'] = script.communicate()[0] + "\n\nInodes:\n"247 report['DiskUsage'] = str(script.communicate()[0]) + "\n\nInodes:\n"
247 script = subprocess.Popen([ 'df', '-ih' ], stdout=subprocess.PIPE)248 script = subprocess.Popen([ 'df', '-ih' ], stdout=subprocess.PIPE)
248 report['DiskUsage'] += script.communicate()[0]249 report['DiskUsage'] += str(script.communicate()[0])
249250
250## DEBUGING ##251## DEBUGING ##
251if __name__ == '__main__':252if __name__ == '__main__':
252 sys.stdout = codecs.getwriter('utf8')(sys.stdout)253 sys.stdout = codecs.getwriter('utf8')(sys.stdout)
253 try:254 try:
254 opts, args = getopt.getopt(sys.argv[1:], "-u:", [ 'user-dir=' ])255 opts, args = getopt.getopt(sys.argv[1:], "-u:", [ 'user-dir=' ])
255 except getopt.GetoptError, err:256 except getopt.GetoptError as err:
256 print str(err)257 print(str(err))
257 sys.exit(2)258 sys.exit(2)
258259
259 userdir = None260 userdir = None
@@ -266,4 +267,4 @@
266 report = {}267 report = {}
267 add_info(report, userdir = userdir)268 add_info(report, userdir = userdir)
268 for key in report:269 for key in report:
269 print '[%s]\n%s\n' % (key, report[key])270 print('[%s]\n%s\n' % (key, report[key]))
270271
=== modified file 'debian/changelog'
--- debian/changelog 2012-06-18 16:37:20 +0000
+++ debian/changelog 2012-08-06 17:52:22 +0000
@@ -1,3 +1,67 @@
1chromium-browser (20.0.1132.47~r144678-0ubuntu3) quantal; urgency=low
2
3 * debian/patches/1-infobars.patch
4 - moved infobars out of experimental, used for webapps
5 * debian/patches/2-get-domain-tld.patch
6 - Adds API for getting the base domain of a URI, used for webapps
7 * debian/patches/3-chrome-xid.patch
8 - Get xid, used for webapps
9 * debian/patches/chromeless-window-launch-option.patch
10 - Adds optional chromeless mode, used for webapps
11 * debian/patches/desktop-integration-settings.patch
12 - Adds settings for managing sites integrated with the desktop, used
13 for webapps
14
15 -- Ken VanDine <ken.vandine@canonical.com> Mon, 06 Aug 2012 13:40:57 -0400
16
17chromium-browser (20.0.1132.47~r144678-0ubuntu2) quantal; urgency=low
18
19 * debian/control
20 - Dropped build depends for libvpx-dev
21 * -debian/patches/vpx.patch
22 - dropped, build with internal vpx
23
24 [ Matthieu Baerts ]
25 * debian/apport:
26 - Update apport hook for python3 (LP: #1013171)
27 patch made with the help of Edward Donovan
28
29 -- Ken VanDine <ken.vandine@canonical.com> Thu, 12 Jul 2012 15:56:59 -0400
30
31chromium-browser (20.0.1132.47~r144678-0ubuntu1) quantal; urgency=low
32
33 * New upstream release from the Stable Channel
34 * debian/control
35 - Added build depends binutils-gold, libvpx-dev,libssl-dev and subversion
36 - Bumped standards version to 3.9.3
37 - don't build depend on binutils-gold for armel
38 * debian/rules
39 - explicitly set arm_float_abi=hard for armhf builds and let the rest
40 fallback to softfp
41 - do not use third_party/gold as the linker.
42 - enable compile-time dependency on gnome-keyring
43 * -debian/patches/ubuntu_dont_overwrite_default_download_directory.patch
44 - no longer needed
45 * debian/patches/grd_parse_fix.patch
46 - Patched to fix broken XML until we can get a proper fix for
47 chromium-translation-tools.
48 * debian/patches/vpx.patch
49 - patch from debian to fix FTBFS on armel
50 * debian/patches/arm.patch
51 - patch from debian to fix FTBFS on armel
52
53 -- Ken VanDine <ken.vandine@canonical.com> Thu, 12 Jul 2012 14:02:44 -0400
54
55chromium-browser (18.0.1025.168~r134367-0ubuntu2) quantal; urgency=low
56
57 * debian/rules
58 - force to build with gcc 4.6 to fix ftbfs (LP: #992212)
59 - don't build with -Werror
60 * debian/control
61 - add build depends for g++-4.6-multilib
62
63 -- Ken VanDine <ken.vandine@canonical.com> Fri, 06 Jul 2012 13:51:59 -0400
64
1chromium-browser (18.0.1025.168~r134367-0ubuntu1) quantal; urgency=low65chromium-browser (18.0.1025.168~r134367-0ubuntu1) quantal; urgency=low
2 66
3 * debian/rules67 * debian/rules
468
=== modified file 'debian/control'
--- debian/control 2012-03-30 08:38:01 +0000
+++ debian/control 2012-08-06 17:52:22 +0000
@@ -13,6 +13,8 @@
13 patchutils (>= 0.2.25),13 patchutils (>= 0.2.25),
14 libc6-dev-i386 [amd64],14 libc6-dev-i386 [amd64],
15 g++-multilib [amd64],15 g++-multilib [amd64],
16 g++-4.6-multilib,
17 binutils-gold [!armel],
16 hardening-wrapper,18 hardening-wrapper,
17 python,19 python,
18 bison,20 bison,
@@ -48,8 +50,10 @@
48 libdbus-glib-1-dev,50 libdbus-glib-1-dev,
49 libgnome-keyring-dev,51 libgnome-keyring-dev,
50 libudev-dev,52 libudev-dev,
51 libgconf2-dev53 libgconf2-dev,
52Standards-Version: 3.8.354 libssl-dev,
55 subversion
56Standards-Version: 3.9.3
5357
54Package: chromium-browser58Package: chromium-browser
55Architecture: any59Architecture: any
5660
=== added file 'debian/patches/1-infobars.patch'
--- debian/patches/1-infobars.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/1-infobars.patch 2012-08-06 17:52:22 +0000
@@ -0,0 +1,193 @@
1Index: src/chrome/browser/infobars/infobar_extension_apitest.cc
2===================================================================
3--- src.orig/chrome/browser/infobars/infobar_extension_apitest.cc 2012-07-07 00:59:54.000000000 -0400
4+++ src/chrome/browser/infobars/infobar_extension_apitest.cc 2012-07-16 15:33:42.371644366 -0400
5@@ -15,9 +15,5 @@
6 #endif
7
8 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Infobars) {
9- // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
10- CommandLine::ForCurrentProcess()->AppendSwitch(
11- switches::kEnableExperimentalExtensionApis);
12-
13 ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
14 }
15Index: src/chrome/browser/infobars/infobar_extension_api.h
16===================================================================
17--- src.orig/chrome/browser/infobars/infobar_extension_api.h 2012-07-07 00:59:54.000000000 -0400
18+++ src/chrome/browser/infobars/infobar_extension_api.h 2012-07-16 15:33:42.371644366 -0400
19@@ -11,7 +11,7 @@
20 class ShowInfoBarFunction : public SyncExtensionFunction {
21 virtual ~ShowInfoBarFunction() {}
22 virtual bool RunImpl() OVERRIDE;
23- DECLARE_EXTENSION_FUNCTION_NAME("experimental.infobars.show")
24+ DECLARE_EXTENSION_FUNCTION_NAME("infobars.show")
25 };
26
27 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_EXTENSION_API_H_
28Index: src/chrome/common/extensions_api_resources.grd
29===================================================================
30--- src.orig/chrome/common/extensions_api_resources.grd 2012-07-07 01:01:18.000000000 -0400
31+++ src/chrome/common/extensions_api_resources.grd 2012-07-16 15:33:42.371644366 -0400
32@@ -28,7 +28,6 @@
33 <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_DOWNLOADS" file="extensions\api\experimental.downloads.json" type="BINDATA" />
34 <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_FONTSSETTINGS" file="extensions\api\experimental.fontSettings.json" type="BINDATA" />
35 <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_IDENTITY" file="extensions\api\experimental.identity.json" type="BINDATA" />
36- <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS" file="extensions\api\experimental.infobars.json" type="BINDATA" />
37 <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_UI" file="extensions\api\experimental.input.ui.json" type="BINDATA" />
38 <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_VIRTUALKEYBOARD" file="extensions\api\experimental.input.virtualKeyboard.json" type="BINDATA" />
39 <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_KEYBINDING" file="extensions\api\experimental.keybinding.json" type="BINDATA" />
40@@ -45,6 +44,7 @@
41 <include name="IDR_EXTENSION_API_JSON_HISTORY" file="extensions\api\history.json" type="BINDATA" />
42 <include name="IDR_EXTENSION_API_JSON_I18N" file="extensions\api\i18n.json" type="BINDATA" />
43 <include name="IDR_EXTENSION_API_JSON_INPUT_IME" file="extensions\api\input.ime.json" type="BINDATA" />
44+ <include name="IDR_EXTENSION_API_JSON_INFOBARS" file="extensions\api\infobars.json" type="BINDATA" />
45 <include name="IDR_EXTENSION_API_JSON_IDLE" file="extensions\api\idle.json" type="BINDATA" />
46 <include name="IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE" file="extensions\api\inputMethodPrivate.json" type="BINDATA" />
47 <include name="IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE" file="extensions\api\managedModePrivate.json" type="BINDATA" />
48Index: src/chrome/common/extensions/extension_permission_set.cc
49===================================================================
50--- src.orig/chrome/common/extensions/extension_permission_set.cc 2012-07-07 01:01:17.000000000 -0400
51+++ src/chrome/common/extensions/extension_permission_set.cc 2012-07-16 15:33:42.371644366 -0400
52@@ -47,6 +47,7 @@
53 "devtools",
54 "extension",
55 "i18n",
56+ "infobars",
57 "omnibox",
58 "pageAction",
59 "pageActions",
60Index: src/chrome/common/extensions/api/infobars.json
61===================================================================
62--- /dev/null 1970-01-01 00:00:00.000000000 +0000
63+++ src/chrome/common/extensions/api/infobars.json 2012-07-16 15:38:08.703653129 -0400
64@@ -0,0 +1,51 @@
65+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
66+// Use of this source code is governed by a BSD-style license that can be
67+// found in the LICENSE file.
68+
69+[
70+ {
71+ "namespace": "infobars",
72+ "dependencies": [ "windows" ],
73+ "types": [],
74+ "functions": [
75+ {
76+ "name": "show",
77+ "type": "function",
78+ "description": "Shows an infobar in the specified tab. The infobar will be closed automatically when the tab navigates. Use window.close() to close the infobar before then.",
79+ "parameters": [
80+ {
81+ "name": "details",
82+ "type": "object",
83+ "properties": {
84+ "tabId": {
85+ "type": "integer",
86+ "description": "The tab id for the tab to display the infobar in."
87+ },
88+ "path": {
89+ "type": "string",
90+ "description": "The html file that contains the infobar."
91+ },
92+ "height": {
93+ "type": "integer",
94+ "description": "The height (in pixels) of the infobar to show. If omitted, the default infobar height will be used.",
95+ "optional": true,
96+ "minimum": 0,
97+ "maximum": 72
98+ }
99+ }
100+ },
101+ {
102+ "type": "function",
103+ "name": "callback",
104+ "optional": true,
105+ "parameters": [
106+ {
107+ "name": "window", "$ref": "Window", "description": "Contains details about the window in which the infobar was created."
108+ }
109+ ]
110+ }
111+ ]
112+ }
113+ ]
114+ }
115+]
116Index: src/chrome/common/extensions/api/extension_api.cc
117===================================================================
118--- src.orig/chrome/common/extensions/api/extension_api.cc 2012-07-07 01:01:17.000000000 -0400
119+++ src/chrome/common/extensions/api/extension_api.cc 2012-07-16 15:33:42.375644366 -0400
120@@ -297,8 +297,6 @@
121 IDR_EXTENSION_API_JSON_EXPERIMENTAL_FONTSSETTINGS));
122 RegisterSchema("experimental.identity", ReadFromResource(
123 IDR_EXTENSION_API_JSON_EXPERIMENTAL_IDENTITY));
124- RegisterSchema("experimental.infobars", ReadFromResource(
125- IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS));
126 RegisterSchema("experimental.input.ui", ReadFromResource(
127 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_UI));
128 RegisterSchema("experimental.input.virtualKeyboard", ReadFromResource(
129@@ -331,6 +329,8 @@
130 IDR_EXTENSION_API_JSON_I18N));
131 RegisterSchema("idle", ReadFromResource(
132 IDR_EXTENSION_API_JSON_IDLE));
133+ RegisterSchema("infobars",ReadFromResource(
134+ IDR_EXTENSION_API_JSON_INFOBARS));
135 RegisterSchema("experimental.input.ime", ReadFromResource(
136 IDR_EXTENSION_API_JSON_INPUT_IME));
137 RegisterSchema("inputMethodPrivate", ReadFromResource(
138Index: src/chrome/common/extensions/api/experimental.infobars.json
139===================================================================
140--- src.orig/chrome/common/extensions/api/experimental.infobars.json 2012-07-07 01:01:17.000000000 -0400
141+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
142@@ -1,51 +0,0 @@
143-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
144-// Use of this source code is governed by a BSD-style license that can be
145-// found in the LICENSE file.
146-
147-[
148- {
149- "namespace": "experimental.infobars",
150- "dependencies": [ "windows" ],
151- "types": [],
152- "functions": [
153- {
154- "name": "show",
155- "type": "function",
156- "description": "Shows an infobar in the specified tab. The infobar will be closed automatically when the tab navigates. Use window.close() to close the infobar before then.",
157- "parameters": [
158- {
159- "name": "details",
160- "type": "object",
161- "properties": {
162- "tabId": {
163- "type": "integer",
164- "description": "The tab id for the tab to display the infobar in."
165- },
166- "path": {
167- "type": "string",
168- "description": "The html file that contains the infobar."
169- },
170- "height": {
171- "type": "integer",
172- "description": "The height (in pixels) of the infobar to show. If omitted, the default infobar height will be used.",
173- "optional": true,
174- "minimum": 0,
175- "maximum": 72
176- }
177- }
178- },
179- {
180- "type": "function",
181- "name": "callback",
182- "optional": true,
183- "parameters": [
184- {
185- "name": "window", "$ref": "Window", "description": "Contains details about the window in which the infobar was created."
186- }
187- ]
188- }
189- ]
190- }
191- ]
192- }
193-]
0194
=== added file 'debian/patches/2-get-domain-tld.patch'
--- debian/patches/2-get-domain-tld.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/2-get-domain-tld.patch 2012-08-06 17:52:22 +0000
@@ -0,0 +1,255 @@
1Index: src/chrome/browser/extensions/api/tld/tld_api.cc
2===================================================================
3--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4+++ src/chrome/browser/extensions/api/tld/tld_api.cc 2012-07-16 15:39:31.611655856 -0400
5@@ -0,0 +1,88 @@
6+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
7+// Use of this source code is governed by a BSD-style license that can be
8+// found in the LICENSE file.
9+
10+#include "chrome/browser/extensions/api/tld/tld_api.h"
11+
12+#include "base/time.h"
13+#include "base/values.h"
14+#include "chrome/browser/extensions/extension_service.h"
15+#include "chrome/common/extensions/extension.h"
16+#include "chrome/common/extensions/extension_constants.h"
17+#include "googleurl/src/gurl.h"
18+#include "googleurl/src/url_parse.h"
19+#include "googleurl/src/url_util.h"
20+#include "net/base/registry_controlled_domain.h"
21+
22+namespace {
23+const char kInvalidUriError[] = "Invalid or unsupported URI";
24+
25+bool IsValidUrl(const GURL& url) {
26+ return url.is_valid() && url.IsStandard() &&
27+ !url.SchemeIsFile() && !url.SchemeIsFileSystem();
28+}
29+} // namespace
30+
31+bool TldGetBaseDomainFunction::RunImpl() {
32+ EXTENSION_FUNCTION_VALIDATE(args_->GetSize() == 1);
33+
34+ std::string uri;
35+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &uri));
36+
37+ // We might delegate all the url validity check to GetDomainAndRegistry
38+ // but try to be more explicit about the errors in some cases.
39+ const GURL url(uri);
40+ if (!IsValidUrl(url)) {
41+ error_ = kInvalidUriError;
42+ return false;
43+ }
44+
45+ std::string tld =
46+ net::RegistryControlledDomainService::GetDomainAndRegistry(url);
47+
48+ result_.reset(Value::CreateStringValue(tld));
49+
50+ return true;
51+}
52+
53+
54+bool TldGetPublicSuffix::RunImpl() {
55+ EXTENSION_FUNCTION_VALIDATE(args_->GetSize() == 2);
56+
57+ std::string uri;
58+ EXTENSION_FUNCTION_VALIDATE(!args_->GetString(0, &uri));
59+
60+ // We might delegate all the url validity check to GetDomainAndRegistry
61+ // or GetRegistryLength but try to be more explicit about the errors in
62+ // some cases.
63+ const GURL url(uri);
64+ if (!IsValidUrl(url)) {
65+ error_ = kInvalidUriError;
66+ return false;
67+ }
68+
69+ std::string suffix;
70+
71+ size_t reg_len =
72+ net::RegistryControlledDomainService::GetRegistryLength(url, true);
73+
74+ if (std::string::npos == reg_len || 0 == reg_len)
75+ return false;
76+
77+ std::string tld =
78+ net::RegistryControlledDomainService::GetDomainAndRegistry(url);
79+
80+ if (!tld.empty () && tld.size() > reg_len)
81+ suffix = tld.substr(tld.size() - reg_len - 1, reg_len);
82+
83+ // An empty suffix is a acceptable value since the URL might be
84+ // "properly formed" but might fall into cases such as:
85+ // * http://co.uk/file.html
86+ // * http://<IP address>/file.html
87+ // which are described by GetRegistryLength to return 0 (i.e. a valid value).
88+ result_.reset(Value::CreateStringValue(suffix));
89+
90+ return true;
91+}
92+
93+
94Index: src/chrome/browser/extensions/api/tld/tld_api.h
95===================================================================
96--- /dev/null 1970-01-01 00:00:00.000000000 +0000
97+++ src/chrome/browser/extensions/api/tld/tld_api.h 2012-07-16 15:39:31.611655856 -0400
98@@ -0,0 +1,26 @@
99+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
100+// Use of this source code is governed by a BSD-style license that can be
101+// found in the LICENSE file.
102+
103+#ifndef CHROME_BROWSER_EXTENSIONS_API_TLD_TLD_API_H_
104+#define CHROME_BROWSER_EXTENSIONS_API_TLD_TLD_API_H_
105+#pragma once
106+
107+#include "chrome/browser/extensions/extension_function.h"
108+
109+class TldGetBaseDomainFunction : public SyncExtensionFunction {
110+ public:
111+ virtual ~TldGetBaseDomainFunction() {}
112+ virtual bool RunImpl() OVERRIDE;
113+ DECLARE_EXTENSION_FUNCTION_NAME("tld.getBaseDomain");
114+};
115+
116+class TldGetPublicSuffix : public SyncExtensionFunction {
117+ public:
118+ virtual ~TldGetPublicSuffix() {}
119+ virtual bool RunImpl() OVERRIDE;
120+ DECLARE_EXTENSION_FUNCTION_NAME("tld.getPublicSuffix");
121+};
122+
123+#endif // CHROME_BROWSER_EXTENSIONS_API_TLD_TLD_API_H_
124+
125Index: src/chrome/browser/extensions/extension_function_registry.cc
126===================================================================
127--- src.orig/chrome/browser/extensions/extension_function_registry.cc 2012-07-07 00:59:55.000000000 -0400
128+++ src/chrome/browser/extensions/extension_function_registry.cc 2012-07-16 15:40:22.239657522 -0400
129@@ -19,6 +19,7 @@
130 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
131 #include "chrome/browser/extensions/api/serial/serial_api.h"
132 #include "chrome/browser/extensions/api/socket/socket_api.h"
133+#include "chrome/browser/extensions/api/tld/tld_api.h"
134 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
135 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
136 #include "chrome/browser/extensions/execute_code_in_tab_function.h"
137@@ -166,6 +167,10 @@
138 RegisterFunction<MoveBookmarkFunction>();
139 RegisterFunction<UpdateBookmarkFunction>();
140
141+ // TLD.
142+ RegisterFunction<TldGetBaseDomainFunction>();
143+ RegisterFunction<TldGetPublicSuffix>();
144+
145 // Infobars.
146 RegisterFunction<ShowInfoBarFunction>();
147
148Index: src/chrome/chrome_browser_extensions.gypi
149===================================================================
150--- src.orig/chrome/chrome_browser_extensions.gypi 2012-07-07 01:00:10.000000000 -0400
151+++ src/chrome/chrome_browser_extensions.gypi 2012-07-16 15:39:31.611655856 -0400
152@@ -156,6 +156,8 @@
153 'browser/extensions/api/terminal/terminal_extension_helper.h',
154 'browser/extensions/api/terminal/terminal_private_api.cc',
155 'browser/extensions/api/terminal/terminal_private_api.h',
156+ 'browser/extensions/api/tld/tld_api.cc',
157+ 'browser/extensions/api/tld/tld_api.h',
158 'browser/extensions/api/usb/usb_api.cc',
159 'browser/extensions/api/usb/usb_api.h',
160 'browser/extensions/api/usb/usb_device_resource.cc',
161Index: src/chrome/common/extensions_api_resources.grd
162===================================================================
163--- src.orig/chrome/common/extensions_api_resources.grd 2012-07-16 15:33:42.000000000 -0400
164+++ src/chrome/common/extensions_api_resources.grd 2012-07-16 15:39:31.611655856 -0400
165@@ -63,6 +63,7 @@
166 <include name="IDR_EXTENSION_API_JSON_TABS" file="extensions\api\tabs.json" type="BINDATA" />
167 <include name="IDR_EXTENSION_API_JSON_TERMINALPRIVATE" file="extensions\api\terminalPrivate.json" type="BINDATA" />
168 <include name="IDR_EXTENSION_API_JSON_TEST" file="extensions\api\test.json" type="BINDATA" />
169+ <include name="IDR_EXTENSION_API_JSON_TLD" file="extensions\api\tld.json" type="BINDATA" />
170 <include name="IDR_EXTENSION_API_JSON_TOPSITES" file="extensions\api\topSites.json" type="BINDATA" />
171 <include name="IDR_EXTENSION_API_JSON_TTS" file="extensions\api\tts.json" type="BINDATA" />
172 <include name="IDR_EXTENSION_API_JSON_TTSENGINE" file="extensions\api\ttsEngine.json" type="BINDATA" />
173Index: src/chrome/common/extensions/extension_permission_set.cc
174===================================================================
175--- src.orig/chrome/common/extensions/extension_permission_set.cc 2012-07-16 15:33:42.000000000 -0400
176+++ src/chrome/common/extensions/extension_permission_set.cc 2012-07-16 15:40:49.303658414 -0400
177@@ -53,6 +53,7 @@
178 "pageActions",
179 "permissions",
180 "test",
181+ "tld",
182 "types"
183 };
184 const size_t kNumNonPermissionModuleNames =
185Index: src/chrome/common/extensions/api/extension_api.cc
186===================================================================
187--- src.orig/chrome/common/extensions/api/extension_api.cc 2012-07-16 15:33:42.000000000 -0400
188+++ src/chrome/common/extensions/api/extension_api.cc 2012-07-16 15:39:31.611655856 -0400
189@@ -369,6 +369,8 @@
190 IDR_EXTENSION_API_JSON_TERMINALPRIVATE));
191 RegisterSchema("test", ReadFromResource(
192 IDR_EXTENSION_API_JSON_TEST));
193+ RegisterSchema("tld", ReadFromResource(
194+ IDR_EXTENSION_API_JSON_TLD));
195 RegisterSchema("topSites", ReadFromResource(
196 IDR_EXTENSION_API_JSON_TOPSITES));
197 RegisterSchema("ttsEngine", ReadFromResource(
198Index: src/chrome/common/extensions/api/tld.json
199===================================================================
200--- /dev/null 1970-01-01 00:00:00.000000000 +0000
201+++ src/chrome/common/extensions/api/tld.json 2012-07-16 15:39:31.615655856 -0400
202@@ -0,0 +1,53 @@
203+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
204+// Use of this source code is governed by a BSD-style license that can be
205+// found in the LICENSE file.
206+
207+[
208+ {
209+ "namespace": "tld",
210+ "nodoc": "true",
211+ "types": [],
212+ "functions": [
213+ {
214+ "name": "getBaseDomain",
215+ "type": "function",
216+ "description": "Returns the base domain of a URI; that is, the public suffix with a given number of additional domain name parts.",
217+ "nodoc": "true",
218+ "parameters": [
219+ {
220+ "name": "uri",
221+ "type": "string"
222+ },
223+ {
224+ "type": "function",
225+ "name": "callback",
226+ "parameters": [
227+ {"name": "domain", "type": "string", "description": "The base domain name of the associated URI if any"}
228+ ]
229+ }
230+ ]
231+ }
232+ ,
233+ {
234+ "name": "getPublicSuffix",
235+ "type": "function",
236+ "description": "Returns the public suffix of the domain part of a URI.",
237+ "nodoc": "true",
238+ "parameters": [
239+ {
240+ "name": "uri",
241+ "type": "string"
242+ },
243+ {
244+ "type": "function",
245+ "name": "callback",
246+ "parameters": [
247+ {"name": "suffix", "type": "string", "description": "The public suffix of the associated URI if any"}
248+ ]
249+ }
250+ ]
251+ }
252+ ]
253+ }
254+
255+]
0256
=== added file 'debian/patches/3-chrome-xid.patch'
--- debian/patches/3-chrome-xid.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/3-chrome-xid.patch 2012-08-06 17:52:22 +0000
@@ -0,0 +1,38 @@
1Index: src/chrome/browser/ui/gtk/browser_window_gtk.cc
2===================================================================
3--- src.orig/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-07 01:00:04.000000000 -0400
4+++ src/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-16 15:41:21.991659488 -0400
5@@ -150,6 +150,12 @@
6 // gtk_window_get_position() after the last GTK configure-event signal.
7 const int kDebounceTimeoutMilliseconds = 100;
8
9+// A window property will be set to reflect the session_id of the
10+// associated browser window. The session_id is unique among browsers
11+// for a given session and actually corresponds to the window.id found
12+// in the extensions api.
13+char kSessionIdPropertyName[] = "CHROMIUM_LINUX_SESSION_ID_PROPERTY";
14+
15 // Ubuntu patches their verrsion of GTK+ so that there is always a
16 // gripper in the bottom right corner of the window. We dynamically
17 // look up this symbol because it's a non-standard Ubuntu extension to
18@@ -422,6 +428,20 @@
19 InitWidgets();
20 }
21
22+ // Add a specific property to inform an interested third party
23+ // of our session id. Interesting in the context of an extension
24+ // where the session id corresponds to the window.id and is a way
25+ // to uniquely identify a window based on that (from within a given
26+ // extension).
27+ gulong session_id = browser_->session_id().id();
28+ gdk_property_change(GTK_WIDGET(window_)->window,
29+ gdk_atom_intern(kSessionIdPropertyName, FALSE),
30+ gdk_atom_intern("CARDINAL", FALSE),
31+ 32,
32+ GDK_PROP_MODE_REPLACE,
33+ (guchar *)&session_id,
34+ 1);
35+
36 ConnectAccelerators();
37
38 // Set the initial background color of widgets.
039
=== added file 'debian/patches/arm.patch'
--- debian/patches/arm.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/arm.patch 2012-08-06 17:52:22 +0000
@@ -0,0 +1,50 @@
1Index: src/skia/skia.gyp
2===================================================================
3--- src.orig/skia/skia.gyp 2012-05-19 16:54:19.000000000 +0200
4+++ src/skia/skia.gyp 2012-06-20 14:34:13.131318952 +0200
5@@ -1157,9 +1157,11 @@
6 [ 'target_arch == "arm" and armv7 != 1', {
7 'sources': [
8 '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
9+ '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
10 ],
11 'sources!': [
12 '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
13+ '../third_party/skia/src/opts/opts_check_arm.cpp',
14 ],
15 }],
16 ],
17Index: src/ui/base/resource/data_pack.cc
18===================================================================
19--- src.orig/ui/base/resource/data_pack.cc 2012-05-19 16:55:37.000000000 +0200
20+++ src/ui/base/resource/data_pack.cc 2012-06-20 14:38:32.507316901 +0200
21@@ -130,9 +130,11 @@
22 // 2) Verify the entries are within the appropriate bounds. There's an extra
23 // entry after the last item which gives us the length of the last item.
24 for (size_t i = 0; i < resource_count_ + 1; ++i) {
25+ uint32 t;
26 const DataPackEntry* entry = reinterpret_cast<const DataPackEntry*>(
27 mmap_->data() + kHeaderLength + (i * sizeof(DataPackEntry)));
28- if (entry->file_offset > mmap_->length()) {
29+ memcpy(&t, &entry->file_offset, 32/8);
30+ if (t > mmap_->length()) {
31 LOG(ERROR) << "Entry #" << i << " in data pack points off end of file. "
32 << "Was the file corrupted?";
33 UMA_HISTOGRAM_ENUMERATION("DataPack.Load", ENTRY_NOT_FOUND,
34Index: src/v8/src/arm/macro-assembler-arm.cc
35===================================================================
36--- src.orig/v8/src/arm/macro-assembler-arm.cc 2012-05-19 16:57:27.000000000 +0200
37+++ src/v8/src/arm/macro-assembler-arm.cc 2012-06-20 14:35:27.339318363 +0200
38@@ -61,9 +61,9 @@
39 // We do not support thumb inter-working with an arm architecture not supporting
40 // the blx instruction (below v5t). If you know what CPU you are compiling for
41 // you can use -march=armv7 or similar.
42-#if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS)
43-# error "For thumb inter-working we require an architecture which supports blx"
44-#endif
45+//#if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS)
46+//# error "For thumb inter-working we require an architecture which supports blx"
47+//#endif
48
49
50 // Using bx does not yield better code, so use it only when required
051
=== added file 'debian/patches/chromeless-window-launch-option.patch'
--- debian/patches/chromeless-window-launch-option.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/chromeless-window-launch-option.patch 2012-08-06 17:52:22 +0000
@@ -0,0 +1,860 @@
1Index: src/chrome/browser/ui/gtk/browser_window_gtk.cc
2===================================================================
3--- src.orig/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-11 23:49:59.216259275 -0400
4+++ src/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-11 23:49:59.232259276 -0400
5@@ -412,6 +412,8 @@
6 SetWindowCustomClass(window_,
7 std::string(gdk_get_program_class()) +
8 " (" + user_data_dir + ")");
9+ } else if (browser_->is_chromeless_mode()) {
10+ SetWindowCustomClass(window_, web_app::GetWMClassFromAppName("chromeless"));
11 }
12
13 // For popups, we initialize widgets then set the window geometry, because
14@@ -980,7 +982,7 @@
15 }
16
17 void BrowserWindowGtk::SetFocusToLocationBar(bool select_all) {
18- if (!IsFullscreen())
19+ if (!IsFullscreen() && IsToolbarSupported())
20 GetLocationBar()->FocusLocation(select_all);
21 }
22
23@@ -2546,7 +2548,7 @@
24
25 bool BrowserWindowGtk::UseCustomFrame() const {
26 // We don't use the custom frame for app mode windows or app window popups.
27- return use_custom_frame_pref_.GetValue() && !browser_->is_app();
28+ return use_custom_frame_pref_.GetValue() && !browser_->is_app() && !browser_->is_chromeless_mode();
29 }
30
31 bool BrowserWindowGtk::BoundsMatchMonitorSize() {
32Index: src/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
33===================================================================
34--- src.orig/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc 2012-07-07 01:00:04.000000000 -0400
35+++ src/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc 2012-07-11 23:49:59.232259276 -0400
36@@ -777,9 +777,11 @@
37 g_signal_connect(tabstrip_.get(), "drag-data-received",
38 G_CALLBACK(OnDragDataReceivedThunk), this);
39
40- newtab_button_.reset(MakeNewTabButton());
41- newtab_surface_bounds_.SetRect(0, 0, newtab_button_->SurfaceWidth(),
42- newtab_button_->SurfaceHeight());
43+ if (window_ && window_->browser() && ! window_->browser()->is_chromeless_mode()) {
44+ newtab_button_.reset(MakeNewTabButton());
45+ newtab_surface_bounds_.SetRect(0, 0, newtab_button_->SurfaceWidth(),
46+ newtab_button_->SurfaceHeight());
47+ }
48
49 gtk_widget_show_all(tabstrip_.get());
50
51@@ -1451,6 +1453,9 @@
52
53 void TabStripGtk::LayoutNewTabButton(double last_tab_right,
54 double unselected_width) {
55+ if (window_ && window_->browser() && window_->browser()->is_chromeless_mode())
56+ return;
57+
58 GtkWidget* toplevel = gtk_widget_get_ancestor(widget(), GTK_TYPE_WINDOW);
59 bool is_maximized = false;
60 if (toplevel) {
61@@ -1504,8 +1509,10 @@
62 int available_width = tabstrip_allocation.width;
63 if (available_width_for_tabs_ < 0) {
64 available_width = bounds_.width();
65- available_width -=
66+ if (newtab_button_.get() != NULL) {
67+ available_width -=
68 (kNewTabButtonHOffset + newtab_button_->WidgetAllocation().width);
69+ }
70 } else {
71 // Interesting corner case: if |available_width_for_tabs_| > the result
72 // of the calculation in the conditional arm above, the strip is in
73@@ -2062,9 +2069,11 @@
74 event->area.height = bounds_.height();
75 gdk_region_union_with_rect(event->region, &event->area);
76
77- // Paint the New Tab button.
78- gtk_container_propagate_expose(GTK_CONTAINER(tabstrip_.get()),
79- newtab_button_->widget(), event);
80+ if (newtab_button_.get() != NULL) {
81+ // Paint the New Tab button.
82+ gtk_container_propagate_expose(GTK_CONTAINER(tabstrip_.get()),
83+ newtab_button_->widget(), event);
84+ }
85
86 // Paint the tabs in reverse order, so they stack to the left.
87 TabGtk* selected_tab = NULL;
88@@ -2257,6 +2266,9 @@
89 }
90
91 void TabStripGtk::SetNewTabButtonBackground() {
92+ if (newtab_button_.get() == NULL) {
93+ return;
94+ }
95 SkColor color = theme_service_->GetColor(
96 ThemeService::COLOR_BUTTON_BACKGROUND);
97 SkBitmap* background = theme_service_->GetBitmapNamed(
98Index: src/chrome/browser/ui/browser.h
99===================================================================
100--- src.orig/chrome/browser/ui/browser.h 2012-07-07 01:00:04.000000000 -0400
101+++ src/chrome/browser/ui/browser.h 2012-07-11 23:49:59.236259276 -0400
102@@ -194,6 +194,9 @@
103 // window is created by this function call.
104 static Browser* Create(Profile* profile);
105
106+ // Like Create, but creates a chromeless browser.
107+ static Browser* CreateChromeless(Profile * profile);
108+
109 // Like Create, but creates a browser of the specified parameters.
110 static Browser* CreateWithParams(const CreateParams& params);
111
112@@ -868,6 +871,7 @@
113 bool is_type_popup() const { return type_ == TYPE_POPUP; }
114 bool is_type_panel() const { return type_ == TYPE_PANEL; }
115
116+ bool is_chromeless_mode() const;
117 bool is_app() const;
118 bool is_devtools() const;
119
120@@ -1355,6 +1359,8 @@
121 // Type of app (host or child). See description of AppType.
122 AppType app_type_;
123
124+ bool is_chromeless_mode_;
125+
126 // Unique identifier of this browser for session restore. This id is only
127 // unique within the current session, and is not guaranteed to be unique
128 // across sessions.
129Index: src/chrome/browser/ui/browser_init.h
130===================================================================
131--- src.orig/chrome/browser/ui/browser_init.h 2012-07-07 01:00:03.000000000 -0400
132+++ src/chrome/browser/ui/browser_init.h 2012-07-11 23:49:59.236259276 -0400
133@@ -159,6 +159,11 @@
134 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs);
135 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
136
137+ // If the process was launched with the chromeless command line flag,
138+ // e.g. --chromeless=http://www.google.com/ return true.
139+ // In this case |url| is populated if they're non-null.
140+ bool IsChromelessLaunch(std::string* url);
141+
142 // If the process was launched with the web application command line flags,
143 // e.g. --app=http://www.google.com/ or --app_id=... return true.
144 // In this case |app_url| or |app_id| are populated if they're non-null.
145Index: src/chrome/browser/ui/browser_init.cc
146===================================================================
147--- src.orig/chrome/browser/ui/browser_init.cc 2012-07-07 01:00:08.000000000 -0400
148+++ src/chrome/browser/ui/browser_init.cc 2012-07-11 23:49:59.236259276 -0400
149@@ -972,6 +972,16 @@
150 return true;
151 }
152
153+bool BrowserInit::LaunchWithProfile::IsChromelessLaunch(std::string* url)
154+{
155+ if (command_line_.HasSwitch(switches::kChromeless)) {
156+ if (url)
157+ *url = command_line_.GetSwitchValueASCII(switches::kChromeless);
158+ return true;
159+ }
160+ return false;
161+}
162+
163 bool BrowserInit::LaunchWithProfile::IsAppLaunch(std::string* app_url,
164 std::string* app_id) {
165 if (command_line_.HasSwitch(switches::kApp)) {
166@@ -1084,6 +1094,12 @@
167 return;
168 }
169
170+ if (IsChromelessLaunch(NULL)) {
171+ // Open user-specified URLs like pinned tabs and startup tabs.
172+ if (ProcessSpecifiedURLs(urls_to_open))
173+ return;
174+ }
175+
176 if (process_startup && ProcessStartupURLs(urls_to_open)) {
177 // ProcessStartupURLs processed the urls, nothing else to do.
178 return;
179@@ -1179,7 +1195,8 @@
180 // mode. Also, no pages should be opened automatically if the session
181 // crashed. Otherwise it might trigger another crash, locking the user out of
182 // chrome. The crash infobar is shown in this case.
183- if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_,
184+ if (!IsChromelessLaunch(NULL) &&
185+ !IncognitoModePrefs::ShouldLaunchIncognito(command_line_,
186 profile_->GetPrefs()) &&
187 !HasPendingUncleanExit(profile_)) {
188 tabs = PinnedTabCodec::ReadPinnedTabs(profile_);
189@@ -1256,6 +1273,11 @@
190 if (!profile_ && browser)
191 profile_ = browser->profile();
192
193+ if (IsChromelessLaunch(NULL)) {
194+ g_message("OPenTabsInBrowser: %p chromeless create", browser);
195+ browser = Browser::CreateChromeless(profile_);
196+ }
197+
198 if (!browser || !browser->is_type_tabbed()) {
199 browser = Browser::Create(profile_);
200 } else {
201@@ -1325,6 +1347,13 @@
202 if (!browser || !profile_ || browser->tab_count() == 0)
203 return;
204
205+ // We consider that being in a chromeless launch, we are to minimize as much as
206+ // possible the most obvious "classic" Chromium behavior.
207+ if (IsChromelessLaunch(NULL))
208+ {
209+ return;
210+ }
211+
212 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper();
213 AddCrashedInfoBarIfNecessary(browser, tab_contents);
214
215Index: src/chrome/browser/ui/gtk/global_menu_bar.cc
216===================================================================
217--- src.orig/chrome/browser/ui/gtk/global_menu_bar.cc 2012-07-07 01:00:04.000000000 -0400
218+++ src/chrome/browser/ui/gtk/global_menu_bar.cc 2012-07-11 23:49:59.236259276 -0400
219@@ -23,35 +23,43 @@
220 #include "ui/base/gtk/menu_label_accelerator_util.h"
221 #include "ui/base/l10n/l10n_util.h"
222
223+typedef bool (*GlobalMenuBarVisibilityHandler) (Browser * browser);
224+
225 struct GlobalMenuBarCommand {
226 int str_id;
227 int command;
228 int tag;
229+ GlobalMenuBarVisibilityHandler visibility_handler;
230 };
231
232 namespace {
233
234+static bool GlobalMenuBarVisibilityHandler_NotInChromelessMode(
235+ Browser * browser) {
236+ return browser && !browser->is_chromeless_mode();
237+}
238+
239 const int MENU_SEPARATOR =-1;
240 const int MENU_END = -2;
241 const int MENU_DISABLED_LABEL = -3;
242
243 GlobalMenuBarCommand file_menu[] = {
244- { IDS_NEW_TAB, IDC_NEW_TAB },
245- { IDS_NEW_WINDOW, IDC_NEW_WINDOW },
246- { IDS_NEW_INCOGNITO_WINDOW, IDC_NEW_INCOGNITO_WINDOW },
247- { IDS_REOPEN_CLOSED_TABS_LINUX, IDC_RESTORE_TAB },
248- { IDS_OPEN_FILE_LINUX, IDC_OPEN_FILE },
249- { IDS_OPEN_LOCATION_LINUX, IDC_FOCUS_LOCATION },
250+ { IDS_NEW_TAB, IDC_NEW_TAB, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
251+ { IDS_NEW_WINDOW, IDC_NEW_WINDOW, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
252+ { IDS_NEW_INCOGNITO_WINDOW, IDC_NEW_INCOGNITO_WINDOW, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
253+ { IDS_REOPEN_CLOSED_TABS_LINUX, IDC_RESTORE_TAB, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
254+ { IDS_OPEN_FILE_LINUX, IDC_OPEN_FILE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
255+ { IDS_OPEN_LOCATION_LINUX, IDC_FOCUS_LOCATION, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
256
257- { MENU_SEPARATOR, MENU_SEPARATOR },
258+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
259
260- { IDS_CREATE_SHORTCUTS, IDC_CREATE_SHORTCUTS },
261+ { IDS_CREATE_SHORTCUTS, IDC_CREATE_SHORTCUTS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
262
263- { MENU_SEPARATOR, MENU_SEPARATOR },
264+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
265
266 { IDS_CLOSE_WINDOW_LINUX, IDC_CLOSE_WINDOW },
267 { IDS_CLOSE_TAB_LINUX, IDC_CLOSE_TAB },
268- { IDS_SAVE_PAGE, IDC_SAVE_PAGE },
269+ { IDS_SAVE_PAGE, IDC_SAVE_PAGE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
270
271 { MENU_SEPARATOR, MENU_SEPARATOR },
272
273@@ -69,17 +77,17 @@
274
275 { IDS_FIND, IDC_FIND },
276
277- { MENU_SEPARATOR, MENU_SEPARATOR },
278+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
279
280- { IDS_PREFERENCES, IDC_OPTIONS },
281+ { IDS_PREFERENCES, IDC_OPTIONS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
282
283 { MENU_END, MENU_END }
284 };
285
286 GlobalMenuBarCommand view_menu[] = {
287- { IDS_SHOW_BOOKMARK_BAR, IDC_SHOW_BOOKMARK_BAR },
288+ { IDS_SHOW_BOOKMARK_BAR, IDC_SHOW_BOOKMARK_BAR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
289
290- { MENU_SEPARATOR, MENU_SEPARATOR },
291+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
292
293 { IDS_STOP_MENU_LINUX, IDC_STOP },
294 { IDS_RELOAD_MENU_LINUX, IDC_RELOAD },
295@@ -95,48 +103,48 @@
296 };
297
298 GlobalMenuBarCommand history_menu[] = {
299- { IDS_HISTORY_HOME_LINUX, IDC_HOME },
300- { IDS_HISTORY_BACK_LINUX, IDC_BACK },
301- { IDS_HISTORY_FORWARD_LINUX, IDC_FORWARD },
302+ { IDS_HISTORY_HOME_LINUX, IDC_HOME, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
303+ { IDS_HISTORY_BACK_LINUX, IDC_BACK, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
304+ { IDS_HISTORY_FORWARD_LINUX, IDC_FORWARD, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
305
306- { MENU_SEPARATOR, MENU_SEPARATOR },
307+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
308
309 { IDS_HISTORY_VISITED_LINUX, MENU_DISABLED_LABEL,
310- GlobalMenuBar::TAG_MOST_VISITED_HEADER },
311+ GlobalMenuBar::TAG_MOST_VISITED_HEADER, GlobalMenuBarVisibilityHandler_NotInChromelessMode },
312
313- { MENU_SEPARATOR, MENU_SEPARATOR },
314+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
315
316 { IDS_HISTORY_CLOSED_LINUX, MENU_DISABLED_LABEL,
317- GlobalMenuBar::TAG_RECENTLY_CLOSED_HEADER },
318+ GlobalMenuBar::TAG_RECENTLY_CLOSED_HEADER, GlobalMenuBarVisibilityHandler_NotInChromelessMode },
319
320- { MENU_SEPARATOR, MENU_SEPARATOR },
321+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
322
323- { IDS_SHOWFULLHISTORY_LINK, IDC_SHOW_HISTORY },
324+ { IDS_SHOWFULLHISTORY_LINK, IDC_SHOW_HISTORY, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
325
326 { MENU_END, MENU_END }
327 };
328
329 GlobalMenuBarCommand tools_menu[] = {
330- { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS },
331- { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY },
332- { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS },
333+ { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
334+ { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
335+ { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
336
337- { MENU_SEPARATOR, MENU_SEPARATOR },
338+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
339
340- { IDS_TASK_MANAGER, IDC_TASK_MANAGER },
341- { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA },
342+ { IDS_TASK_MANAGER, IDC_TASK_MANAGER, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
343+ { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
344
345- { MENU_SEPARATOR, MENU_SEPARATOR },
346+ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
347
348- { IDS_VIEW_SOURCE, IDC_VIEW_SOURCE },
349- { IDS_DEV_TOOLS, IDC_DEV_TOOLS },
350- { IDS_DEV_TOOLS_CONSOLE, IDC_DEV_TOOLS_CONSOLE },
351+ { IDS_VIEW_SOURCE, IDC_VIEW_SOURCE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
352+ { IDS_DEV_TOOLS, IDC_DEV_TOOLS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
353+ { IDS_DEV_TOOLS_CONSOLE, IDC_DEV_TOOLS_CONSOLE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
354
355 { MENU_END, MENU_END }
356 };
357
358 GlobalMenuBarCommand help_menu[] = {
359- { IDS_FEEDBACK, IDC_FEEDBACK },
360+ { IDS_FEEDBACK, IDC_FEEDBACK, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
361 { IDS_HELP_PAGE , IDC_HELP_PAGE },
362 { MENU_END, MENU_END }
363 };
364@@ -190,8 +198,10 @@
365 }
366
367 pref_change_registrar_.Init(browser_->profile()->GetPrefs());
368- pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
369- OnBookmarkBarVisibilityChanged();
370+ if (! browser_->is_chromeless_mode()) {
371+ pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
372+ OnBookmarkBarVisibilityChanged();
373+ }
374 }
375
376 GlobalMenuBar::~GlobalMenuBar() {
377@@ -214,8 +224,22 @@
378 std::map<int, GtkWidget*>* id_to_menu_item,
379 GlobalMenuBarCommand* commands,
380 GlobalMenuOwner* owner) {
381+ // first pass to count the number of "visible" items
382+ size_t count = 0;
383+ for (int i = 0; commands[i].str_id != MENU_END; ++i) {
384+ if (!commands[i].visibility_handler || commands[i].visibility_handler(browser_)) {
385+ count++;
386+ }
387+ }
388+ if (0 == count) {
389+ return;
390+ }
391+
392 GtkWidget* menu = gtk_menu_new();
393 for (int i = 0; commands[i].str_id != MENU_END; ++i) {
394+ if (commands[i].visibility_handler && !commands[i].visibility_handler(browser_)) {
395+ continue;
396+ }
397 GtkWidget* menu_item = BuildMenuItem(
398 commands[i].str_id, commands[i].command, commands[i].tag,
399 id_to_menu_item, menu);
400Index: src/chrome/browser/ui/browser.cc
401===================================================================
402--- src.orig/chrome/browser/ui/browser.cc 2012-07-07 01:00:04.000000000 -0400
403+++ src/chrome/browser/ui/browser.cc 2012-07-12 01:02:11.796401815 -0400
404@@ -375,6 +375,7 @@
405 ALLOW_THIS_IN_INITIALIZER_LIST(
406 tab_strip_model_(new TabStripModel(this, profile))),
407 command_updater_(this),
408+ is_chromeless_mode_(false),
409 app_type_(APP_TYPE_HOST),
410 chrome_updater_factory_(this),
411 is_attempting_to_close_browser_(false),
412@@ -538,6 +539,15 @@
413 }
414
415 // static
416+Browser* Browser::CreateChromeless(Profile * profile)
417+{
418+ Browser* browser = new Browser(TYPE_TABBED, profile);
419+ browser->is_chromeless_mode_ = true;
420+ browser->InitBrowserWindow();
421+ return browser;
422+}
423+
424+// static
425 Browser* Browser::CreateWithParams(const CreateParams& params) {
426 if (!params.app_name.empty())
427 RegisterAppPrefs(params.app_name, params.profile);
428@@ -624,6 +634,10 @@
429 return find_bar_controller_.get() != NULL;
430 }
431
432+bool Browser::is_chromeless_mode () const {
433+ return is_chromeless_mode_;
434+}
435+
436 bool Browser::is_app() const {
437 return !app_name_.empty();
438 }
439@@ -1162,7 +1176,7 @@
440 #else
441 int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT;
442 // Don't append the app name to window titles on app frames and app popups
443- if (is_app())
444+ if (is_app() || is_chromeless_mode())
445 string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO;
446 return l10n_util::GetStringFUTF16(string_id, title);
447 #endif
448@@ -1230,7 +1244,7 @@
449 tab_restore_service->BrowserClosing(tab_restore_service_delegate());
450 #endif
451
452- if (tab_restore_service && is_type_tabbed() && tab_count())
453+ if (tab_restore_service && is_type_tabbed() && !is_chromeless_mode() && tab_count())
454 tab_restore_service->BrowserClosing(tab_restore_service_delegate());
455
456 // TODO(sky): convert session/tab restore to use notification.
457@@ -1683,6 +1697,9 @@
458 void Browser::NewTab() {
459 content::RecordAction(UserMetricsAction("NewTab"));
460
461+ if (is_chromeless_mode())
462+ return;
463+
464 if (is_type_tabbed()) {
465 AddBlankTab(true);
466 GetSelectedWebContents()->GetView()->RestoreFocus();
467@@ -2962,7 +2979,8 @@
468
469 void Browser::TabRestoreServiceChanged(TabRestoreService* service) {
470 command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB,
471- !service->entries().empty());
472+ !service->entries().empty()
473+ && !is_chromeless_mode());
474 }
475
476 void Browser::TabRestoreServiceDestroyed(TabRestoreService* service) {
477@@ -3124,7 +3142,7 @@
478 void Browser::CreateHistoricalTab(TabContentsWrapper* contents) {
479 // We don't create historical tabs for incognito windows or windows without
480 // profiles.
481- if (!profile() || profile()->IsOffTheRecord())
482+ if (!profile() || profile()->IsOffTheRecord() || is_chromeless_mode())
483 return;
484
485 // We don't create historical tabs for print preview tabs.
486@@ -3833,7 +3851,7 @@
487 const history::HistoryAddPageArgs& add_page_args,
488 content::NavigationType navigation_type) {
489 // Don't update history if running as app.
490- return !IsApplication();
491+ return !IsApplication() && !is_chromeless_mode();
492 }
493
494 bool Browser::ShouldCreateWebContents(
495@@ -4377,6 +4395,8 @@
496 // All browser commands whose state isn't set automagically some other way
497 // (like Back & Forward with initial page load) must have their state
498 // initialized here, otherwise they will be forever disabled.
499+ bool started_in_chromeless =
500+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless);
501
502 // Navigation commands
503 command_updater_.UpdateCommandEnabled(IDC_RELOAD, true);
504@@ -4384,10 +4404,10 @@
505
506 // Window management commands
507 command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true);
508- command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true);
509+ command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, !started_in_chromeless);
510 command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true);
511- command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true);
512- command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, false);
513+ command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, !started_in_chromeless);
514+ command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, !started_in_chromeless);
515 command_updater_.UpdateCommandEnabled(IDC_EXIT, true);
516 command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true);
517
518@@ -4442,23 +4462,27 @@
519 UpdateOpenFileState();
520 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false);
521 UpdateCommandsForDevTools();
522- command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true);
523- command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true);
524- command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true);
525+ command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, !started_in_chromeless);
526+ command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, !started_in_chromeless);
527+ command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, !started_in_chromeless);
528 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true);
529- command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true);
530+ command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, !started_in_chromeless);
531
532 #if defined(OS_CHROMEOS)
533 command_updater_.UpdateCommandEnabled(IDC_SHOW_KEYBOARD_OVERLAY, true);
534 #endif
535 command_updater_.UpdateCommandEnabled(
536- IDC_SHOW_SYNC_SETUP, profile_->GetOriginalProfile()->IsSyncAccessible());
537+ IDC_SHOW_SYNC_SETUP,
538+ profile_->GetOriginalProfile()->IsSyncAccessible()
539+ && !started_in_chromeless);
540
541 // Initialize other commands based on the window type.
542 bool normal_window = is_type_tabbed();
543
544 // Navigation commands
545- command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window);
546+ command_updater_.UpdateCommandEnabled(IDC_HOME,
547+ normal_window
548+ && !started_in_chromeless);
549
550 // Window management commands
551 // TODO(rohitrao): Disable fullscreen on non-Lion?
552@@ -4493,7 +4517,9 @@
553 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, !is_devtools());
554
555 // Show various bits of UI
556- command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, normal_window);
557+ command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA,
558+ normal_window &&
559+ !started_in_chromeless);
560
561 // The upgrade entry and the view incompatibility entry should always be
562 // enabled. Whether they are visible is a separate matter determined on menu
563@@ -4519,14 +4545,20 @@
564 }
565
566 void Browser::UpdateCommandsForIncognitoAvailability() {
567+ bool started_in_chromeless =
568+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)
569+ || is_chromeless_mode();
570+
571 IncognitoModePrefs::Availability incognito_availability =
572 IncognitoModePrefs::GetAvailability(profile_->GetPrefs());
573 command_updater_.UpdateCommandEnabled(
574 IDC_NEW_WINDOW,
575- incognito_availability != IncognitoModePrefs::FORCED);
576+ incognito_availability != IncognitoModePrefs::FORCED &&
577+ !started_in_chromeless);
578 command_updater_.UpdateCommandEnabled(
579 IDC_NEW_INCOGNITO_WINDOW,
580- incognito_availability != IncognitoModePrefs::DISABLED);
581+ incognito_availability != IncognitoModePrefs::DISABLED &&
582+ !started_in_chromeless);
583
584 // Bookmark manager and settings page/subpages are forced to open in normal
585 // mode. For this reason we disable these commands when incognito is forced.
586@@ -4534,18 +4566,22 @@
587 incognito_availability != IncognitoModePrefs::FORCED;
588 command_updater_.UpdateCommandEnabled(
589 IDC_SHOW_BOOKMARK_MANAGER,
590- browser_defaults::bookmarks_enabled && command_enabled);
591+ browser_defaults::bookmarks_enabled &&
592+ command_enabled && !started_in_chromeless);
593 ExtensionService* extension_service = profile()->GetExtensionService();
594 bool enable_extensions =
595 extension_service && extension_service->extensions_enabled();
596 command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS,
597- enable_extensions && command_enabled);
598+ enable_extensions && command_enabled
599+ && !started_in_chromeless);
600
601 const bool show_main_ui = IsShowingMainUI(window_ && window_->IsFullscreen());
602 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS,
603- show_main_ui && command_enabled);
604+ show_main_ui && command_enabled
605+ && !started_in_chromeless);
606 command_updater_.UpdateCommandEnabled(IDC_OPTIONS,
607- show_main_ui && command_enabled);
608+ show_main_ui && command_enabled
609+ && !started_in_chromeless);
610 }
611
612 void Browser::UpdateCommandsForTabState() {
613@@ -4565,16 +4601,19 @@
614
615 // Window management commands
616 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
617- !is_app() && CanDuplicateContentsAt(active_index()));
618+ !is_chromeless_mode() && !is_app()
619+ && CanDuplicateContentsAt(active_index()));
620
621 // Page-related commands
622 window_->SetStarredState(
623 current_tab_wrapper->bookmark_tab_helper()->is_starred());
624 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
625- current_tab->GetController().CanViewSource());
626+ current_tab->GetController().CanViewSource()
627+ && !is_chromeless_mode());
628 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
629- toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid());
630- if (is_devtools())
631+ toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid()
632+ && !is_chromeless_mode());
633+ if (is_devtools() || is_chromeless_mode())
634 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
635
636 // Changing the encoding is not possible on Chrome-internal webpages.
637@@ -4588,7 +4627,8 @@
638 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148
639 #if !defined(OS_MACOSX)
640 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS,
641- web_app::IsValidUrl(current_tab->GetURL()));
642+ web_app::IsValidUrl(current_tab->GetURL())
643+ && !is_chromeless_mode());
644 #endif
645
646 UpdateCommandsForContentRestrictionState();
647@@ -4620,9 +4660,14 @@
648 }
649
650 void Browser::UpdateCommandsForBookmarkEditing() {
651+ bool started_in_chromeless =
652+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)
653+ || is_chromeless_mode();
654+
655 bool enabled =
656 profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled) &&
657- browser_defaults::bookmarks_enabled;
658+ browser_defaults::bookmarks_enabled &&
659+ !started_in_chromeless;
660
661 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE,
662 enabled && is_type_tabbed());
663@@ -4748,7 +4793,12 @@
664 if (local_state)
665 enabled = local_state->GetBoolean(prefs::kAllowFileSelectionDialogs);
666
667- command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, enabled);
668+ bool started_in_chromeless =
669+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)
670+ || is_chromeless_mode();
671+
672+ command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE,
673+ enabled && !started_in_chromeless);
674 }
675
676 void Browser::UpdateReloadStopState(bool is_loading, bool force) {
677@@ -4863,7 +4913,8 @@
678 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148
679 #if !defined(OS_MACOSX)
680 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS,
681- web_app::IsValidUrl(contents->GetURL()));
682+ web_app::IsValidUrl(contents->GetURL())
683+ && !is_chromeless_mode());
684 #endif
685 window_->UpdateTitleBar();
686 }
687@@ -5211,20 +5262,20 @@
688
689 unsigned int features = FEATURE_INFOBAR | FEATURE_DOWNLOADSHELF;
690
691- if (is_type_tabbed())
692+ if (is_type_tabbed() && !is_chromeless_mode())
693 features |= FEATURE_BOOKMARKBAR;
694
695 if (!hide_ui_for_fullscreen) {
696- if (!is_type_tabbed())
697+ if (!is_type_tabbed() && !is_chromeless_mode())
698 features |= FEATURE_TITLEBAR;
699
700 if (is_type_tabbed())
701 features |= FEATURE_TABSTRIP;
702
703- if (is_type_tabbed())
704+ if (is_type_tabbed() && !is_chromeless_mode())
705 features |= FEATURE_TOOLBAR;
706
707- if (!is_app())
708+ if (!is_app() && !is_chromeless_mode())
709 features |= FEATURE_LOCATIONBAR;
710 }
711 return !!(features & feature);
712Index: src/chrome/browser/extensions/extension_module.h
713===================================================================
714--- src.orig/chrome/browser/extensions/extension_module.h 2012-07-07 00:59:55.000000000 -0400
715+++ src/chrome/browser/extensions/extension_module.h 2012-07-11 23:49:59.240259276 -0400
716@@ -46,4 +46,10 @@
717 virtual bool RunImpl() OVERRIDE;
718 };
719
720+class IsChromelessWindowFunction : public SyncExtensionFunction {
721+ protected:
722+ virtual bool RunImpl() OVERRIDE;
723+ DECLARE_EXTENSION_FUNCTION_NAME("extension.isChromelessWindow");
724+};
725+
726 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MODULE_H__
727Index: src/chrome/browser/extensions/extension_module.cc
728===================================================================
729--- src.orig/chrome/browser/extensions/extension_module.cc 2012-07-07 00:59:55.000000000 -0400
730+++ src/chrome/browser/extensions/extension_module.cc 2012-07-11 23:49:59.240259276 -0400
731@@ -6,9 +6,27 @@
732
733 #include <string>
734
735+#if defined(OS_LINUX) && defined(TOOLKIT_GTK)
736+#include <gdk/gdk.h>
737+#include <gdk/gdkx.h>
738+#endif
739+
740 #include "chrome/browser/extensions/extension_prefs.h"
741 #include "chrome/browser/extensions/extension_service.h"
742+#include "chrome/browser/ui/browser.h"
743+#include "chrome/browser/ui/browser_window.h"
744 #include "chrome/browser/profiles/profile.h"
745+#include "chrome/common/chrome_switches.h"
746+
747+#if defined(OS_LINUX) && defined(TOOLKIT_GTK)
748+
749+namespace {
750+
751+const char kNoCurrentWindowError[] = "No current window";
752+
753+} // namespace {
754+
755+#endif
756
757 ExtensionPrefs* SetUpdateUrlDataFunction::extension_prefs() {
758 return profile()->GetExtensionService()->extension_prefs();
759@@ -39,3 +57,18 @@
760 ext_service->AllowFileAccess(extension)));
761 return true;
762 }
763+
764+bool IsChromelessWindowFunction::RunImpl() {
765+ Browser* browser = GetCurrentBrowser();
766+ if (!browser || !browser->window() || !browser->window()->GetNativeHandle()) {
767+ error_ = kNoCurrentWindowError;
768+ return false;
769+ }
770+ // TODO: quite brittle, what about tab moves/undock?
771+ // rather rely on proper browser_window type.
772+ // TODO: should be run on a specific thread?
773+ const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
774+ result_.reset(Value::CreateBooleanValue(
775+ browser_command_line.HasSwitch(switches::kChromeless)));
776+ return true;
777+}
778Index: src/chrome/common/extensions/api/extension.json
779===================================================================
780--- src.orig/chrome/common/extensions/api/extension.json 2012-07-07 01:01:17.000000000 -0400
781+++ src/chrome/common/extensions/api/extension.json 2012-07-11 23:49:59.240259276 -0400
782@@ -205,6 +205,24 @@
783 }
784 },
785 {
786+ "name": "isChromelessWindow",
787+ "type": "function",
788+ "description": "Checks is a given extension runs part of a chromeless window.",
789+ "parameters": [
790+ {
791+ "type": "function",
792+ "name": "callback",
793+ "parameters": [
794+ {
795+ "name": "isChromelessWindow",
796+ "type": "boolean",
797+ "description": "True if the extension runs part of a chromeless window, false otherwise."
798+ }
799+ ]
800+ }
801+ ]
802+ },
803+ {
804 "name": "isAllowedIncognitoAccess",
805 "type": "function",
806 "description": "Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.",
807Index: src/chrome/common/chrome_switches.h
808===================================================================
809--- src.orig/chrome/common/chrome_switches.h 2012-07-07 01:01:17.000000000 -0400
810+++ src/chrome/common/chrome_switches.h 2012-07-11 23:49:59.244259276 -0400
811@@ -53,6 +53,7 @@
812 extern const char kCheckForUpdateIntervalSec[];
813 extern const char kCheckCloudPrintConnectorPolicy[];
814 extern const char kChromeFrameShutdownDelay[];
815+extern const char kChromeless[];
816 extern const char kChromeVersion[];
817 extern const char kCipherSuiteBlacklist[];
818 extern const char kClearTokenService[];
819Index: src/chrome/common/chrome_switches.cc
820===================================================================
821--- src.orig/chrome/common/chrome_switches.cc 2012-07-07 01:01:18.000000000 -0400
822+++ src/chrome/common/chrome_switches.cc 2012-07-11 23:49:59.244259276 -0400
823@@ -138,6 +138,9 @@
824 // Chrome Frame automation channel is closed.
825 const char kChromeFrameShutdownDelay[] = "chrome-frame-shutdown-delay";
826
827+// Specifies a given URL to be opened in a chromeless mode.
828+const char kChromeless[] = "chromeless";
829+
830 // Tells chrome to load the specified version of chrome.dll on Windows. If this
831 // version cannot be loaded, Chrome will exit.
832 const char kChromeVersion[] = "chrome-version";
833alex@alex-Gazelle-Professional:~/dev/work/chromium/r20.0.1132.47/src$ svn diff chrome/browser/sessions/session_service.cc
834Index: chrome/browser/sessions/session_service.cc
835===================================================================
836--- src.orig/chrome/browser/sessions/session_service.cc (revision 136242)
837+++ src/chrome/browser/sessions/session_service.cc (working copy)
838@@ -32,6 +32,7 @@
839 #include "chrome/browser/ui/browser_window.h"
840 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
841 #include "chrome/common/chrome_notification_types.h"
842+#include "chrome/common/chrome_switches.h"
843 #include "chrome/common/extensions/extension.h"
844 #include "content/public/browser/navigation_details.h"
845 #include "content/public/browser/navigation_entry.h"
846@@ -579,6 +580,14 @@
847 if (browser->profile() != profile() ||
848 !should_track_changes_for_browser_type(browser->type(), app_type))
849 return;
850+
851+ // Do not track changes for chromeless windows so that
852+ // it won't be considered for restoration during a 'normal' browser
853+ // instance.
854+ if (browser->is_chromeless_mode() ||
855+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)) {
856+ return;
857+ }
858
859 RestoreIfNecessary(std::vector<GURL>(), browser);
860 SetWindowType(browser->session_id(), browser->type(), app_type);
0861
=== added file 'debian/patches/desktop-integration-settings.patch'
--- debian/patches/desktop-integration-settings.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/desktop-integration-settings.patch 2012-08-06 17:52:22 +0000
@@ -0,0 +1,1031 @@
1Index: src/chrome/chrome_browser.gypi
2===================================================================
3--- src.orig/chrome/chrome_browser.gypi 2012-07-31 14:30:37.000000000 -0400
4+++ src/chrome/chrome_browser.gypi 2012-07-31 14:34:57.786804291 -0400
5@@ -3803,6 +3803,8 @@
6 'browser/ui/webui/options2/cookies_view_handler2.h',
7 'browser/ui/webui/options2/core_options_handler2.cc',
8 'browser/ui/webui/options2/core_options_handler2.h',
9+ 'browser/ui/webui/options2/desktop_integration_settings_handler2.cc',
10+ 'browser/ui/webui/options2/desktop_integration_settings_handler2.h',
11 'browser/ui/webui/options2/font_settings_handler2.cc',
12 'browser/ui/webui/options2/font_settings_handler2.h',
13 'browser/ui/webui/options2/font_settings_utils2.h',
14Index: src/chrome/app/generated_resources.grd
15===================================================================
16--- src.orig/chrome/app/generated_resources.grd 2012-07-31 14:30:37.000000000 -0400
17+++ src/chrome/app/generated_resources.grd 2012-07-31 14:34:57.794804290 -0400
18@@ -10402,6 +10402,9 @@
19 <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT">
20 Web content
21 </message>
22+ <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_INTEGRATION">
23+ Desktop Integration
24+ </message>
25 <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY">
26 HTTPS/SSL
27 </message>
28@@ -16033,6 +16036,35 @@
29 </message>
30 </if>
31
32+ <!-- Desktop integration -->
33+ <message name="IDS_PROMPT_INTEGRATION_ENABLE_BUTTON_LABEL" desc="The text to be displayed on the checkbox that enables desktop integration.">
34+ Prompt integration options for any website
35+ </message>
36+ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_EXCEPTIONS_BUTTON_LABEL" desc="The text to be displayed on the button that drives integration exceptions.">
37+ Exceptions...
38+ </message>
39+ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_TITLE" desc="Title for the desktop integration overlay.">
40+ Integration prompt exceptions
41+ </message>
42+ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_DESCRIPTION" desc="Description for the desktop integration overlay.">
43+ These websites won't prompt any integration options
44+ </message>
45+ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_COLUMN_DESCRIPTION" desc="Description of the desktop integration overlay's integrated websites list column.">
46+ Website domains
47+ </message>
48+ <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_BUTTON"
49+ desc="The label for the add button for adding a integration websites">
50+ Add
51+ </message>
52+ <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TEXT"
53+ desc="The description text for the add overlay for adding a integration websites">
54+ Website domain name (e.g. www.html5rocks.com)
55+ </message>
56+ <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TITLE"
57+ desc="Title for add overlay for adding a integration websites">
58+ Add Integrated Website
59+ </message>
60+
61 <!-- Manage Profile Dialog -->
62 <message name="IDS_PROFILES_MANAGE_TITLE" desc="Title of the manage profile dialog">
63 Edit user
64Index: src/chrome/browser/resources/options2/options.html
65===================================================================
66--- src.orig/chrome/browser/resources/options2/options.html 2012-07-31 14:30:37.000000000 -0400
67+++ src/chrome/browser/resources/options2/options.html 2012-07-31 14:35:18.746804981 -0400
68@@ -19,6 +19,7 @@
69 <link rel="stylesheet" href="clear_browser_data_overlay.css">
70 <link rel="stylesheet" href="content_settings.css">
71 <link rel="stylesheet" href="cookies_view.css">
72+<link rel="stylesheet" href="desktop_integration_overlay.css">
73 <link rel="stylesheet" href="font_settings.css">
74 <if expr="pp_ifdef('enable_register_protocol_handler')">
75 <link rel="stylesheet" href="handler_options.css">
76@@ -87,6 +88,7 @@
77 <include src="font_settings.html">
78 <include src="home_page_overlay.html">
79 <include src="import_data_overlay.html">
80+ <include src="desktop_integration_overlay.html">
81 <include src="instant_confirm_overlay.html">
82 <include src="language_options.html">
83 <include src="manage_profile_overlay.html">
84@@ -117,6 +119,7 @@
85 <include src="autofill_edit_creditcard_overlay.html">
86 <include src="content_settings_exceptions_area.html">
87 <include src="cookies_view.html">
88+ <include src="desktop_integration_add_website_overlay.html">
89 <include src="language_add_language_overlay.html">
90 <if expr="pp_ifdef('chromeos')">
91 <include src="chromeos/internet_detail.html">
92Index: src/chrome/browser/resources/options2/options.js
93===================================================================
94--- src.orig/chrome/browser/resources/options2/options.js 2012-07-31 14:30:37.000000000 -0400
95+++ src/chrome/browser/resources/options2/options.js 2012-07-31 14:34:57.794804290 -0400
96@@ -13,6 +13,8 @@
97 var ContentSettingsExceptionsArea =
98 options.contentSettings.ContentSettingsExceptionsArea;
99 var CookiesView = options.CookiesView;
100+var DesktopIntegrationOverlay = options.DesktopIntegrationOverlay;
101+var AddDesktopIntegrationWebsiteOverlay = options.AddDesktopIntegrationWebsiteOverlay;
102 var FontSettings = options.FontSettings;
103 var HandlerOptions = options.HandlerOptions;
104 var HomePageOverlay = options.HomePageOverlay;
105@@ -84,6 +86,13 @@
106 OptionsPage.registerOverlay(FontSettings.getInstance(),
107 BrowserOptions.getInstance(),
108 [$('fontSettingsCustomizeFontsButton')]);
109+ if (cr.isLinux && !cr.isChromeos) {
110+ OptionsPage.registerOverlay(AddDesktopIntegrationWebsiteOverlay.getInstance(),
111+ DesktopIntegrationOverlay.getInstance());
112+ OptionsPage.registerOverlay(DesktopIntegrationOverlay.getInstance(),
113+ BrowserOptions.getInstance(),
114+ [$('desktop-integration-button')]);
115+ }
116 if (HandlerOptions && $('manage-handlers-button')) {
117 OptionsPage.registerOverlay(HandlerOptions.getInstance(),
118 ContentSettings.getInstance(),
119Index: src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.html
120===================================================================
121--- /dev/null 1970-01-01 00:00:00.000000000 +0000
122+++ src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.html 2012-07-31 14:34:57.794804290 -0400
123@@ -0,0 +1,16 @@
124+<div id="add-desktop-integration-website-overlay-page" class="page" hidden>
125+ <div class="close-button"></div>
126+ <h1 i18n-content="add_desktop_website_title"></h1>
127+
128+ <div class="content-area">
129+ <span i18n-content="add_desktop_website_input_label"></span>
130+ <input id="website-url-field" type="url" data-type="url"
131+ class="weakrtl favicon-cell hbox stretch">
132+ </div>
133+
134+ <div class="action-area button-strip">
135+ <button id="add-integration-website-overlay-cancel-button" i18n-content="cancel">
136+ </button>
137+ <button id="add-integration-website-overlay-ok-button" i18n-content="ok"></button>
138+ </div>
139+</div>
140Index: src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.js
141===================================================================
142--- /dev/null 1970-01-01 00:00:00.000000000 +0000
143+++ src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.js 2012-07-31 14:34:57.794804290 -0400
144@@ -0,0 +1,44 @@
145+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
146+// Use of this source code is governed by a BSD-style license that can be
147+// found in the LICENSE file.
148+
149+///////////////////////////////////////////////////////////////////////////////
150+// AddDesktopIntegrationWebsiteOverlay class:
151+
152+cr.define('options', function() {
153+ /** @const */ var OptionsPage = options.OptionsPage;
154+
155+ /**
156+ * @constructor
157+ */
158+ function AddDesktopIntegrationWebsiteOverlay() {
159+ OptionsPage.call(this, 'addDesktopIntegrationWebsite',
160+ localStrings.getString('add_button'),
161+ 'add-desktop-integration-website-overlay-page');
162+ }
163+
164+ cr.addSingletonGetter(AddDesktopIntegrationWebsiteOverlay);
165+
166+ AddDesktopIntegrationWebsiteOverlay.prototype = {
167+ // Inherit AddDesktopIntegrationWebsiteOverlay from OptionsPage.
168+ __proto__: OptionsPage.prototype,
169+
170+ /**
171+ * Initializes AddDesktopIntegrationWebsiteOverlay page.
172+ * Calls base class implementation to starts preference initialization.
173+ */
174+ initializePage: function() {
175+ // Call base class implementation to starts preference initialization.
176+ OptionsPage.prototype.initializePage.call(this);
177+
178+ // Set up the cancel button.
179+ $('add-integration-website-overlay-cancel-button').onclick = function(e) {
180+ OptionsPage.closeOverlay();
181+ };
182+ },
183+ };
184+
185+ return {
186+ AddDesktopIntegrationWebsiteOverlay: AddDesktopIntegrationWebsiteOverlay
187+ };
188+});
189Index: src/chrome/browser/resources/options2/options_bundle.js
190===================================================================
191--- src.orig/chrome/browser/resources/options2/options_bundle.js 2012-07-31 14:30:37.000000000 -0400
192+++ src/chrome/browser/resources/options2/options_bundle.js 2012-07-31 14:34:57.794804290 -0400
193@@ -72,6 +72,8 @@
194 <include src="content_settings_ui.js"></include>
195 <include src="cookies_list.js"></include>
196 <include src="cookies_view.js"></include>
197+<include src="desktop_integration_add_website_overlay.js"></include>
198+<include src="desktop_integration_overlay.js"></include>
199 <include src="font_settings.js"></include>
200 <if expr="pp_ifdef('enable_register_protocol_handler')">
201 <include src="handler_options.js"></include>
202Index: src/chrome/browser/resources/options2/browser_options.html
203===================================================================
204--- src.orig/chrome/browser/resources/options2/browser_options.html 2012-07-31 14:30:37.000000000 -0400
205+++ src/chrome/browser/resources/options2/browser_options.html 2012-07-31 14:34:57.794804290 -0400
206@@ -37,7 +37,7 @@
207 <if expr="not pp_ifdef('toolkit_views') and is_posix and not is_macosx">
208 <button id="themes-gallery" i18n-content="themesGallery"></button>
209 <button id="themes-GTK-button"
210- i18n-content="themesGTKButton"></button>
211+ i18n-content="themesGTKButton"></button>
212 <button id="themes-reset"
213 i18n-content="themesSetClassic"></button>
214 </if>
215@@ -356,6 +356,22 @@
216 </if>
217 </div>
218 </section>
219+
220+<if expr="is_linux and not pp_ifdef('chromeos')">
221+ <section id="desktop-integration-section">
222+ <h3 i18n-content="advancedSectionTitleIntegration"></h3>
223+ <div class="checkbox">
224+ <label>
225+ <input id="promptIntegrationForAnyWebsite" pref="desktop_integration_prompt.enabled"
226+ metric="Options_PromptIntegration" type="checkbox">
227+ <span i18n-content="promptIntegrationEnableIntegration"></span>
228+ </label>
229+ </div>
230+ <button id="desktop-integration-button"
231+ i18n-content="desktopIntegrationExceptionsSettingsButton"></button>
232+ </section>
233+</if>
234+
235 <if expr="not pp_ifdef('chromeos')">
236 <section>
237 <h3 i18n-content="advancedSectionTitleNetwork"></h3>
238Index: src/chrome/browser/resources/options2/desktop_integration_overlay.html
239===================================================================
240--- /dev/null 1970-01-01 00:00:00.000000000 +0000
241+++ src/chrome/browser/resources/options2/desktop_integration_overlay.html 2012-07-31 14:34:57.798804289 -0400
242@@ -0,0 +1,31 @@
243+<div id="desktop-integration-area" class="page" hidden>
244+
245+ <div class="close-button"></div>
246+ <h1 i18n-content="desktopIntegrationPage"></h1>
247+
248+ <span i18n-content="desktopIntegrationInfoText"></span>
249+
250+ <div id="desktop-integration-column-headers">
251+ <div id="desktop-integration-description-column" i18n-content="desktopIntegrationColumnDescription">
252+ </div>
253+ </div>
254+
255+ <div class="content-area">
256+ <list id="domains-list"></list>
257+
258+ <div class="desktop-integration-lower-left">
259+ <button id="desktop-integration-add-button"
260+ i18n-content="add_button"></button>
261+ </div>
262+ </div>
263+
264+ <div class="action-area">
265+ <div class="button-strip">
266+ <button id="desktop-integrations-overlay-confirm"
267+ i18n-content="ok">
268+ </button>
269+ </div>
270+ </div>
271+
272+</div>
273+
274Index: src/chrome/browser/resources/options2/desktop_integration_overlay.js
275===================================================================
276--- /dev/null 1970-01-01 00:00:00.000000000 +0000
277+++ src/chrome/browser/resources/options2/desktop_integration_overlay.js 2012-07-31 14:34:57.798804289 -0400
278@@ -0,0 +1,201 @@
279+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
280+// Use of this source code is governed by a BSD-style license that can be
281+// found in the LICENSE file.
282+
283+cr.define('options', function() {
284+ /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
285+ /** @const */ var DeletableItemList = options.DeletableItemList;
286+ /** @const */ var DeletableItem = options.DeletableItem;
287+
288+ /**
289+ * Creates a new exceptions list item.
290+ * @constructor
291+ * @extends {options.DeletableItem}
292+ */
293+ function IntegratedWebsitesListItem(domain) {
294+ var el = cr.doc.createElement('div');
295+ el.__proto__ = IntegratedWebsitesListItem.prototype;
296+ el.domain = domain;
297+ el.decorate();
298+ return el;
299+ }
300+
301+ IntegratedWebsitesListItem.prototype = {
302+ __proto__: DeletableItem.prototype,
303+
304+ /**
305+ * Called when an element is decorated as a list item.
306+ */
307+ decorate: function() {
308+ DeletableItem.prototype.decorate.call(this);
309+
310+ // The stored label.
311+ var label = this.ownerDocument.createElement('div');
312+ label.className = 'domain-name';
313+ label.textContent = this.domain;
314+ this.contentElement.appendChild(label);
315+
316+ this.deletable = true;
317+ },
318+ };
319+
320+ /**
321+ * Creates a integrated websites list.
322+ * @constructor
323+ * @extends {cr.ui.List}
324+ */
325+ var IntegratedWebsitesList = cr.ui.define('list');
326+
327+ IntegratedWebsitesList.prototype = {
328+ __proto__: DeletableItemList.prototype,
329+
330+ /**
331+ * Called when an element is decorated as a list.
332+ */
333+ decorate: function() {
334+ DeletableItemList.prototype.decorate.call(this);
335+ this.reset();
336+ },
337+
338+ /** @inheritDoc */
339+ createItem: function(domain) {
340+ return new IntegratedWebsitesListItem(domain);
341+ },
342+
343+ /*
344+ * Adds a website domain name to the list of allowed integrated websites.
345+ * @param {string} domain domain name of the website to add.
346+ */
347+ addWebsite: function(domain) {
348+ if (!domain || this.dataModel.indexOf(domain) >= 0) {
349+ return;
350+ }
351+ this.dataModel.push(url);
352+ this.redraw();
353+ chrome.send('addIntegrationSite', [domain]);
354+ },
355+
356+ /**
357+ * Forces a revailidation of the list content. Content added while the list
358+ * is hidden is not properly rendered when the list becomes visible. In
359+ * addition, deleting a single item from the list results in a stale cache
360+ * requiring an invalidation.
361+ */
362+ refresh: function() {
363+ // TODO(kevers): Investigate if the root source of the problems can be
364+ // fixed in cr.ui.list.
365+ this.invalidate();
366+ this.redraw();
367+ },
368+
369+ /**
370+ * Sets the integrated websites in the js model.
371+ * @param {Object} entries A list of dictionaries of values, each dictionary
372+ * represents an exception.
373+ */
374+ setIntegratedWebsites: function(entries) {
375+ var integratedWebsites = null;
376+ try {
377+ integratedWebsites = JSON.parse(entries);
378+ } catch(e) {
379+ console.log("Error while parsing integrated websites json: " + entries);
380+ return;
381+ }
382+ // TODO hightlight domains differently based on permission
383+ var domains = [];
384+ domains = domains.concat(integratedWebsites['allowed']);
385+ domains = domains.concat(integratedWebsites['dontask']);
386+ this.dataModel = new ArrayDataModel(domains);
387+ this.refresh();
388+ },
389+
390+ /**
391+ * Removes all integration scripts from the js model.
392+ */
393+ reset: function() {
394+ this.dataModel = new ArrayDataModel([]);
395+ },
396+
397+ /** @inheritDoc */
398+ deleteItemAtIndex: function(index) {
399+ if (index >= 0) {
400+ var args = [this.dataModel.item(index)];
401+ chrome.send('removeIntegrationSite', args);
402+ this.dataModel.splice(index, 1);
403+ }
404+ },
405+
406+ /**
407+ * The length of the list.
408+ */
409+ get length() {
410+ return null != this.dataModel ? this.dataModel.length : 0;
411+ },
412+ };
413+
414+ var OptionsPage = options.OptionsPage;
415+
416+ /**
417+ * DesktopIntegrationOverlay class
418+ * Encapsulated handling of the 'Desktop integration' page.
419+ * @class
420+ */
421+ function DesktopIntegrationOverlay() {
422+ OptionsPage.call(this, 'desktopIntegrationOverlay',
423+ templateData.desktopIntegrationPage,
424+ 'desktop-integration-area');
425+ }
426+
427+ cr.addSingletonGetter(DesktopIntegrationOverlay);
428+
429+ DesktopIntegrationOverlay.prototype = {
430+ __proto__: OptionsPage.prototype,
431+
432+ /**
433+ * Initialize the page.
434+ */
435+ initializePage: function() {
436+ OptionsPage.prototype.initializePage.call(this);
437+
438+ var integrationList = $('domains-list');
439+ IntegratedWebsitesList.decorate(integrationList);
440+ $('desktop-integrations-overlay-confirm').onclick =
441+ OptionsPage.closeOverlay.bind(OptionsPage);
442+
443+ // Set up add button.
444+ $('desktop-integration-add-button').onclick = function(e) {
445+ OptionsPage.navigateToPage('addDesktopIntegrationWebsite');
446+ };
447+
448+ // Listen to add website dialog ok button.
449+ var addWebsiteOkButton = $('add-integration-website-overlay-ok-button');
450+ addWebsiteOkButton.addEventListener('click',
451+ this.handleAddWebsiteOkButtonClick_.bind(this));
452+ },
453+
454+ handleAddWebsiteOkButtonClick_: function () {
455+ var website = $('website-url-field').value;
456+ $('domains-list').addWebsite(String(website));
457+ OptionsPage.closeOverlay();
458+ },
459+
460+ /**
461+ * Called by the options page when this page has been shown.
462+ */
463+ didShowPage: function() {
464+ chrome.send('updateIntegratedWebsitesList');
465+ },
466+ };
467+
468+ DesktopIntegrationOverlay.setIntegratedWebsites = function(entries) {
469+ $('domains-list').setIntegratedWebsites(entries);
470+ };
471+
472+ // Export
473+ return {
474+ IntegratedWebsitesListItem: IntegratedWebsitesListItem,
475+ IntegratedWebsitesList: IntegratedWebsitesList,
476+ DesktopIntegrationOverlay: DesktopIntegrationOverlay
477+ };
478+});
479+
480Index: src/chrome/browser/resources/options2/desktop_integration_overlay.css
481===================================================================
482--- /dev/null 1970-01-01 00:00:00.000000000 +0000
483+++ src/chrome/browser/resources/options2/desktop_integration_overlay.css 2012-07-31 14:34:57.798804289 -0400
484@@ -0,0 +1,71 @@
485+/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
486+ * Use of this source code is governed by a BSD-style license that can be
487+ * found in the LICENSE file. */
488+
489+#desktop-integration-options {
490+ min-width: 550px;
491+}
492+
493+#desktop-integration-options list {
494+ min-height: 172px;
495+}
496+
497+.desktop-integration-list-item {
498+ -webkit-box-flex: 1;
499+ -webkit-padding-start: 8px;
500+ overflow: hidden;
501+ text-overflow: ellipsis;
502+}
503+
504+.desktop-integration-lower-left button {
505+ min-width: 70px;
506+}
507+
508+.desktop-integration-lower-left {
509+ -webkit-box-flex: 0;
510+ -webkit-padding-start: 12px;
511+ padding-bottom: 10px;
512+}
513+
514+#desktop-integration-column-headers {
515+ -webkit-margin-start: 17px;
516+ display: -webkit-box;
517+ margin-top: 17px;
518+}
519+
520+#desktop-integration-column-headers > div {
521+ font-weight: bold;
522+}
523+
524+#desktop-integration-pattern-column {
525+ -webkit-box-flex: 1;
526+}
527+
528+#desktop-integration-behavior-column {
529+ width: 145px;
530+}
531+
532+#desktop-integration-area list {
533+ margin-bottom: 10px;
534+ margin-top: 4px;
535+}
536+
537+#domains-list {
538+ -webkit-box-flex: 1;
539+ outline: none;
540+ padding: 1px 0 0;
541+ width: 100%;
542+}
543+
544+#domains-list .domain-name {
545+ -webkit-box-flex: 1;
546+ overflow: hidden;
547+ text-overflow: ellipsis;
548+ white-space: nowrap;
549+}
550+
551+#domains-list li {
552+ -webkit-padding-start: 12px;
553+ padding-bottom: 2px;
554+ padding-top: 2px;
555+}
556Index: src/chrome/browser/resources/options2/browser_options.js
557===================================================================
558--- src.orig/chrome/browser/resources/options2/browser_options.js 2012-07-31 14:30:37.000000000 -0400
559+++ src/chrome/browser/resources/options2/browser_options.js 2012-07-31 14:34:57.798804289 -0400
560@@ -397,6 +397,23 @@
561 [String(event.target.options[event.target.selectedIndex].value)]);
562 };
563
564+ // Desktop integration section
565+ if (cr.isLinux && !cr.isChromeOS) {
566+ var updateButtonState = function () {
567+ $('desktop-integration-button').disabled =
568+ ! $('promptIntegrationForAnyWebsite').checked;
569+ };
570+ $('promptIntegrationForAnyWebsite').onchange = function () {
571+ updateButtonState();
572+ chrome.send('setDesktopIntegrationAllowed',
573+ [$('promptIntegrationForAnyWebsite').checked]);
574+ };
575+ updateButtonState();
576+ $('desktop-integration-button').onclick = function(event) {
577+ OptionsPage.navigateToPage('desktopIntegrationOverlay');
578+ };
579+ }
580+
581 // Languages section.
582 $('language-button').onclick = function(event) {
583 OptionsPage.navigateToPage('languages');
584@@ -1024,6 +1041,24 @@
585 },
586
587 /**
588+ * Disable the desktop integration settings if needed.
589+ * @private
590+ */
591+ disableDesktopIntegration_: function() {
592+ $('desktop-integration-section').style.display = 'none';
593+ },
594+
595+ /**
596+ * Disable the desktop integration settings if needed.
597+ * @private
598+ */
599+ setDesktopIntegrationIsAllowed_: function(enabled) {
600+ $('promptIntegrationForAnyWebsite').checked = enabled;
601+ $('desktop-integration-button').disabled =
602+ ! $('promptIntegrationForAnyWebsite').checked;
603+ },
604+
605+ /**
606 * Set the checked state of the metrics reporting checkbox.
607 * @private
608 */
609@@ -1357,6 +1392,7 @@
610 //Forward public APIs to private implementations.
611 [
612 'addBluetoothDevice',
613+ 'disableDesktopIntegration',
614 'getStartStopSyncButton',
615 'hideBluetoothSettings',
616 'removeCloudPrintConnectorSection',
617@@ -1370,6 +1406,7 @@
618 'setGtkThemeButtonEnabled',
619 'setHighContrastCheckboxState',
620 'setInstantFieldTrialStatus',
621+ 'setDesktopIntegrationIsAllowed',
622 'setMetricsReportingCheckboxState',
623 'setMetricsReportingSettingVisibility',
624 'setProfilesInfo',
625Index: src/chrome/browser/ui/webui/options2/options_ui2.cc
626===================================================================
627--- src.orig/chrome/browser/ui/webui/options2/options_ui2.cc 2012-07-31 14:30:37.000000000 -0400
628+++ src/chrome/browser/ui/webui/options2/options_ui2.cc 2012-07-31 14:34:57.798804289 -0400
629@@ -90,6 +90,10 @@
630 #include "chrome/browser/ui/webui/options2/certificate_manager_handler2.h"
631 #endif
632
633+#if defined(OS_LINUX)
634+#include "chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h"
635+#endif
636+
637 using content::RenderViewHost;
638
639 namespace {
640@@ -233,6 +237,10 @@
641 AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler());
642 AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler());
643 AddOptionsPageUIHandler(localized_strings, new CookiesViewHandler());
644+#if defined(OS_LINUX)
645+ AddOptionsPageUIHandler(localized_strings,
646+ new DesktopIntegrationSettingsHandler());
647+#endif
648 AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler());
649 AddOptionsPageUIHandler(localized_strings, new HomePageOverlayHandler());
650 AddOptionsPageUIHandler(localized_strings, new WebIntentsSettingsHandler());
651Index: src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h
652===================================================================
653--- /dev/null 1970-01-01 00:00:00.000000000 +0000
654+++ src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h 2012-07-31 14:34:57.798804289 -0400
655@@ -0,0 +1,76 @@
656+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
657+// Use of this source code is governed by a BSD-style license that can be
658+// found in the LICENSE file.
659+
660+#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
661+#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
662+
663+#include <string>
664+
665+#include "base/compiler_specific.h"
666+#include "chrome/browser/ui/webui/options2/options_ui2.h"
667+
668+namespace base {
669+class DictionaryValue;
670+class ListValue;
671+}
672+
673+namespace options2 {
674+
675+class DesktopIntegrationSettingsHandler : public OptionsPageUIHandler {
676+ public:
677+ DesktopIntegrationSettingsHandler();
678+ virtual ~DesktopIntegrationSettingsHandler();
679+
680+ // OptionsPageUIHandler implementation.
681+ virtual void GetLocalizedValues(
682+ base::DictionaryValue* localized_strings) OVERRIDE;
683+ virtual void InitializeHandler() OVERRIDE;
684+ virtual void InitializePage() OVERRIDE;
685+ virtual void RegisterMessages() OVERRIDE;
686+
687+ private:
688+
689+ // Loads the data associated with the currently integrated websites.
690+ void LoadIntegratedWebsitesData();
691+
692+ // Initializes the list of website domain names that are currently
693+ // either allowed or 'dontask' and send it to the overlay.
694+ void LoadUnityWebappsEntryPoint();
695+
696+ // Removes an website from the list of integrated websites that won't prompt
697+ // from integration.
698+ // |args| - A string, the domain name of the website to remove.
699+ void RemoveIntegrationSite(const ListValue* args);
700+
701+ // Adds an website from the list of integrated websites that won't prompt
702+ // from integration. The website is being added to the list of 'allowed' sites.
703+ // |args| - A string, the domain name of the website to add.
704+ void AddIntegrationSite(const ListValue* args);
705+
706+ // Updates the integration allowed flag.
707+ // |args| - A boolean flag indicating if integration should be allowed
708+ void SetDesktopIntegrationAllowed(const ListValue* args);
709+
710+ // Updates the list of integrated websites.
711+ void UpdateIntegratedWebsitesList(const ListValue* args);
712+
713+ // Predicate informing if we have been able to initialize the connection
714+ // with the unity-webapps library (entry point for website integration
715+ // permissions).
716+ bool IsUnityWebappsInitialized() const;
717+
718+ //
719+ void * lib_unity_webapps_handle_;
720+ void * get_all_func_handle_;
721+ void * remove_from_permissions_func_handle_;
722+ void * add_allowed_domain_func_handle_;
723+ void * is_integration_allowed_func_handle_;
724+ void * set_integration_allowed_func_handle_;
725+
726+ DISALLOW_COPY_AND_ASSIGN(DesktopIntegrationSettingsHandler);
727+};
728+
729+} // namespace options2
730+
731+#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
732Index: src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.cc
733===================================================================
734--- /dev/null 1970-01-01 00:00:00.000000000 +0000
735+++ src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.cc 2012-07-31 14:37:18.294808913 -0400
736@@ -0,0 +1,264 @@
737+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
738+// Use of this source code is governed by a BSD-style license that can be
739+// found in the LICENSE file.
740+
741+#include "chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h"
742+
743+#include <glib.h>
744+#include <dlfcn.h>
745+#include <vector>
746+
747+#include "base/bind.h"
748+#include "base/bind_helpers.h"
749+#include "base/logging.h"
750+#include "base/string16.h"
751+#include "base/string_number_conversions.h"
752+#include "base/utf_string_conversions.h"
753+#include "base/values.h"
754+#include "chrome/browser/ui/webui/web_ui_util.h"
755+#include "chrome/common/guid.h"
756+#include "chrome/common/url_constants.h"
757+#include "content/public/browser/web_ui.h"
758+#include "grit/generated_resources.h"
759+#include "grit/webkit_resources.h"
760+#include "ui/base/l10n/l10n_util.h"
761+
762+// Not a constant but preprocessor definition for easy concatenation.
763+#define kLibunityWebappsEntryPointLibName "libunity_webapps.so.0"
764+
765+namespace options2 {
766+
767+// TODO: -> extract to function
768+DesktopIntegrationSettingsHandler::DesktopIntegrationSettingsHandler()
769+ : lib_unity_webapps_handle_(NULL),
770+ get_all_func_handle_(NULL),
771+ remove_from_permissions_func_handle_(NULL),
772+ add_allowed_domain_func_handle_(NULL),
773+ is_integration_allowed_func_handle_(NULL),
774+ set_integration_allowed_func_handle_(NULL) {
775+}
776+
777+DesktopIntegrationSettingsHandler::~DesktopIntegrationSettingsHandler() {
778+ if (lib_unity_webapps_handle_) {
779+ dlclose (lib_unity_webapps_handle_);
780+ lib_unity_webapps_handle_ = NULL;
781+
782+ remove_from_permissions_func_handle_ = NULL;
783+ get_all_func_handle_ = NULL;
784+ add_allowed_domain_func_handle_ = NULL;
785+ is_integration_allowed_func_handle_ = NULL;
786+ set_integration_allowed_func_handle_ = NULL;
787+ }
788+}
789+
790+/////////////////////////////////////////////////////////////////////////////
791+// OptionsPageUIHandler implementation:
792+void DesktopIntegrationSettingsHandler::GetLocalizedValues(
793+ DictionaryValue* localized_strings) {
794+ DCHECK(localized_strings);
795+
796+ static OptionsStringResource resources[] = {
797+ { "desktopIntegrationInfoText",
798+ IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_DESCRIPTION },
799+ { "desktopIntegrationColumnDescription",
800+ IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_COLUMN_DESCRIPTION },
801+ };
802+
803+ localized_strings->SetString("add_button",
804+ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_BUTTON));
805+ localized_strings->SetString("add_desktop_website_input_label",
806+ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TEXT));
807+ localized_strings->SetString("add_desktop_website_title",
808+ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TITLE));
809+
810+ RegisterStrings(localized_strings, resources, arraysize(resources));
811+ RegisterTitle(localized_strings, "desktopIntegrationPage",
812+ IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_TITLE);
813+}
814+
815+void DesktopIntegrationSettingsHandler::InitializeHandler() {
816+ if (!IsUnityWebappsInitialized()) {
817+ LoadUnityWebappsEntryPoint();
818+ }
819+}
820+
821+void DesktopIntegrationSettingsHandler::InitializePage() {
822+ DCHECK(IsUnityWebappsInitialized());
823+ LoadIntegratedWebsitesData();
824+}
825+
826+void DesktopIntegrationSettingsHandler::RegisterMessages() {
827+ web_ui()->RegisterMessageCallback(
828+ "addIntegrationSite",
829+ base::Bind(&DesktopIntegrationSettingsHandler::AddIntegrationSite,
830+ base::Unretained(this)));
831+ web_ui()->RegisterMessageCallback(
832+ "setDesktopIntegrationAllowed",
833+ base::Bind(&DesktopIntegrationSettingsHandler::SetDesktopIntegrationAllowed,
834+ base::Unretained(this)));
835+ web_ui()->RegisterMessageCallback(
836+ "removeIntegrationSite",
837+ base::Bind(&DesktopIntegrationSettingsHandler::RemoveIntegrationSite,
838+ base::Unretained(this)));
839+ web_ui()->RegisterMessageCallback(
840+ "updateIntegratedWebsitesList",
841+ base::Bind(&DesktopIntegrationSettingsHandler::UpdateIntegratedWebsitesList,
842+ base::Unretained(this)));
843+}
844+
845+void DesktopIntegrationSettingsHandler::LoadUnityWebappsEntryPoint() {
846+ DCHECK(!IsUnityWebappsInitialized());
847+
848+ // TODO run on FILE thread
849+ static const char* const search_paths[] = {
850+ kLibunityWebappsEntryPointLibName,
851+ "/usr/local/lib/" kLibunityWebappsEntryPointLibName
852+ , "/usr/lib/" kLibunityWebappsEntryPointLibName
853+ };
854+
855+ void * handle = NULL;
856+ for (size_t i = 0; i < sizeof(search_paths)/sizeof(search_paths[0]); ++i) {
857+ DCHECK(handle == NULL);
858+ // TODO validate path?
859+ handle = dlopen (search_paths[i], RTLD_LAZY|RTLD_GLOBAL);
860+ if (handle) {
861+ LOG(INFO) << "Found libunitywebapps entry point:" << search_paths[i];
862+ break;
863+ }
864+ }
865+ if (!handle) {
866+ LOG(INFO) << "Could not load Unity Webapps entry point library";
867+ return;
868+ }
869+
870+ void * get_all_handle =
871+ dlsym (handle, "unity_webapps_permissions_get_all_domains");
872+ void * remove_from_permissions_handle =
873+ dlsym (handle, "unity_webapps_permissions_remove_domain_from_permissions");
874+ void * add_allowed_domain_handle =
875+ dlsym (handle, "unity_webapps_permissions_allow_domain");
876+ void * is_integration_allowed_handle =
877+ dlsym (handle, "unity_webapps_permissions_is_integration_allowed");
878+ void * set_integration_allowed_handle =
879+ dlsym (handle, "unity_webapps_permissions_set_integration_allowed");
880+
881+ if (!get_all_handle ||
882+ !remove_from_permissions_handle ||
883+ !add_allowed_domain_handle ||
884+ !is_integration_allowed_handle ||
885+ !set_integration_allowed_handle) {
886+ LOG(WARNING) << "Could not load Unity Webapps entry point functions";
887+ dlclose(handle);
888+ return;
889+ }
890+
891+ lib_unity_webapps_handle_ = handle;
892+ get_all_func_handle_ = get_all_handle;
893+ remove_from_permissions_func_handle_ = remove_from_permissions_handle;
894+ add_allowed_domain_func_handle_ = add_allowed_domain_handle;
895+ is_integration_allowed_func_handle_ = is_integration_allowed_handle;
896+ set_integration_allowed_func_handle_ = set_integration_allowed_handle;
897+}
898+
899+bool DesktopIntegrationSettingsHandler::IsUnityWebappsInitialized() const {
900+ return NULL != lib_unity_webapps_handle_
901+ && NULL != get_all_func_handle_
902+ && NULL != remove_from_permissions_func_handle_
903+ && NULL != add_allowed_domain_func_handle_
904+ && NULL != is_integration_allowed_func_handle_
905+ && NULL != set_integration_allowed_func_handle_;
906+}
907+
908+void DesktopIntegrationSettingsHandler::LoadIntegratedWebsitesData() {
909+ if (!IsUnityWebappsInitialized()) {
910+ web_ui()->CallJavascriptFunction(
911+ "BrowserOptions.disableDesktopIntegration");
912+ LOG(INFO) << "Disabling Desktop Integration options";
913+ return;
914+ }
915+
916+ typedef gboolean (* IsIntegrationAllowedFunc) (void);
917+ gboolean isallowed =
918+ ((IsIntegrationAllowedFunc) is_integration_allowed_func_handle_) ();
919+ web_ui()->CallJavascriptFunction(
920+ "BrowserOptions.setDesktopIntegrationIsAllowed",
921+ base::FundamentalValue(isallowed));
922+}
923+
924+void DesktopIntegrationSettingsHandler::UpdateIntegratedWebsitesList(
925+ const ListValue* args) {
926+ DCHECK(IsUnityWebappsInitialized());
927+
928+ // TODO move elsewhere
929+ typedef gchar* (* GetAllDomainsFunc) (void);
930+
931+ gchar* all_domains = ((GetAllDomainsFunc) get_all_func_handle_) ();
932+ if (all_domains) {
933+ web_ui()->CallJavascriptFunction(
934+ "DesktopIntegrationOverlay.setIntegratedWebsites",
935+ StringValue(all_domains));
936+ }
937+}
938+
939+void DesktopIntegrationSettingsHandler::SetDesktopIntegrationAllowed(
940+ const ListValue* args) {
941+ DCHECK(IsUnityWebappsInitialized());
942+
943+ // TODO move elsewhere
944+ typedef void (* SetDesktopIntegrationAllowedFunc) (gboolean);
945+
946+ bool is_allowed;
947+ if (!args->GetBoolean(0, &is_allowed)) {
948+ NOTREACHED();
949+ return;
950+ }
951+
952+ LOG(INFO) << "Setting desktop integration:" << is_allowed;
953+
954+ ((SetDesktopIntegrationAllowedFunc) set_integration_allowed_func_handle_) (
955+ is_allowed ? TRUE : FALSE);
956+}
957+
958+void DesktopIntegrationSettingsHandler::AddIntegrationSite(
959+ const ListValue* args) {
960+ DCHECK(IsUnityWebappsInitialized());
961+
962+ // TODO move elsewhere
963+ typedef void (* AddDomainFromPermissionsFunc) (gchar *);
964+
965+ std::string domain;
966+ if (!args->GetString(0, &domain)) {
967+ NOTREACHED();
968+ return;
969+ }
970+
971+ LOG(INFO) << "Adding domain:" << domain << " to the list of websites allowed";
972+
973+ ((AddDomainFromPermissionsFunc) add_allowed_domain_func_handle_) (
974+ const_cast<gchar *>(domain.c_str()));
975+
976+ LoadIntegratedWebsitesData ();
977+}
978+
979+void DesktopIntegrationSettingsHandler::RemoveIntegrationSite(
980+ const ListValue* args) {
981+ DCHECK(IsUnityWebappsInitialized());
982+
983+ // TODO move elsewhere
984+ typedef void (* RemoveDomainFromPermissionsFunc) (gchar *);
985+
986+ std::string domain;
987+ if (!args->GetString(0, &domain)) {
988+ NOTREACHED();
989+ return;
990+ }
991+
992+ LOG(INFO) << "Removing domain:" << domain << " from the list of websites not prompting integration";
993+
994+ ((RemoveDomainFromPermissionsFunc) remove_from_permissions_func_handle_) (
995+ const_cast<gchar *>(domain.c_str()));
996+
997+ LoadIntegratedWebsitesData ();
998+}
999+
1000+} // namespace options2
1001Index: src/chrome/browser/ui/webui/options2/browser_options_handler2.cc
1002===================================================================
1003--- src.orig/chrome/browser/ui/webui/options2/browser_options_handler2.cc 2012-07-31 14:30:37.000000000 -0400
1004+++ src/chrome/browser/ui/webui/options2/browser_options_handler2.cc 2012-07-31 14:34:57.798804289 -0400
1005@@ -152,6 +152,8 @@
1006 { "advancedSectionTitleCloudPrint", IDS_GOOGLE_CLOUD_PRINT },
1007 { "advancedSectionTitleContent",
1008 IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT },
1009+ { "advancedSectionTitleIntegration",
1010+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_INTEGRATION },
1011 { "advancedSectionTitleLanguages",
1012 IDS_OPTIONS_ADVANCED_SECTION_TITLE_LANGUAGES },
1013 { "advancedSectionTitleNetwork",
1014@@ -171,6 +173,8 @@
1015 { "defaultFontSizeLabel", IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL },
1016 { "defaultSearchManageEngines", IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES },
1017 { "defaultZoomFactorLabel", IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL },
1018+ { "desktopIntegrationExceptionsSettingsButton",
1019+ IDS_DESKTOP_INTEGRATION_SETTINGS_EXCEPTIONS_BUTTON_LABEL },
1020 #if defined(OS_CHROMEOS)
1021 { "disableGData", IDS_OPTIONS_DISABLE_GDATA },
1022 #endif
1023@@ -222,6 +226,8 @@
1024 { "profilesDeleteSingle", IDS_PROFILES_DELETE_SINGLE_BUTTON_LABEL },
1025 { "profilesListItemCurrent", IDS_PROFILES_LIST_ITEM_CURRENT },
1026 { "profilesManage", IDS_PROFILES_MANAGE_BUTTON_LABEL },
1027+ { "promptIntegrationEnableIntegration",
1028+ IDS_PROMPT_INTEGRATION_ENABLE_BUTTON_LABEL },
1029 { "proxiesLabel", IDS_OPTIONS_PROXIES_LABEL },
1030 { "safeBrowsingEnableProtection",
1031 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION },
01032
=== modified file 'debian/patches/dlopen_sonamed_gl.patch'
--- debian/patches/dlopen_sonamed_gl.patch 2011-10-26 06:14:33 +0000
+++ debian/patches/dlopen_sonamed_gl.patch 2012-08-06 17:52:22 +0000
@@ -9,9 +9,9 @@
99
10Index: src/ui/gfx/gl/gl_implementation_linux.cc10Index: src/ui/gfx/gl/gl_implementation_linux.cc
11===================================================================11===================================================================
12--- src.orig/ui/gfx/gl/gl_implementation_linux.cc 2011-10-21 17:35:43.000000000 +010012--- src.orig/ui/gfx/gl/gl_implementation_linux.cc 2012-06-21 16:09:03.011162386 -0400
13+++ src/ui/gfx/gl/gl_implementation_linux.cc 2011-10-21 18:40:52.767139411 +010013+++ src/ui/gfx/gl/gl_implementation_linux.cc 2012-06-21 16:14:21.867172877 -0400
14@@ -73,7 +73,7 @@14@@ -75,7 +75,7 @@
15 }15 }
16 16
17 base::NativeLibrary library = LoadLibrary(17 base::NativeLibrary library = LoadLibrary(
@@ -20,16 +20,3 @@
20 if (!library)20 if (!library)
21 return false;21 return false;
22 22
23@@ -120,10 +120,10 @@
24 }
25 #endif // !defined(USE_WAYLAND)
26 case kGLImplementationEGLGLES2: {
27- base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so");
28+ base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so.2");
29 if (!gles_library)
30 return false;
31- base::NativeLibrary egl_library = LoadLibrary("libEGL.so");
32+ base::NativeLibrary egl_library = LoadLibrary("libEGL.so.1");
33 if (!egl_library) {
34 base::UnloadNativeLibrary(gles_library);
35 return false;
3623
=== modified file 'debian/patches/fix-armhf-ftbfs.patch'
--- debian/patches/fix-armhf-ftbfs.patch 2012-03-07 07:24:59 +0000
+++ debian/patches/fix-armhf-ftbfs.patch 2012-08-06 17:52:22 +0000
@@ -2,23 +2,11 @@
2Subject: Fix FTBFS on armhf2Subject: Fix FTBFS on armhf
3Bug-Ubuntu: https://bugs.launchpad.net/bugs/9432813Bug-Ubuntu: https://bugs.launchpad.net/bugs/943281
44
5Index: src/build/common.gypi
6===================================================================
7--- src.orig/build/common.gypi 2012-03-05 10:39:30.082526500 +0200
8+++ src/build/common.gypi 2012-03-05 11:02:24.082526500 +0200
9@@ -1814,7 +1814,6 @@
10 'cflags': [
11 '-march=armv7-a',
12 '-mtune=cortex-a8',
13- '-mfloat-abi=softfp',
14 ],
15 'conditions': [
16 ['arm_neon==1', {
17Index: src/native_client/build/common.gypi5Index: src/native_client/build/common.gypi
18===================================================================6===================================================================
19--- src.orig/native_client/build/common.gypi 2012-02-15 23:35:45.000000000 +02007--- src.orig/native_client/build/common.gypi 2012-06-21 14:40:40.000000000 -0400
20+++ src/native_client/build/common.gypi 2012-03-05 11:03:09.160651492 +02008+++ src/native_client/build/common.gypi 2012-06-21 16:16:02.195176177 -0400
21@@ -289,7 +289,6 @@9@@ -294,7 +294,6 @@
22 '-march=armv7-a',10 '-march=armv7-a',
23 '-mtune=cortex-a8',11 '-mtune=cortex-a8',
24 '-mfpu=neon',12 '-mfpu=neon',
@@ -26,15 +14,3 @@
26 '-fno-exceptions',14 '-fno-exceptions',
27 '-Wall',15 '-Wall',
28 '-fPIC',16 '-fPIC',
29Index: src/third_party/ffmpeg/ffmpeg.gyp
30===================================================================
31--- src.orig/third_party/ffmpeg/ffmpeg.gyp 2012-02-15 23:35:36.000000000 +0200
32+++ src/third_party/ffmpeg/ffmpeg.gyp 2012-03-05 11:02:34.004401501 +0200
33@@ -170,7 +170,6 @@
34 '-mthumb',
35 '-march=armv7-a',
36 '-mtune=cortex-a8',
37- '-mfloat-abi=softfp',
38 ],
39 'conditions': [
40 ['arm_neon == 0', {
4117
=== added file 'debian/patches/grd_parse_fix.patch'
--- debian/patches/grd_parse_fix.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/grd_parse_fix.patch 2012-08-06 17:52:22 +0000
@@ -0,0 +1,12 @@
1Index: src/chrome/app/chromium_strings.grd
2===================================================================
3--- src.orig/chrome/app/chromium_strings.grd 2012-07-09 14:16:01.091449368 -0400
4+++ src/chrome/app/chromium_strings.grd 2012-07-09 14:25:12.951467521 -0400
5@@ -111,7 +111,6 @@
6 <if expr="not pp_ifdef('use_third_party_translations')">
7 <file path="resources/chromium_strings_am.xtb" lang="am" />
8 <file path="resources/chromium_strings_ar.xtb" lang="ar" />
9- </if>
10 <file path="../../third_party/launchpad_translations/chromium_strings_ast.xtb" lang="ast" />
11 <file path="../../third_party/launchpad_translations/chromium_strings_bg.xtb" lang="bg" />
12 <file path="resources/chromium_strings_bn.xtb" lang="bn" />
013
=== modified file 'debian/patches/series'
--- debian/patches/series 2012-03-30 08:42:27 +0000
+++ debian/patches/series 2012-08-06 17:52:22 +0000
@@ -1,8 +1,13 @@
1# system_v8.patch1# system_v8.patch
2ubuntu_dont_overwrite_default_download_directory.patch
3chromium_useragent.patch2chromium_useragent.patch
4disable_dlog_and_dcheck_in_release_builds.patch3disable_dlog_and_dcheck_in_release_builds.patch
5webkit_rev_parser.patch4webkit_rev_parser.patch
6dlopen_sonamed_gl.patch5dlopen_sonamed_gl.patch
7glib-header-single-entry.patch
8fix-armhf-ftbfs.patch6fix-armhf-ftbfs.patch
7arm.patch
8grd_parse_fix.patch
91-infobars.patch
102-get-domain-tld.patch
113-chrome-xid.patch
12chromeless-window-launch-option.patch
13desktop-integration-settings.patch
914
=== removed file 'debian/patches/ubuntu_dont_overwrite_default_download_directory.patch'
--- debian/patches/ubuntu_dont_overwrite_default_download_directory.patch 2011-05-06 22:59:06 +0000
+++ debian/patches/ubuntu_dont_overwrite_default_download_directory.patch 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
1See http://code.google.com/p/chromium/issues/detail?id=16442
2Restore the default Downloads location used on Ubuntu.
3
4---
5 chrome/common/chrome_paths_linux.cc | 15 ---------------
6 1 file changed, 15 deletions(-)
7
8Index: src/chrome/common/chrome_paths_linux.cc
9===================================================================
10--- src.orig/chrome/common/chrome_paths_linux.cc
11+++ src/chrome/common/chrome_paths_linux.cc
12@@ -79,35 +79,20 @@
13 }
14
15 bool GetUserDocumentsDirectory(FilePath* result) {
16 scoped_ptr<base::Environment> env(base::Environment::Create());
17 *result = base::nix::GetXDGUserDirectory(env.get(), "DOCUMENTS", "Documents");
18 return true;
19 }
20
21-// We respect the user's preferred download location, unless it is
22-// ~ or their desktop directory, in which case we default to ~/Downloads.
23 bool GetUserDownloadsDirectory(FilePath* result) {
24 scoped_ptr<base::Environment> env(base::Environment::Create());
25 *result = base::nix::GetXDGUserDirectory(env.get(), "DOWNLOAD",
26 kDownloadsDir);
27-
28- FilePath home = file_util::GetHomeDir();
29- if (*result == home) {
30- *result = home.Append(kDownloadsDir);
31- return true;
32- }
33-
34- FilePath desktop;
35- GetUserDesktop(&desktop);
36- if (*result == desktop) {
37- *result = home.Append(kDownloadsDir);
38- }
39-
40 return true;
41 }
42
43 bool GetUserDesktop(FilePath* result) {
44 scoped_ptr<base::Environment> env(base::Environment::Create());
45 *result = base::nix::GetXDGUserDirectory(env.get(), "DESKTOP", "Desktop");
46 return true;
47 }
480
=== modified file 'debian/rules'
--- debian/rules 2012-06-18 14:17:58 +0000
+++ debian/rules 2012-08-06 17:52:22 +0000
@@ -72,9 +72,13 @@
72# Disable NaCl until we figure out what to do with the private toolchain72# Disable NaCl until we figure out what to do with the private toolchain
73GYP_DEFINES += disable_nacl=173GYP_DEFINES += disable_nacl=1
7474
75# do not use third_party/gold as the linker.
76GYP_DEFINES += linux_use_gold_binary=0 linux_use_gold_flags=0
77
75ifneq (,$(findstring armhf,$(DEB_BUILD_ARCH)))78ifneq (,$(findstring armhf,$(DEB_BUILD_ARCH)))
76GYP_DEFINES += \79GYP_DEFINES += \
77 v8_use_arm_eabi_hardfloat=true \80 v8_use_arm_eabi_hardfloat=true \
81 arm_float_abi=hard \
78 $(NULL)82 $(NULL)
79endif83endif
8084
@@ -143,6 +147,17 @@
143147
144CC_VERSION := $(shell gcc -dumpversion | cut -d. -f-2)148CC_VERSION := $(shell gcc -dumpversion | cut -d. -f-2)
145149
150# Set this to use gcc 4.6 instead of 4.7
151AVOID_GCC_47 ?= 1
152ifeq (4.7,$(CC_VERSION))
153GYP_DEFINES += werror=$(NULL)
154ifeq (1,$(AVOID_GCC_47))
155CC := gcc-4.6
156CXX := g++-4.6
157BUILD_ARGS += CC=$(CC) CXX=$(CXX) CC.host=$(CC) CXX.host=$(CXX) LINK.host=$(CXX)
158endif
159endif
160
146# Set this to use gcc 4.5 instead of 4.6161# Set this to use gcc 4.5 instead of 4.6
147AVOID_GCC_46 ?= 0162AVOID_GCC_46 ?= 0
148 163
@@ -235,6 +250,14 @@
235FFMPEG_MT_STD_GYP_DEFINES = $(NULL)250FFMPEG_MT_STD_GYP_DEFINES = $(NULL)
236FFMPEG_MT_EXTRA_GYP_DEFINES = ffmpeg_branding=Chrome251FFMPEG_MT_EXTRA_GYP_DEFINES = ffmpeg_branding=Chrome
237252
253ifneq (,$(filter 12.10 unstable development,$(DEBIAN_DIST)))
254# enable compile-time dependency on gnome-keyring
255GYP_DEFINES += use_gnome_keyring=1 linux_link_gnome_keyring=1
256# controlling the use of GConf (the classic GNOME configuration
257# and GIO, which contains GSettings (the new GNOME config system)
258GYP_DEFINES += use_gconf=1 use_gio=1
259endif
260
238USE_SYSTEM_SQLITE := $(shell pkg-config 'sqlite3 >= 3.6.1' && echo 1 || echo 0)261USE_SYSTEM_SQLITE := $(shell pkg-config 'sqlite3 >= 3.6.1' && echo 1 || echo 0)
239USE_SYSTEM_SQLITE := 0262USE_SYSTEM_SQLITE := 0
240263
@@ -549,6 +572,7 @@
549 third_party/ffmpeg/binaries \572 third_party/ffmpeg/binaries \
550 third_party/fuzzymatch \573 third_party/fuzzymatch \
551 third_party/gles_book_examples \574 third_party/gles_book_examples \
575 third_party/gold \
552 third_party/hunspell/dictionaries \576 third_party/hunspell/dictionaries \
553 third_party/icu/mac \577 third_party/icu/mac \
554 third_party/lcov \578 third_party/lcov \

Subscribers

People subscribed via source and target branches

to all changes: