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

Proposed by Ken VanDine on 2012-07-06
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 2012-07-06 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 on 2012-07-10

* 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 on 2012-07-10

* 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 on 2012-07-10

Bumped standards version to 3.9.3

740. By Ken VanDine on 2012-07-10

merged

741. By Ken VanDine on 2012-07-11

* 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 on 2012-07-11

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

743. By Ken VanDine on 2012-07-12

don't build depend on binutils-gold for armel

744. By Ken VanDine on 2012-07-12

releasing version 20.0.1132.47~r144678-0ubuntu1

745. By Ken VanDine on 2012-07-12

* 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 on 2012-07-13

releasing version 20.0.1132.47~r144678-0ubuntu2

747. By Ken VanDine on 2012-08-06

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
1=== modified file 'debian/apport/chromium-browser.py'
2--- debian/apport/chromium-browser.py 2011-05-09 17:41:33 +0000
3+++ debian/apport/chromium-browser.py 2012-08-06 17:52:22 +0000
4@@ -11,6 +11,7 @@
5 the full text of the license.
6 '''
7
8+from __future__ import print_function
9 import os, sys, getopt, codecs
10 import time
11 from stat import *
12@@ -57,7 +58,7 @@
13 report['RelatedPackagesPolicy'] = ''
14 for pkg in pkgs:
15 script = subprocess.Popen(['apt-cache', 'policy', pkg], stdout=subprocess.PIPE)
16- report['RelatedPackagesPolicy'] += script.communicate()[0] + "\n"
17+ report['RelatedPackagesPolicy'] += str(script.communicate()[0]) + "\n"
18
19 def gconf_values(report, keys):
20 report['gconf-keys'] = ''
21@@ -67,7 +68,7 @@
22 except OSError:
23 report['gconf-keys'] = "gconftool-2 not found"
24 return
25- out = script.communicate()[0]
26+ out = str(script.communicate()[0])
27 if out == "":
28 out = "**unset**\n"
29 report['gconf-keys'] += key + " = " + out
30@@ -105,7 +106,7 @@
31 # list entensions+versions
32 report['ChromiumPrefs'] += "extensions/settings =\n"
33 if 'settings' in entry['extensions']:
34- for ext in entry['extensions']['settings'].keys():
35+ for ext in list(entry['extensions']['settings'].keys()):
36 report['ChromiumPrefs'] += " - '" + ext + "'\n"
37 if 'manifest' in entry['extensions']['settings'][ext]:
38 for k in [ 'name', 'description', 'version', 'update_url' ]:
39@@ -243,17 +244,17 @@
40
41 # Disk usage
42 script = subprocess.Popen([ 'df', '-Th' ], stdout=subprocess.PIPE)
43- report['DiskUsage'] = script.communicate()[0] + "\n\nInodes:\n"
44+ report['DiskUsage'] = str(script.communicate()[0]) + "\n\nInodes:\n"
45 script = subprocess.Popen([ 'df', '-ih' ], stdout=subprocess.PIPE)
46- report['DiskUsage'] += script.communicate()[0]
47+ report['DiskUsage'] += str(script.communicate()[0])
48
49 ## DEBUGING ##
50 if __name__ == '__main__':
51 sys.stdout = codecs.getwriter('utf8')(sys.stdout)
52 try:
53 opts, args = getopt.getopt(sys.argv[1:], "-u:", [ 'user-dir=' ])
54- except getopt.GetoptError, err:
55- print str(err)
56+ except getopt.GetoptError as err:
57+ print(str(err))
58 sys.exit(2)
59
60 userdir = None
61@@ -266,4 +267,4 @@
62 report = {}
63 add_info(report, userdir = userdir)
64 for key in report:
65- print '[%s]\n%s\n' % (key, report[key])
66+ print('[%s]\n%s\n' % (key, report[key]))
67
68=== modified file 'debian/changelog'
69--- debian/changelog 2012-06-18 16:37:20 +0000
70+++ debian/changelog 2012-08-06 17:52:22 +0000
71@@ -1,3 +1,67 @@
72+chromium-browser (20.0.1132.47~r144678-0ubuntu3) quantal; urgency=low
73+
74+ * debian/patches/1-infobars.patch
75+ - moved infobars out of experimental, used for webapps
76+ * debian/patches/2-get-domain-tld.patch
77+ - Adds API for getting the base domain of a URI, used for webapps
78+ * debian/patches/3-chrome-xid.patch
79+ - Get xid, used for webapps
80+ * debian/patches/chromeless-window-launch-option.patch
81+ - Adds optional chromeless mode, used for webapps
82+ * debian/patches/desktop-integration-settings.patch
83+ - Adds settings for managing sites integrated with the desktop, used
84+ for webapps
85+
86+ -- Ken VanDine <ken.vandine@canonical.com> Mon, 06 Aug 2012 13:40:57 -0400
87+
88+chromium-browser (20.0.1132.47~r144678-0ubuntu2) quantal; urgency=low
89+
90+ * debian/control
91+ - Dropped build depends for libvpx-dev
92+ * -debian/patches/vpx.patch
93+ - dropped, build with internal vpx
94+
95+ [ Matthieu Baerts ]
96+ * debian/apport:
97+ - Update apport hook for python3 (LP: #1013171)
98+ patch made with the help of Edward Donovan
99+
100+ -- Ken VanDine <ken.vandine@canonical.com> Thu, 12 Jul 2012 15:56:59 -0400
101+
102+chromium-browser (20.0.1132.47~r144678-0ubuntu1) quantal; urgency=low
103+
104+ * New upstream release from the Stable Channel
105+ * debian/control
106+ - Added build depends binutils-gold, libvpx-dev,libssl-dev and subversion
107+ - Bumped standards version to 3.9.3
108+ - don't build depend on binutils-gold for armel
109+ * debian/rules
110+ - explicitly set arm_float_abi=hard for armhf builds and let the rest
111+ fallback to softfp
112+ - do not use third_party/gold as the linker.
113+ - enable compile-time dependency on gnome-keyring
114+ * -debian/patches/ubuntu_dont_overwrite_default_download_directory.patch
115+ - no longer needed
116+ * debian/patches/grd_parse_fix.patch
117+ - Patched to fix broken XML until we can get a proper fix for
118+ chromium-translation-tools.
119+ * debian/patches/vpx.patch
120+ - patch from debian to fix FTBFS on armel
121+ * debian/patches/arm.patch
122+ - patch from debian to fix FTBFS on armel
123+
124+ -- Ken VanDine <ken.vandine@canonical.com> Thu, 12 Jul 2012 14:02:44 -0400
125+
126+chromium-browser (18.0.1025.168~r134367-0ubuntu2) quantal; urgency=low
127+
128+ * debian/rules
129+ - force to build with gcc 4.6 to fix ftbfs (LP: #992212)
130+ - don't build with -Werror
131+ * debian/control
132+ - add build depends for g++-4.6-multilib
133+
134+ -- Ken VanDine <ken.vandine@canonical.com> Fri, 06 Jul 2012 13:51:59 -0400
135+
136 chromium-browser (18.0.1025.168~r134367-0ubuntu1) quantal; urgency=low
137
138 * debian/rules
139
140=== modified file 'debian/control'
141--- debian/control 2012-03-30 08:38:01 +0000
142+++ debian/control 2012-08-06 17:52:22 +0000
143@@ -13,6 +13,8 @@
144 patchutils (>= 0.2.25),
145 libc6-dev-i386 [amd64],
146 g++-multilib [amd64],
147+ g++-4.6-multilib,
148+ binutils-gold [!armel],
149 hardening-wrapper,
150 python,
151 bison,
152@@ -48,8 +50,10 @@
153 libdbus-glib-1-dev,
154 libgnome-keyring-dev,
155 libudev-dev,
156- libgconf2-dev
157-Standards-Version: 3.8.3
158+ libgconf2-dev,
159+ libssl-dev,
160+ subversion
161+Standards-Version: 3.9.3
162
163 Package: chromium-browser
164 Architecture: any
165
166=== added file 'debian/patches/1-infobars.patch'
167--- debian/patches/1-infobars.patch 1970-01-01 00:00:00 +0000
168+++ debian/patches/1-infobars.patch 2012-08-06 17:52:22 +0000
169@@ -0,0 +1,193 @@
170+Index: src/chrome/browser/infobars/infobar_extension_apitest.cc
171+===================================================================
172+--- src.orig/chrome/browser/infobars/infobar_extension_apitest.cc 2012-07-07 00:59:54.000000000 -0400
173++++ src/chrome/browser/infobars/infobar_extension_apitest.cc 2012-07-16 15:33:42.371644366 -0400
174+@@ -15,9 +15,5 @@
175+ #endif
176+
177+ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_Infobars) {
178+- // TODO(finnur): Remove once infobars are no longer experimental (bug 39511).
179+- CommandLine::ForCurrentProcess()->AppendSwitch(
180+- switches::kEnableExperimentalExtensionApis);
181+-
182+ ASSERT_TRUE(RunExtensionTest("infobars")) << message_;
183+ }
184+Index: src/chrome/browser/infobars/infobar_extension_api.h
185+===================================================================
186+--- src.orig/chrome/browser/infobars/infobar_extension_api.h 2012-07-07 00:59:54.000000000 -0400
187++++ src/chrome/browser/infobars/infobar_extension_api.h 2012-07-16 15:33:42.371644366 -0400
188+@@ -11,7 +11,7 @@
189+ class ShowInfoBarFunction : public SyncExtensionFunction {
190+ virtual ~ShowInfoBarFunction() {}
191+ virtual bool RunImpl() OVERRIDE;
192+- DECLARE_EXTENSION_FUNCTION_NAME("experimental.infobars.show")
193++ DECLARE_EXTENSION_FUNCTION_NAME("infobars.show")
194+ };
195+
196+ #endif // CHROME_BROWSER_INFOBARS_INFOBAR_EXTENSION_API_H_
197+Index: src/chrome/common/extensions_api_resources.grd
198+===================================================================
199+--- src.orig/chrome/common/extensions_api_resources.grd 2012-07-07 01:01:18.000000000 -0400
200++++ src/chrome/common/extensions_api_resources.grd 2012-07-16 15:33:42.371644366 -0400
201+@@ -28,7 +28,6 @@
202+ <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_DOWNLOADS" file="extensions\api\experimental.downloads.json" type="BINDATA" />
203+ <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_FONTSSETTINGS" file="extensions\api\experimental.fontSettings.json" type="BINDATA" />
204+ <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_IDENTITY" file="extensions\api\experimental.identity.json" type="BINDATA" />
205+- <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS" file="extensions\api\experimental.infobars.json" type="BINDATA" />
206+ <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_UI" file="extensions\api\experimental.input.ui.json" type="BINDATA" />
207+ <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_VIRTUALKEYBOARD" file="extensions\api\experimental.input.virtualKeyboard.json" type="BINDATA" />
208+ <include name="IDR_EXTENSION_API_JSON_EXPERIMENTAL_KEYBINDING" file="extensions\api\experimental.keybinding.json" type="BINDATA" />
209+@@ -45,6 +44,7 @@
210+ <include name="IDR_EXTENSION_API_JSON_HISTORY" file="extensions\api\history.json" type="BINDATA" />
211+ <include name="IDR_EXTENSION_API_JSON_I18N" file="extensions\api\i18n.json" type="BINDATA" />
212+ <include name="IDR_EXTENSION_API_JSON_INPUT_IME" file="extensions\api\input.ime.json" type="BINDATA" />
213++ <include name="IDR_EXTENSION_API_JSON_INFOBARS" file="extensions\api\infobars.json" type="BINDATA" />
214+ <include name="IDR_EXTENSION_API_JSON_IDLE" file="extensions\api\idle.json" type="BINDATA" />
215+ <include name="IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE" file="extensions\api\inputMethodPrivate.json" type="BINDATA" />
216+ <include name="IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE" file="extensions\api\managedModePrivate.json" type="BINDATA" />
217+Index: src/chrome/common/extensions/extension_permission_set.cc
218+===================================================================
219+--- src.orig/chrome/common/extensions/extension_permission_set.cc 2012-07-07 01:01:17.000000000 -0400
220++++ src/chrome/common/extensions/extension_permission_set.cc 2012-07-16 15:33:42.371644366 -0400
221+@@ -47,6 +47,7 @@
222+ "devtools",
223+ "extension",
224+ "i18n",
225++ "infobars",
226+ "omnibox",
227+ "pageAction",
228+ "pageActions",
229+Index: src/chrome/common/extensions/api/infobars.json
230+===================================================================
231+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
232++++ src/chrome/common/extensions/api/infobars.json 2012-07-16 15:38:08.703653129 -0400
233+@@ -0,0 +1,51 @@
234++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
235++// Use of this source code is governed by a BSD-style license that can be
236++// found in the LICENSE file.
237++
238++[
239++ {
240++ "namespace": "infobars",
241++ "dependencies": [ "windows" ],
242++ "types": [],
243++ "functions": [
244++ {
245++ "name": "show",
246++ "type": "function",
247++ "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.",
248++ "parameters": [
249++ {
250++ "name": "details",
251++ "type": "object",
252++ "properties": {
253++ "tabId": {
254++ "type": "integer",
255++ "description": "The tab id for the tab to display the infobar in."
256++ },
257++ "path": {
258++ "type": "string",
259++ "description": "The html file that contains the infobar."
260++ },
261++ "height": {
262++ "type": "integer",
263++ "description": "The height (in pixels) of the infobar to show. If omitted, the default infobar height will be used.",
264++ "optional": true,
265++ "minimum": 0,
266++ "maximum": 72
267++ }
268++ }
269++ },
270++ {
271++ "type": "function",
272++ "name": "callback",
273++ "optional": true,
274++ "parameters": [
275++ {
276++ "name": "window", "$ref": "Window", "description": "Contains details about the window in which the infobar was created."
277++ }
278++ ]
279++ }
280++ ]
281++ }
282++ ]
283++ }
284++]
285+Index: src/chrome/common/extensions/api/extension_api.cc
286+===================================================================
287+--- src.orig/chrome/common/extensions/api/extension_api.cc 2012-07-07 01:01:17.000000000 -0400
288++++ src/chrome/common/extensions/api/extension_api.cc 2012-07-16 15:33:42.375644366 -0400
289+@@ -297,8 +297,6 @@
290+ IDR_EXTENSION_API_JSON_EXPERIMENTAL_FONTSSETTINGS));
291+ RegisterSchema("experimental.identity", ReadFromResource(
292+ IDR_EXTENSION_API_JSON_EXPERIMENTAL_IDENTITY));
293+- RegisterSchema("experimental.infobars", ReadFromResource(
294+- IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS));
295+ RegisterSchema("experimental.input.ui", ReadFromResource(
296+ IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_UI));
297+ RegisterSchema("experimental.input.virtualKeyboard", ReadFromResource(
298+@@ -331,6 +329,8 @@
299+ IDR_EXTENSION_API_JSON_I18N));
300+ RegisterSchema("idle", ReadFromResource(
301+ IDR_EXTENSION_API_JSON_IDLE));
302++ RegisterSchema("infobars",ReadFromResource(
303++ IDR_EXTENSION_API_JSON_INFOBARS));
304+ RegisterSchema("experimental.input.ime", ReadFromResource(
305+ IDR_EXTENSION_API_JSON_INPUT_IME));
306+ RegisterSchema("inputMethodPrivate", ReadFromResource(
307+Index: src/chrome/common/extensions/api/experimental.infobars.json
308+===================================================================
309+--- src.orig/chrome/common/extensions/api/experimental.infobars.json 2012-07-07 01:01:17.000000000 -0400
310++++ /dev/null 1970-01-01 00:00:00.000000000 +0000
311+@@ -1,51 +0,0 @@
312+-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
313+-// Use of this source code is governed by a BSD-style license that can be
314+-// found in the LICENSE file.
315+-
316+-[
317+- {
318+- "namespace": "experimental.infobars",
319+- "dependencies": [ "windows" ],
320+- "types": [],
321+- "functions": [
322+- {
323+- "name": "show",
324+- "type": "function",
325+- "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.",
326+- "parameters": [
327+- {
328+- "name": "details",
329+- "type": "object",
330+- "properties": {
331+- "tabId": {
332+- "type": "integer",
333+- "description": "The tab id for the tab to display the infobar in."
334+- },
335+- "path": {
336+- "type": "string",
337+- "description": "The html file that contains the infobar."
338+- },
339+- "height": {
340+- "type": "integer",
341+- "description": "The height (in pixels) of the infobar to show. If omitted, the default infobar height will be used.",
342+- "optional": true,
343+- "minimum": 0,
344+- "maximum": 72
345+- }
346+- }
347+- },
348+- {
349+- "type": "function",
350+- "name": "callback",
351+- "optional": true,
352+- "parameters": [
353+- {
354+- "name": "window", "$ref": "Window", "description": "Contains details about the window in which the infobar was created."
355+- }
356+- ]
357+- }
358+- ]
359+- }
360+- ]
361+- }
362+-]
363
364=== added file 'debian/patches/2-get-domain-tld.patch'
365--- debian/patches/2-get-domain-tld.patch 1970-01-01 00:00:00 +0000
366+++ debian/patches/2-get-domain-tld.patch 2012-08-06 17:52:22 +0000
367@@ -0,0 +1,255 @@
368+Index: src/chrome/browser/extensions/api/tld/tld_api.cc
369+===================================================================
370+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
371++++ src/chrome/browser/extensions/api/tld/tld_api.cc 2012-07-16 15:39:31.611655856 -0400
372+@@ -0,0 +1,88 @@
373++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
374++// Use of this source code is governed by a BSD-style license that can be
375++// found in the LICENSE file.
376++
377++#include "chrome/browser/extensions/api/tld/tld_api.h"
378++
379++#include "base/time.h"
380++#include "base/values.h"
381++#include "chrome/browser/extensions/extension_service.h"
382++#include "chrome/common/extensions/extension.h"
383++#include "chrome/common/extensions/extension_constants.h"
384++#include "googleurl/src/gurl.h"
385++#include "googleurl/src/url_parse.h"
386++#include "googleurl/src/url_util.h"
387++#include "net/base/registry_controlled_domain.h"
388++
389++namespace {
390++const char kInvalidUriError[] = "Invalid or unsupported URI";
391++
392++bool IsValidUrl(const GURL& url) {
393++ return url.is_valid() && url.IsStandard() &&
394++ !url.SchemeIsFile() && !url.SchemeIsFileSystem();
395++}
396++} // namespace
397++
398++bool TldGetBaseDomainFunction::RunImpl() {
399++ EXTENSION_FUNCTION_VALIDATE(args_->GetSize() == 1);
400++
401++ std::string uri;
402++ EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &uri));
403++
404++ // We might delegate all the url validity check to GetDomainAndRegistry
405++ // but try to be more explicit about the errors in some cases.
406++ const GURL url(uri);
407++ if (!IsValidUrl(url)) {
408++ error_ = kInvalidUriError;
409++ return false;
410++ }
411++
412++ std::string tld =
413++ net::RegistryControlledDomainService::GetDomainAndRegistry(url);
414++
415++ result_.reset(Value::CreateStringValue(tld));
416++
417++ return true;
418++}
419++
420++
421++bool TldGetPublicSuffix::RunImpl() {
422++ EXTENSION_FUNCTION_VALIDATE(args_->GetSize() == 2);
423++
424++ std::string uri;
425++ EXTENSION_FUNCTION_VALIDATE(!args_->GetString(0, &uri));
426++
427++ // We might delegate all the url validity check to GetDomainAndRegistry
428++ // or GetRegistryLength but try to be more explicit about the errors in
429++ // some cases.
430++ const GURL url(uri);
431++ if (!IsValidUrl(url)) {
432++ error_ = kInvalidUriError;
433++ return false;
434++ }
435++
436++ std::string suffix;
437++
438++ size_t reg_len =
439++ net::RegistryControlledDomainService::GetRegistryLength(url, true);
440++
441++ if (std::string::npos == reg_len || 0 == reg_len)
442++ return false;
443++
444++ std::string tld =
445++ net::RegistryControlledDomainService::GetDomainAndRegistry(url);
446++
447++ if (!tld.empty () && tld.size() > reg_len)
448++ suffix = tld.substr(tld.size() - reg_len - 1, reg_len);
449++
450++ // An empty suffix is a acceptable value since the URL might be
451++ // "properly formed" but might fall into cases such as:
452++ // * http://co.uk/file.html
453++ // * http://<IP address>/file.html
454++ // which are described by GetRegistryLength to return 0 (i.e. a valid value).
455++ result_.reset(Value::CreateStringValue(suffix));
456++
457++ return true;
458++}
459++
460++
461+Index: src/chrome/browser/extensions/api/tld/tld_api.h
462+===================================================================
463+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
464++++ src/chrome/browser/extensions/api/tld/tld_api.h 2012-07-16 15:39:31.611655856 -0400
465+@@ -0,0 +1,26 @@
466++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
467++// Use of this source code is governed by a BSD-style license that can be
468++// found in the LICENSE file.
469++
470++#ifndef CHROME_BROWSER_EXTENSIONS_API_TLD_TLD_API_H_
471++#define CHROME_BROWSER_EXTENSIONS_API_TLD_TLD_API_H_
472++#pragma once
473++
474++#include "chrome/browser/extensions/extension_function.h"
475++
476++class TldGetBaseDomainFunction : public SyncExtensionFunction {
477++ public:
478++ virtual ~TldGetBaseDomainFunction() {}
479++ virtual bool RunImpl() OVERRIDE;
480++ DECLARE_EXTENSION_FUNCTION_NAME("tld.getBaseDomain");
481++};
482++
483++class TldGetPublicSuffix : public SyncExtensionFunction {
484++ public:
485++ virtual ~TldGetPublicSuffix() {}
486++ virtual bool RunImpl() OVERRIDE;
487++ DECLARE_EXTENSION_FUNCTION_NAME("tld.getPublicSuffix");
488++};
489++
490++#endif // CHROME_BROWSER_EXTENSIONS_API_TLD_TLD_API_H_
491++
492+Index: src/chrome/browser/extensions/extension_function_registry.cc
493+===================================================================
494+--- src.orig/chrome/browser/extensions/extension_function_registry.cc 2012-07-07 00:59:55.000000000 -0400
495++++ src/chrome/browser/extensions/extension_function_registry.cc 2012-07-16 15:40:22.239657522 -0400
496+@@ -19,6 +19,7 @@
497+ #include "chrome/browser/extensions/api/runtime/runtime_api.h"
498+ #include "chrome/browser/extensions/api/serial/serial_api.h"
499+ #include "chrome/browser/extensions/api/socket/socket_api.h"
500++#include "chrome/browser/extensions/api/tld/tld_api.h"
501+ #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
502+ #include "chrome/browser/extensions/api/web_request/web_request_api.h"
503+ #include "chrome/browser/extensions/execute_code_in_tab_function.h"
504+@@ -166,6 +167,10 @@
505+ RegisterFunction<MoveBookmarkFunction>();
506+ RegisterFunction<UpdateBookmarkFunction>();
507+
508++ // TLD.
509++ RegisterFunction<TldGetBaseDomainFunction>();
510++ RegisterFunction<TldGetPublicSuffix>();
511++
512+ // Infobars.
513+ RegisterFunction<ShowInfoBarFunction>();
514+
515+Index: src/chrome/chrome_browser_extensions.gypi
516+===================================================================
517+--- src.orig/chrome/chrome_browser_extensions.gypi 2012-07-07 01:00:10.000000000 -0400
518++++ src/chrome/chrome_browser_extensions.gypi 2012-07-16 15:39:31.611655856 -0400
519+@@ -156,6 +156,8 @@
520+ 'browser/extensions/api/terminal/terminal_extension_helper.h',
521+ 'browser/extensions/api/terminal/terminal_private_api.cc',
522+ 'browser/extensions/api/terminal/terminal_private_api.h',
523++ 'browser/extensions/api/tld/tld_api.cc',
524++ 'browser/extensions/api/tld/tld_api.h',
525+ 'browser/extensions/api/usb/usb_api.cc',
526+ 'browser/extensions/api/usb/usb_api.h',
527+ 'browser/extensions/api/usb/usb_device_resource.cc',
528+Index: src/chrome/common/extensions_api_resources.grd
529+===================================================================
530+--- src.orig/chrome/common/extensions_api_resources.grd 2012-07-16 15:33:42.000000000 -0400
531++++ src/chrome/common/extensions_api_resources.grd 2012-07-16 15:39:31.611655856 -0400
532+@@ -63,6 +63,7 @@
533+ <include name="IDR_EXTENSION_API_JSON_TABS" file="extensions\api\tabs.json" type="BINDATA" />
534+ <include name="IDR_EXTENSION_API_JSON_TERMINALPRIVATE" file="extensions\api\terminalPrivate.json" type="BINDATA" />
535+ <include name="IDR_EXTENSION_API_JSON_TEST" file="extensions\api\test.json" type="BINDATA" />
536++ <include name="IDR_EXTENSION_API_JSON_TLD" file="extensions\api\tld.json" type="BINDATA" />
537+ <include name="IDR_EXTENSION_API_JSON_TOPSITES" file="extensions\api\topSites.json" type="BINDATA" />
538+ <include name="IDR_EXTENSION_API_JSON_TTS" file="extensions\api\tts.json" type="BINDATA" />
539+ <include name="IDR_EXTENSION_API_JSON_TTSENGINE" file="extensions\api\ttsEngine.json" type="BINDATA" />
540+Index: src/chrome/common/extensions/extension_permission_set.cc
541+===================================================================
542+--- src.orig/chrome/common/extensions/extension_permission_set.cc 2012-07-16 15:33:42.000000000 -0400
543++++ src/chrome/common/extensions/extension_permission_set.cc 2012-07-16 15:40:49.303658414 -0400
544+@@ -53,6 +53,7 @@
545+ "pageActions",
546+ "permissions",
547+ "test",
548++ "tld",
549+ "types"
550+ };
551+ const size_t kNumNonPermissionModuleNames =
552+Index: src/chrome/common/extensions/api/extension_api.cc
553+===================================================================
554+--- src.orig/chrome/common/extensions/api/extension_api.cc 2012-07-16 15:33:42.000000000 -0400
555++++ src/chrome/common/extensions/api/extension_api.cc 2012-07-16 15:39:31.611655856 -0400
556+@@ -369,6 +369,8 @@
557+ IDR_EXTENSION_API_JSON_TERMINALPRIVATE));
558+ RegisterSchema("test", ReadFromResource(
559+ IDR_EXTENSION_API_JSON_TEST));
560++ RegisterSchema("tld", ReadFromResource(
561++ IDR_EXTENSION_API_JSON_TLD));
562+ RegisterSchema("topSites", ReadFromResource(
563+ IDR_EXTENSION_API_JSON_TOPSITES));
564+ RegisterSchema("ttsEngine", ReadFromResource(
565+Index: src/chrome/common/extensions/api/tld.json
566+===================================================================
567+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
568++++ src/chrome/common/extensions/api/tld.json 2012-07-16 15:39:31.615655856 -0400
569+@@ -0,0 +1,53 @@
570++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
571++// Use of this source code is governed by a BSD-style license that can be
572++// found in the LICENSE file.
573++
574++[
575++ {
576++ "namespace": "tld",
577++ "nodoc": "true",
578++ "types": [],
579++ "functions": [
580++ {
581++ "name": "getBaseDomain",
582++ "type": "function",
583++ "description": "Returns the base domain of a URI; that is, the public suffix with a given number of additional domain name parts.",
584++ "nodoc": "true",
585++ "parameters": [
586++ {
587++ "name": "uri",
588++ "type": "string"
589++ },
590++ {
591++ "type": "function",
592++ "name": "callback",
593++ "parameters": [
594++ {"name": "domain", "type": "string", "description": "The base domain name of the associated URI if any"}
595++ ]
596++ }
597++ ]
598++ }
599++ ,
600++ {
601++ "name": "getPublicSuffix",
602++ "type": "function",
603++ "description": "Returns the public suffix of the domain part of a URI.",
604++ "nodoc": "true",
605++ "parameters": [
606++ {
607++ "name": "uri",
608++ "type": "string"
609++ },
610++ {
611++ "type": "function",
612++ "name": "callback",
613++ "parameters": [
614++ {"name": "suffix", "type": "string", "description": "The public suffix of the associated URI if any"}
615++ ]
616++ }
617++ ]
618++ }
619++ ]
620++ }
621++
622++]
623
624=== added file 'debian/patches/3-chrome-xid.patch'
625--- debian/patches/3-chrome-xid.patch 1970-01-01 00:00:00 +0000
626+++ debian/patches/3-chrome-xid.patch 2012-08-06 17:52:22 +0000
627@@ -0,0 +1,38 @@
628+Index: src/chrome/browser/ui/gtk/browser_window_gtk.cc
629+===================================================================
630+--- src.orig/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-07 01:00:04.000000000 -0400
631++++ src/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-16 15:41:21.991659488 -0400
632+@@ -150,6 +150,12 @@
633+ // gtk_window_get_position() after the last GTK configure-event signal.
634+ const int kDebounceTimeoutMilliseconds = 100;
635+
636++// A window property will be set to reflect the session_id of the
637++// associated browser window. The session_id is unique among browsers
638++// for a given session and actually corresponds to the window.id found
639++// in the extensions api.
640++char kSessionIdPropertyName[] = "CHROMIUM_LINUX_SESSION_ID_PROPERTY";
641++
642+ // Ubuntu patches their verrsion of GTK+ so that there is always a
643+ // gripper in the bottom right corner of the window. We dynamically
644+ // look up this symbol because it's a non-standard Ubuntu extension to
645+@@ -422,6 +428,20 @@
646+ InitWidgets();
647+ }
648+
649++ // Add a specific property to inform an interested third party
650++ // of our session id. Interesting in the context of an extension
651++ // where the session id corresponds to the window.id and is a way
652++ // to uniquely identify a window based on that (from within a given
653++ // extension).
654++ gulong session_id = browser_->session_id().id();
655++ gdk_property_change(GTK_WIDGET(window_)->window,
656++ gdk_atom_intern(kSessionIdPropertyName, FALSE),
657++ gdk_atom_intern("CARDINAL", FALSE),
658++ 32,
659++ GDK_PROP_MODE_REPLACE,
660++ (guchar *)&session_id,
661++ 1);
662++
663+ ConnectAccelerators();
664+
665+ // Set the initial background color of widgets.
666
667=== added file 'debian/patches/arm.patch'
668--- debian/patches/arm.patch 1970-01-01 00:00:00 +0000
669+++ debian/patches/arm.patch 2012-08-06 17:52:22 +0000
670@@ -0,0 +1,50 @@
671+Index: src/skia/skia.gyp
672+===================================================================
673+--- src.orig/skia/skia.gyp 2012-05-19 16:54:19.000000000 +0200
674++++ src/skia/skia.gyp 2012-06-20 14:34:13.131318952 +0200
675+@@ -1157,9 +1157,11 @@
676+ [ 'target_arch == "arm" and armv7 != 1', {
677+ 'sources': [
678+ '../third_party/skia/src/opts/SkBlitRow_opts_none.cpp',
679++ '../third_party/skia/src/opts/SkUtils_opts_none.cpp',
680+ ],
681+ 'sources!': [
682+ '../third_party/skia/src/opts/SkBlitRow_opts_arm.cpp',
683++ '../third_party/skia/src/opts/opts_check_arm.cpp',
684+ ],
685+ }],
686+ ],
687+Index: src/ui/base/resource/data_pack.cc
688+===================================================================
689+--- src.orig/ui/base/resource/data_pack.cc 2012-05-19 16:55:37.000000000 +0200
690++++ src/ui/base/resource/data_pack.cc 2012-06-20 14:38:32.507316901 +0200
691+@@ -130,9 +130,11 @@
692+ // 2) Verify the entries are within the appropriate bounds. There's an extra
693+ // entry after the last item which gives us the length of the last item.
694+ for (size_t i = 0; i < resource_count_ + 1; ++i) {
695++ uint32 t;
696+ const DataPackEntry* entry = reinterpret_cast<const DataPackEntry*>(
697+ mmap_->data() + kHeaderLength + (i * sizeof(DataPackEntry)));
698+- if (entry->file_offset > mmap_->length()) {
699++ memcpy(&t, &entry->file_offset, 32/8);
700++ if (t > mmap_->length()) {
701+ LOG(ERROR) << "Entry #" << i << " in data pack points off end of file. "
702+ << "Was the file corrupted?";
703+ UMA_HISTOGRAM_ENUMERATION("DataPack.Load", ENTRY_NOT_FOUND,
704+Index: src/v8/src/arm/macro-assembler-arm.cc
705+===================================================================
706+--- src.orig/v8/src/arm/macro-assembler-arm.cc 2012-05-19 16:57:27.000000000 +0200
707++++ src/v8/src/arm/macro-assembler-arm.cc 2012-06-20 14:35:27.339318363 +0200
708+@@ -61,9 +61,9 @@
709+ // We do not support thumb inter-working with an arm architecture not supporting
710+ // the blx instruction (below v5t). If you know what CPU you are compiling for
711+ // you can use -march=armv7 or similar.
712+-#if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS)
713+-# error "For thumb inter-working we require an architecture which supports blx"
714+-#endif
715++//#if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS)
716++//# error "For thumb inter-working we require an architecture which supports blx"
717++//#endif
718+
719+
720+ // Using bx does not yield better code, so use it only when required
721
722=== added file 'debian/patches/chromeless-window-launch-option.patch'
723--- debian/patches/chromeless-window-launch-option.patch 1970-01-01 00:00:00 +0000
724+++ debian/patches/chromeless-window-launch-option.patch 2012-08-06 17:52:22 +0000
725@@ -0,0 +1,860 @@
726+Index: src/chrome/browser/ui/gtk/browser_window_gtk.cc
727+===================================================================
728+--- src.orig/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-11 23:49:59.216259275 -0400
729++++ src/chrome/browser/ui/gtk/browser_window_gtk.cc 2012-07-11 23:49:59.232259276 -0400
730+@@ -412,6 +412,8 @@
731+ SetWindowCustomClass(window_,
732+ std::string(gdk_get_program_class()) +
733+ " (" + user_data_dir + ")");
734++ } else if (browser_->is_chromeless_mode()) {
735++ SetWindowCustomClass(window_, web_app::GetWMClassFromAppName("chromeless"));
736+ }
737+
738+ // For popups, we initialize widgets then set the window geometry, because
739+@@ -980,7 +982,7 @@
740+ }
741+
742+ void BrowserWindowGtk::SetFocusToLocationBar(bool select_all) {
743+- if (!IsFullscreen())
744++ if (!IsFullscreen() && IsToolbarSupported())
745+ GetLocationBar()->FocusLocation(select_all);
746+ }
747+
748+@@ -2546,7 +2548,7 @@
749+
750+ bool BrowserWindowGtk::UseCustomFrame() const {
751+ // We don't use the custom frame for app mode windows or app window popups.
752+- return use_custom_frame_pref_.GetValue() && !browser_->is_app();
753++ return use_custom_frame_pref_.GetValue() && !browser_->is_app() && !browser_->is_chromeless_mode();
754+ }
755+
756+ bool BrowserWindowGtk::BoundsMatchMonitorSize() {
757+Index: src/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc
758+===================================================================
759+--- src.orig/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc 2012-07-07 01:00:04.000000000 -0400
760++++ src/chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc 2012-07-11 23:49:59.232259276 -0400
761+@@ -777,9 +777,11 @@
762+ g_signal_connect(tabstrip_.get(), "drag-data-received",
763+ G_CALLBACK(OnDragDataReceivedThunk), this);
764+
765+- newtab_button_.reset(MakeNewTabButton());
766+- newtab_surface_bounds_.SetRect(0, 0, newtab_button_->SurfaceWidth(),
767+- newtab_button_->SurfaceHeight());
768++ if (window_ && window_->browser() && ! window_->browser()->is_chromeless_mode()) {
769++ newtab_button_.reset(MakeNewTabButton());
770++ newtab_surface_bounds_.SetRect(0, 0, newtab_button_->SurfaceWidth(),
771++ newtab_button_->SurfaceHeight());
772++ }
773+
774+ gtk_widget_show_all(tabstrip_.get());
775+
776+@@ -1451,6 +1453,9 @@
777+
778+ void TabStripGtk::LayoutNewTabButton(double last_tab_right,
779+ double unselected_width) {
780++ if (window_ && window_->browser() && window_->browser()->is_chromeless_mode())
781++ return;
782++
783+ GtkWidget* toplevel = gtk_widget_get_ancestor(widget(), GTK_TYPE_WINDOW);
784+ bool is_maximized = false;
785+ if (toplevel) {
786+@@ -1504,8 +1509,10 @@
787+ int available_width = tabstrip_allocation.width;
788+ if (available_width_for_tabs_ < 0) {
789+ available_width = bounds_.width();
790+- available_width -=
791++ if (newtab_button_.get() != NULL) {
792++ available_width -=
793+ (kNewTabButtonHOffset + newtab_button_->WidgetAllocation().width);
794++ }
795+ } else {
796+ // Interesting corner case: if |available_width_for_tabs_| > the result
797+ // of the calculation in the conditional arm above, the strip is in
798+@@ -2062,9 +2069,11 @@
799+ event->area.height = bounds_.height();
800+ gdk_region_union_with_rect(event->region, &event->area);
801+
802+- // Paint the New Tab button.
803+- gtk_container_propagate_expose(GTK_CONTAINER(tabstrip_.get()),
804+- newtab_button_->widget(), event);
805++ if (newtab_button_.get() != NULL) {
806++ // Paint the New Tab button.
807++ gtk_container_propagate_expose(GTK_CONTAINER(tabstrip_.get()),
808++ newtab_button_->widget(), event);
809++ }
810+
811+ // Paint the tabs in reverse order, so they stack to the left.
812+ TabGtk* selected_tab = NULL;
813+@@ -2257,6 +2266,9 @@
814+ }
815+
816+ void TabStripGtk::SetNewTabButtonBackground() {
817++ if (newtab_button_.get() == NULL) {
818++ return;
819++ }
820+ SkColor color = theme_service_->GetColor(
821+ ThemeService::COLOR_BUTTON_BACKGROUND);
822+ SkBitmap* background = theme_service_->GetBitmapNamed(
823+Index: src/chrome/browser/ui/browser.h
824+===================================================================
825+--- src.orig/chrome/browser/ui/browser.h 2012-07-07 01:00:04.000000000 -0400
826++++ src/chrome/browser/ui/browser.h 2012-07-11 23:49:59.236259276 -0400
827+@@ -194,6 +194,9 @@
828+ // window is created by this function call.
829+ static Browser* Create(Profile* profile);
830+
831++ // Like Create, but creates a chromeless browser.
832++ static Browser* CreateChromeless(Profile * profile);
833++
834+ // Like Create, but creates a browser of the specified parameters.
835+ static Browser* CreateWithParams(const CreateParams& params);
836+
837+@@ -868,6 +871,7 @@
838+ bool is_type_popup() const { return type_ == TYPE_POPUP; }
839+ bool is_type_panel() const { return type_ == TYPE_PANEL; }
840+
841++ bool is_chromeless_mode() const;
842+ bool is_app() const;
843+ bool is_devtools() const;
844+
845+@@ -1355,6 +1359,8 @@
846+ // Type of app (host or child). See description of AppType.
847+ AppType app_type_;
848+
849++ bool is_chromeless_mode_;
850++
851+ // Unique identifier of this browser for session restore. This id is only
852+ // unique within the current session, and is not guaranteed to be unique
853+ // across sessions.
854+Index: src/chrome/browser/ui/browser_init.h
855+===================================================================
856+--- src.orig/chrome/browser/ui/browser_init.h 2012-07-07 01:00:03.000000000 -0400
857++++ src/chrome/browser/ui/browser_init.h 2012-07-11 23:49:59.236259276 -0400
858+@@ -159,6 +159,11 @@
859+ FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs);
860+ FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
861+
862++ // If the process was launched with the chromeless command line flag,
863++ // e.g. --chromeless=http://www.google.com/ return true.
864++ // In this case |url| is populated if they're non-null.
865++ bool IsChromelessLaunch(std::string* url);
866++
867+ // If the process was launched with the web application command line flags,
868+ // e.g. --app=http://www.google.com/ or --app_id=... return true.
869+ // In this case |app_url| or |app_id| are populated if they're non-null.
870+Index: src/chrome/browser/ui/browser_init.cc
871+===================================================================
872+--- src.orig/chrome/browser/ui/browser_init.cc 2012-07-07 01:00:08.000000000 -0400
873++++ src/chrome/browser/ui/browser_init.cc 2012-07-11 23:49:59.236259276 -0400
874+@@ -972,6 +972,16 @@
875+ return true;
876+ }
877+
878++bool BrowserInit::LaunchWithProfile::IsChromelessLaunch(std::string* url)
879++{
880++ if (command_line_.HasSwitch(switches::kChromeless)) {
881++ if (url)
882++ *url = command_line_.GetSwitchValueASCII(switches::kChromeless);
883++ return true;
884++ }
885++ return false;
886++}
887++
888+ bool BrowserInit::LaunchWithProfile::IsAppLaunch(std::string* app_url,
889+ std::string* app_id) {
890+ if (command_line_.HasSwitch(switches::kApp)) {
891+@@ -1084,6 +1094,12 @@
892+ return;
893+ }
894+
895++ if (IsChromelessLaunch(NULL)) {
896++ // Open user-specified URLs like pinned tabs and startup tabs.
897++ if (ProcessSpecifiedURLs(urls_to_open))
898++ return;
899++ }
900++
901+ if (process_startup && ProcessStartupURLs(urls_to_open)) {
902+ // ProcessStartupURLs processed the urls, nothing else to do.
903+ return;
904+@@ -1179,7 +1195,8 @@
905+ // mode. Also, no pages should be opened automatically if the session
906+ // crashed. Otherwise it might trigger another crash, locking the user out of
907+ // chrome. The crash infobar is shown in this case.
908+- if (!IncognitoModePrefs::ShouldLaunchIncognito(command_line_,
909++ if (!IsChromelessLaunch(NULL) &&
910++ !IncognitoModePrefs::ShouldLaunchIncognito(command_line_,
911+ profile_->GetPrefs()) &&
912+ !HasPendingUncleanExit(profile_)) {
913+ tabs = PinnedTabCodec::ReadPinnedTabs(profile_);
914+@@ -1256,6 +1273,11 @@
915+ if (!profile_ && browser)
916+ profile_ = browser->profile();
917+
918++ if (IsChromelessLaunch(NULL)) {
919++ g_message("OPenTabsInBrowser: %p chromeless create", browser);
920++ browser = Browser::CreateChromeless(profile_);
921++ }
922++
923+ if (!browser || !browser->is_type_tabbed()) {
924+ browser = Browser::Create(profile_);
925+ } else {
926+@@ -1325,6 +1347,13 @@
927+ if (!browser || !profile_ || browser->tab_count() == 0)
928+ return;
929+
930++ // We consider that being in a chromeless launch, we are to minimize as much as
931++ // possible the most obvious "classic" Chromium behavior.
932++ if (IsChromelessLaunch(NULL))
933++ {
934++ return;
935++ }
936++
937+ TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper();
938+ AddCrashedInfoBarIfNecessary(browser, tab_contents);
939+
940+Index: src/chrome/browser/ui/gtk/global_menu_bar.cc
941+===================================================================
942+--- src.orig/chrome/browser/ui/gtk/global_menu_bar.cc 2012-07-07 01:00:04.000000000 -0400
943++++ src/chrome/browser/ui/gtk/global_menu_bar.cc 2012-07-11 23:49:59.236259276 -0400
944+@@ -23,35 +23,43 @@
945+ #include "ui/base/gtk/menu_label_accelerator_util.h"
946+ #include "ui/base/l10n/l10n_util.h"
947+
948++typedef bool (*GlobalMenuBarVisibilityHandler) (Browser * browser);
949++
950+ struct GlobalMenuBarCommand {
951+ int str_id;
952+ int command;
953+ int tag;
954++ GlobalMenuBarVisibilityHandler visibility_handler;
955+ };
956+
957+ namespace {
958+
959++static bool GlobalMenuBarVisibilityHandler_NotInChromelessMode(
960++ Browser * browser) {
961++ return browser && !browser->is_chromeless_mode();
962++}
963++
964+ const int MENU_SEPARATOR =-1;
965+ const int MENU_END = -2;
966+ const int MENU_DISABLED_LABEL = -3;
967+
968+ GlobalMenuBarCommand file_menu[] = {
969+- { IDS_NEW_TAB, IDC_NEW_TAB },
970+- { IDS_NEW_WINDOW, IDC_NEW_WINDOW },
971+- { IDS_NEW_INCOGNITO_WINDOW, IDC_NEW_INCOGNITO_WINDOW },
972+- { IDS_REOPEN_CLOSED_TABS_LINUX, IDC_RESTORE_TAB },
973+- { IDS_OPEN_FILE_LINUX, IDC_OPEN_FILE },
974+- { IDS_OPEN_LOCATION_LINUX, IDC_FOCUS_LOCATION },
975++ { IDS_NEW_TAB, IDC_NEW_TAB, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
976++ { IDS_NEW_WINDOW, IDC_NEW_WINDOW, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
977++ { IDS_NEW_INCOGNITO_WINDOW, IDC_NEW_INCOGNITO_WINDOW, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
978++ { IDS_REOPEN_CLOSED_TABS_LINUX, IDC_RESTORE_TAB, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
979++ { IDS_OPEN_FILE_LINUX, IDC_OPEN_FILE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
980++ { IDS_OPEN_LOCATION_LINUX, IDC_FOCUS_LOCATION, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
981+
982+- { MENU_SEPARATOR, MENU_SEPARATOR },
983++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
984+
985+- { IDS_CREATE_SHORTCUTS, IDC_CREATE_SHORTCUTS },
986++ { IDS_CREATE_SHORTCUTS, IDC_CREATE_SHORTCUTS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
987+
988+- { MENU_SEPARATOR, MENU_SEPARATOR },
989++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
990+
991+ { IDS_CLOSE_WINDOW_LINUX, IDC_CLOSE_WINDOW },
992+ { IDS_CLOSE_TAB_LINUX, IDC_CLOSE_TAB },
993+- { IDS_SAVE_PAGE, IDC_SAVE_PAGE },
994++ { IDS_SAVE_PAGE, IDC_SAVE_PAGE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
995+
996+ { MENU_SEPARATOR, MENU_SEPARATOR },
997+
998+@@ -69,17 +77,17 @@
999+
1000+ { IDS_FIND, IDC_FIND },
1001+
1002+- { MENU_SEPARATOR, MENU_SEPARATOR },
1003++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1004+
1005+- { IDS_PREFERENCES, IDC_OPTIONS },
1006++ { IDS_PREFERENCES, IDC_OPTIONS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1007+
1008+ { MENU_END, MENU_END }
1009+ };
1010+
1011+ GlobalMenuBarCommand view_menu[] = {
1012+- { IDS_SHOW_BOOKMARK_BAR, IDC_SHOW_BOOKMARK_BAR },
1013++ { IDS_SHOW_BOOKMARK_BAR, IDC_SHOW_BOOKMARK_BAR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1014+
1015+- { MENU_SEPARATOR, MENU_SEPARATOR },
1016++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1017+
1018+ { IDS_STOP_MENU_LINUX, IDC_STOP },
1019+ { IDS_RELOAD_MENU_LINUX, IDC_RELOAD },
1020+@@ -95,48 +103,48 @@
1021+ };
1022+
1023+ GlobalMenuBarCommand history_menu[] = {
1024+- { IDS_HISTORY_HOME_LINUX, IDC_HOME },
1025+- { IDS_HISTORY_BACK_LINUX, IDC_BACK },
1026+- { IDS_HISTORY_FORWARD_LINUX, IDC_FORWARD },
1027++ { IDS_HISTORY_HOME_LINUX, IDC_HOME, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1028++ { IDS_HISTORY_BACK_LINUX, IDC_BACK, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1029++ { IDS_HISTORY_FORWARD_LINUX, IDC_FORWARD, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1030+
1031+- { MENU_SEPARATOR, MENU_SEPARATOR },
1032++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1033+
1034+ { IDS_HISTORY_VISITED_LINUX, MENU_DISABLED_LABEL,
1035+- GlobalMenuBar::TAG_MOST_VISITED_HEADER },
1036++ GlobalMenuBar::TAG_MOST_VISITED_HEADER, GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1037+
1038+- { MENU_SEPARATOR, MENU_SEPARATOR },
1039++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1040+
1041+ { IDS_HISTORY_CLOSED_LINUX, MENU_DISABLED_LABEL,
1042+- GlobalMenuBar::TAG_RECENTLY_CLOSED_HEADER },
1043++ GlobalMenuBar::TAG_RECENTLY_CLOSED_HEADER, GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1044+
1045+- { MENU_SEPARATOR, MENU_SEPARATOR },
1046++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1047+
1048+- { IDS_SHOWFULLHISTORY_LINK, IDC_SHOW_HISTORY },
1049++ { IDS_SHOWFULLHISTORY_LINK, IDC_SHOW_HISTORY, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1050+
1051+ { MENU_END, MENU_END }
1052+ };
1053+
1054+ GlobalMenuBarCommand tools_menu[] = {
1055+- { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS },
1056+- { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY },
1057+- { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS },
1058++ { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1059++ { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1060++ { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1061+
1062+- { MENU_SEPARATOR, MENU_SEPARATOR },
1063++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1064+
1065+- { IDS_TASK_MANAGER, IDC_TASK_MANAGER },
1066+- { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA },
1067++ { IDS_TASK_MANAGER, IDC_TASK_MANAGER, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1068++ { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1069+
1070+- { MENU_SEPARATOR, MENU_SEPARATOR },
1071++ { MENU_SEPARATOR, MENU_SEPARATOR, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1072+
1073+- { IDS_VIEW_SOURCE, IDC_VIEW_SOURCE },
1074+- { IDS_DEV_TOOLS, IDC_DEV_TOOLS },
1075+- { IDS_DEV_TOOLS_CONSOLE, IDC_DEV_TOOLS_CONSOLE },
1076++ { IDS_VIEW_SOURCE, IDC_VIEW_SOURCE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1077++ { IDS_DEV_TOOLS, IDC_DEV_TOOLS, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1078++ { IDS_DEV_TOOLS_CONSOLE, IDC_DEV_TOOLS_CONSOLE, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1079+
1080+ { MENU_END, MENU_END }
1081+ };
1082+
1083+ GlobalMenuBarCommand help_menu[] = {
1084+- { IDS_FEEDBACK, IDC_FEEDBACK },
1085++ { IDS_FEEDBACK, IDC_FEEDBACK, int(), GlobalMenuBarVisibilityHandler_NotInChromelessMode },
1086+ { IDS_HELP_PAGE , IDC_HELP_PAGE },
1087+ { MENU_END, MENU_END }
1088+ };
1089+@@ -190,8 +198,10 @@
1090+ }
1091+
1092+ pref_change_registrar_.Init(browser_->profile()->GetPrefs());
1093+- pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
1094+- OnBookmarkBarVisibilityChanged();
1095++ if (! browser_->is_chromeless_mode()) {
1096++ pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
1097++ OnBookmarkBarVisibilityChanged();
1098++ }
1099+ }
1100+
1101+ GlobalMenuBar::~GlobalMenuBar() {
1102+@@ -214,8 +224,22 @@
1103+ std::map<int, GtkWidget*>* id_to_menu_item,
1104+ GlobalMenuBarCommand* commands,
1105+ GlobalMenuOwner* owner) {
1106++ // first pass to count the number of "visible" items
1107++ size_t count = 0;
1108++ for (int i = 0; commands[i].str_id != MENU_END; ++i) {
1109++ if (!commands[i].visibility_handler || commands[i].visibility_handler(browser_)) {
1110++ count++;
1111++ }
1112++ }
1113++ if (0 == count) {
1114++ return;
1115++ }
1116++
1117+ GtkWidget* menu = gtk_menu_new();
1118+ for (int i = 0; commands[i].str_id != MENU_END; ++i) {
1119++ if (commands[i].visibility_handler && !commands[i].visibility_handler(browser_)) {
1120++ continue;
1121++ }
1122+ GtkWidget* menu_item = BuildMenuItem(
1123+ commands[i].str_id, commands[i].command, commands[i].tag,
1124+ id_to_menu_item, menu);
1125+Index: src/chrome/browser/ui/browser.cc
1126+===================================================================
1127+--- src.orig/chrome/browser/ui/browser.cc 2012-07-07 01:00:04.000000000 -0400
1128++++ src/chrome/browser/ui/browser.cc 2012-07-12 01:02:11.796401815 -0400
1129+@@ -375,6 +375,7 @@
1130+ ALLOW_THIS_IN_INITIALIZER_LIST(
1131+ tab_strip_model_(new TabStripModel(this, profile))),
1132+ command_updater_(this),
1133++ is_chromeless_mode_(false),
1134+ app_type_(APP_TYPE_HOST),
1135+ chrome_updater_factory_(this),
1136+ is_attempting_to_close_browser_(false),
1137+@@ -538,6 +539,15 @@
1138+ }
1139+
1140+ // static
1141++Browser* Browser::CreateChromeless(Profile * profile)
1142++{
1143++ Browser* browser = new Browser(TYPE_TABBED, profile);
1144++ browser->is_chromeless_mode_ = true;
1145++ browser->InitBrowserWindow();
1146++ return browser;
1147++}
1148++
1149++// static
1150+ Browser* Browser::CreateWithParams(const CreateParams& params) {
1151+ if (!params.app_name.empty())
1152+ RegisterAppPrefs(params.app_name, params.profile);
1153+@@ -624,6 +634,10 @@
1154+ return find_bar_controller_.get() != NULL;
1155+ }
1156+
1157++bool Browser::is_chromeless_mode () const {
1158++ return is_chromeless_mode_;
1159++}
1160++
1161+ bool Browser::is_app() const {
1162+ return !app_name_.empty();
1163+ }
1164+@@ -1162,7 +1176,7 @@
1165+ #else
1166+ int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT;
1167+ // Don't append the app name to window titles on app frames and app popups
1168+- if (is_app())
1169++ if (is_app() || is_chromeless_mode())
1170+ string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT_NO_LOGO;
1171+ return l10n_util::GetStringFUTF16(string_id, title);
1172+ #endif
1173+@@ -1230,7 +1244,7 @@
1174+ tab_restore_service->BrowserClosing(tab_restore_service_delegate());
1175+ #endif
1176+
1177+- if (tab_restore_service && is_type_tabbed() && tab_count())
1178++ if (tab_restore_service && is_type_tabbed() && !is_chromeless_mode() && tab_count())
1179+ tab_restore_service->BrowserClosing(tab_restore_service_delegate());
1180+
1181+ // TODO(sky): convert session/tab restore to use notification.
1182+@@ -1683,6 +1697,9 @@
1183+ void Browser::NewTab() {
1184+ content::RecordAction(UserMetricsAction("NewTab"));
1185+
1186++ if (is_chromeless_mode())
1187++ return;
1188++
1189+ if (is_type_tabbed()) {
1190+ AddBlankTab(true);
1191+ GetSelectedWebContents()->GetView()->RestoreFocus();
1192+@@ -2962,7 +2979,8 @@
1193+
1194+ void Browser::TabRestoreServiceChanged(TabRestoreService* service) {
1195+ command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB,
1196+- !service->entries().empty());
1197++ !service->entries().empty()
1198++ && !is_chromeless_mode());
1199+ }
1200+
1201+ void Browser::TabRestoreServiceDestroyed(TabRestoreService* service) {
1202+@@ -3124,7 +3142,7 @@
1203+ void Browser::CreateHistoricalTab(TabContentsWrapper* contents) {
1204+ // We don't create historical tabs for incognito windows or windows without
1205+ // profiles.
1206+- if (!profile() || profile()->IsOffTheRecord())
1207++ if (!profile() || profile()->IsOffTheRecord() || is_chromeless_mode())
1208+ return;
1209+
1210+ // We don't create historical tabs for print preview tabs.
1211+@@ -3833,7 +3851,7 @@
1212+ const history::HistoryAddPageArgs& add_page_args,
1213+ content::NavigationType navigation_type) {
1214+ // Don't update history if running as app.
1215+- return !IsApplication();
1216++ return !IsApplication() && !is_chromeless_mode();
1217+ }
1218+
1219+ bool Browser::ShouldCreateWebContents(
1220+@@ -4377,6 +4395,8 @@
1221+ // All browser commands whose state isn't set automagically some other way
1222+ // (like Back & Forward with initial page load) must have their state
1223+ // initialized here, otherwise they will be forever disabled.
1224++ bool started_in_chromeless =
1225++ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless);
1226+
1227+ // Navigation commands
1228+ command_updater_.UpdateCommandEnabled(IDC_RELOAD, true);
1229+@@ -4384,10 +4404,10 @@
1230+
1231+ // Window management commands
1232+ command_updater_.UpdateCommandEnabled(IDC_CLOSE_WINDOW, true);
1233+- command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, true);
1234++ command_updater_.UpdateCommandEnabled(IDC_NEW_TAB, !started_in_chromeless);
1235+ command_updater_.UpdateCommandEnabled(IDC_CLOSE_TAB, true);
1236+- command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, true);
1237+- command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, false);
1238++ command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, !started_in_chromeless);
1239++ command_updater_.UpdateCommandEnabled(IDC_RESTORE_TAB, !started_in_chromeless);
1240+ command_updater_.UpdateCommandEnabled(IDC_EXIT, true);
1241+ command_updater_.UpdateCommandEnabled(IDC_DEBUG_FRAME_TOGGLE, true);
1242+
1243+@@ -4442,23 +4462,27 @@
1244+ UpdateOpenFileState();
1245+ command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false);
1246+ UpdateCommandsForDevTools();
1247+- command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true);
1248+- command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true);
1249+- command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true);
1250++ command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, !started_in_chromeless);
1251++ command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, !started_in_chromeless);
1252++ command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, !started_in_chromeless);
1253+ command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true);
1254+- command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, true);
1255++ command_updater_.UpdateCommandEnabled(IDC_BOOKMARKS_MENU, !started_in_chromeless);
1256+
1257+ #if defined(OS_CHROMEOS)
1258+ command_updater_.UpdateCommandEnabled(IDC_SHOW_KEYBOARD_OVERLAY, true);
1259+ #endif
1260+ command_updater_.UpdateCommandEnabled(
1261+- IDC_SHOW_SYNC_SETUP, profile_->GetOriginalProfile()->IsSyncAccessible());
1262++ IDC_SHOW_SYNC_SETUP,
1263++ profile_->GetOriginalProfile()->IsSyncAccessible()
1264++ && !started_in_chromeless);
1265+
1266+ // Initialize other commands based on the window type.
1267+ bool normal_window = is_type_tabbed();
1268+
1269+ // Navigation commands
1270+- command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window);
1271++ command_updater_.UpdateCommandEnabled(IDC_HOME,
1272++ normal_window
1273++ && !started_in_chromeless);
1274+
1275+ // Window management commands
1276+ // TODO(rohitrao): Disable fullscreen on non-Lion?
1277+@@ -4493,7 +4517,9 @@
1278+ command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, !is_devtools());
1279+
1280+ // Show various bits of UI
1281+- command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, normal_window);
1282++ command_updater_.UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA,
1283++ normal_window &&
1284++ !started_in_chromeless);
1285+
1286+ // The upgrade entry and the view incompatibility entry should always be
1287+ // enabled. Whether they are visible is a separate matter determined on menu
1288+@@ -4519,14 +4545,20 @@
1289+ }
1290+
1291+ void Browser::UpdateCommandsForIncognitoAvailability() {
1292++ bool started_in_chromeless =
1293++ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)
1294++ || is_chromeless_mode();
1295++
1296+ IncognitoModePrefs::Availability incognito_availability =
1297+ IncognitoModePrefs::GetAvailability(profile_->GetPrefs());
1298+ command_updater_.UpdateCommandEnabled(
1299+ IDC_NEW_WINDOW,
1300+- incognito_availability != IncognitoModePrefs::FORCED);
1301++ incognito_availability != IncognitoModePrefs::FORCED &&
1302++ !started_in_chromeless);
1303+ command_updater_.UpdateCommandEnabled(
1304+ IDC_NEW_INCOGNITO_WINDOW,
1305+- incognito_availability != IncognitoModePrefs::DISABLED);
1306++ incognito_availability != IncognitoModePrefs::DISABLED &&
1307++ !started_in_chromeless);
1308+
1309+ // Bookmark manager and settings page/subpages are forced to open in normal
1310+ // mode. For this reason we disable these commands when incognito is forced.
1311+@@ -4534,18 +4566,22 @@
1312+ incognito_availability != IncognitoModePrefs::FORCED;
1313+ command_updater_.UpdateCommandEnabled(
1314+ IDC_SHOW_BOOKMARK_MANAGER,
1315+- browser_defaults::bookmarks_enabled && command_enabled);
1316++ browser_defaults::bookmarks_enabled &&
1317++ command_enabled && !started_in_chromeless);
1318+ ExtensionService* extension_service = profile()->GetExtensionService();
1319+ bool enable_extensions =
1320+ extension_service && extension_service->extensions_enabled();
1321+ command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS,
1322+- enable_extensions && command_enabled);
1323++ enable_extensions && command_enabled
1324++ && !started_in_chromeless);
1325+
1326+ const bool show_main_ui = IsShowingMainUI(window_ && window_->IsFullscreen());
1327+ command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS,
1328+- show_main_ui && command_enabled);
1329++ show_main_ui && command_enabled
1330++ && !started_in_chromeless);
1331+ command_updater_.UpdateCommandEnabled(IDC_OPTIONS,
1332+- show_main_ui && command_enabled);
1333++ show_main_ui && command_enabled
1334++ && !started_in_chromeless);
1335+ }
1336+
1337+ void Browser::UpdateCommandsForTabState() {
1338+@@ -4565,16 +4601,19 @@
1339+
1340+ // Window management commands
1341+ command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
1342+- !is_app() && CanDuplicateContentsAt(active_index()));
1343++ !is_chromeless_mode() && !is_app()
1344++ && CanDuplicateContentsAt(active_index()));
1345+
1346+ // Page-related commands
1347+ window_->SetStarredState(
1348+ current_tab_wrapper->bookmark_tab_helper()->is_starred());
1349+ command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
1350+- current_tab->GetController().CanViewSource());
1351++ current_tab->GetController().CanViewSource()
1352++ && !is_chromeless_mode());
1353+ command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION,
1354+- toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid());
1355+- if (is_devtools())
1356++ toolbar_model_->ShouldDisplayURL() && current_tab->GetURL().is_valid()
1357++ && !is_chromeless_mode());
1358++ if (is_devtools() || is_chromeless_mode())
1359+ command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, false);
1360+
1361+ // Changing the encoding is not possible on Chrome-internal webpages.
1362+@@ -4588,7 +4627,8 @@
1363+ // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148
1364+ #if !defined(OS_MACOSX)
1365+ command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS,
1366+- web_app::IsValidUrl(current_tab->GetURL()));
1367++ web_app::IsValidUrl(current_tab->GetURL())
1368++ && !is_chromeless_mode());
1369+ #endif
1370+
1371+ UpdateCommandsForContentRestrictionState();
1372+@@ -4620,9 +4660,14 @@
1373+ }
1374+
1375+ void Browser::UpdateCommandsForBookmarkEditing() {
1376++ bool started_in_chromeless =
1377++ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)
1378++ || is_chromeless_mode();
1379++
1380+ bool enabled =
1381+ profile_->GetPrefs()->GetBoolean(prefs::kEditBookmarksEnabled) &&
1382+- browser_defaults::bookmarks_enabled;
1383++ browser_defaults::bookmarks_enabled &&
1384++ !started_in_chromeless;
1385+
1386+ command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE,
1387+ enabled && is_type_tabbed());
1388+@@ -4748,7 +4793,12 @@
1389+ if (local_state)
1390+ enabled = local_state->GetBoolean(prefs::kAllowFileSelectionDialogs);
1391+
1392+- command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, enabled);
1393++ bool started_in_chromeless =
1394++ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)
1395++ || is_chromeless_mode();
1396++
1397++ command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE,
1398++ enabled && !started_in_chromeless);
1399+ }
1400+
1401+ void Browser::UpdateReloadStopState(bool is_loading, bool force) {
1402+@@ -4863,7 +4913,8 @@
1403+ // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148
1404+ #if !defined(OS_MACOSX)
1405+ command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS,
1406+- web_app::IsValidUrl(contents->GetURL()));
1407++ web_app::IsValidUrl(contents->GetURL())
1408++ && !is_chromeless_mode());
1409+ #endif
1410+ window_->UpdateTitleBar();
1411+ }
1412+@@ -5211,20 +5262,20 @@
1413+
1414+ unsigned int features = FEATURE_INFOBAR | FEATURE_DOWNLOADSHELF;
1415+
1416+- if (is_type_tabbed())
1417++ if (is_type_tabbed() && !is_chromeless_mode())
1418+ features |= FEATURE_BOOKMARKBAR;
1419+
1420+ if (!hide_ui_for_fullscreen) {
1421+- if (!is_type_tabbed())
1422++ if (!is_type_tabbed() && !is_chromeless_mode())
1423+ features |= FEATURE_TITLEBAR;
1424+
1425+ if (is_type_tabbed())
1426+ features |= FEATURE_TABSTRIP;
1427+
1428+- if (is_type_tabbed())
1429++ if (is_type_tabbed() && !is_chromeless_mode())
1430+ features |= FEATURE_TOOLBAR;
1431+
1432+- if (!is_app())
1433++ if (!is_app() && !is_chromeless_mode())
1434+ features |= FEATURE_LOCATIONBAR;
1435+ }
1436+ return !!(features & feature);
1437+Index: src/chrome/browser/extensions/extension_module.h
1438+===================================================================
1439+--- src.orig/chrome/browser/extensions/extension_module.h 2012-07-07 00:59:55.000000000 -0400
1440++++ src/chrome/browser/extensions/extension_module.h 2012-07-11 23:49:59.240259276 -0400
1441+@@ -46,4 +46,10 @@
1442+ virtual bool RunImpl() OVERRIDE;
1443+ };
1444+
1445++class IsChromelessWindowFunction : public SyncExtensionFunction {
1446++ protected:
1447++ virtual bool RunImpl() OVERRIDE;
1448++ DECLARE_EXTENSION_FUNCTION_NAME("extension.isChromelessWindow");
1449++};
1450++
1451+ #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MODULE_H__
1452+Index: src/chrome/browser/extensions/extension_module.cc
1453+===================================================================
1454+--- src.orig/chrome/browser/extensions/extension_module.cc 2012-07-07 00:59:55.000000000 -0400
1455++++ src/chrome/browser/extensions/extension_module.cc 2012-07-11 23:49:59.240259276 -0400
1456+@@ -6,9 +6,27 @@
1457+
1458+ #include <string>
1459+
1460++#if defined(OS_LINUX) && defined(TOOLKIT_GTK)
1461++#include <gdk/gdk.h>
1462++#include <gdk/gdkx.h>
1463++#endif
1464++
1465+ #include "chrome/browser/extensions/extension_prefs.h"
1466+ #include "chrome/browser/extensions/extension_service.h"
1467++#include "chrome/browser/ui/browser.h"
1468++#include "chrome/browser/ui/browser_window.h"
1469+ #include "chrome/browser/profiles/profile.h"
1470++#include "chrome/common/chrome_switches.h"
1471++
1472++#if defined(OS_LINUX) && defined(TOOLKIT_GTK)
1473++
1474++namespace {
1475++
1476++const char kNoCurrentWindowError[] = "No current window";
1477++
1478++} // namespace {
1479++
1480++#endif
1481+
1482+ ExtensionPrefs* SetUpdateUrlDataFunction::extension_prefs() {
1483+ return profile()->GetExtensionService()->extension_prefs();
1484+@@ -39,3 +57,18 @@
1485+ ext_service->AllowFileAccess(extension)));
1486+ return true;
1487+ }
1488++
1489++bool IsChromelessWindowFunction::RunImpl() {
1490++ Browser* browser = GetCurrentBrowser();
1491++ if (!browser || !browser->window() || !browser->window()->GetNativeHandle()) {
1492++ error_ = kNoCurrentWindowError;
1493++ return false;
1494++ }
1495++ // TODO: quite brittle, what about tab moves/undock?
1496++ // rather rely on proper browser_window type.
1497++ // TODO: should be run on a specific thread?
1498++ const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
1499++ result_.reset(Value::CreateBooleanValue(
1500++ browser_command_line.HasSwitch(switches::kChromeless)));
1501++ return true;
1502++}
1503+Index: src/chrome/common/extensions/api/extension.json
1504+===================================================================
1505+--- src.orig/chrome/common/extensions/api/extension.json 2012-07-07 01:01:17.000000000 -0400
1506++++ src/chrome/common/extensions/api/extension.json 2012-07-11 23:49:59.240259276 -0400
1507+@@ -205,6 +205,24 @@
1508+ }
1509+ },
1510+ {
1511++ "name": "isChromelessWindow",
1512++ "type": "function",
1513++ "description": "Checks is a given extension runs part of a chromeless window.",
1514++ "parameters": [
1515++ {
1516++ "type": "function",
1517++ "name": "callback",
1518++ "parameters": [
1519++ {
1520++ "name": "isChromelessWindow",
1521++ "type": "boolean",
1522++ "description": "True if the extension runs part of a chromeless window, false otherwise."
1523++ }
1524++ ]
1525++ }
1526++ ]
1527++ },
1528++ {
1529+ "name": "isAllowedIncognitoAccess",
1530+ "type": "function",
1531+ "description": "Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.",
1532+Index: src/chrome/common/chrome_switches.h
1533+===================================================================
1534+--- src.orig/chrome/common/chrome_switches.h 2012-07-07 01:01:17.000000000 -0400
1535++++ src/chrome/common/chrome_switches.h 2012-07-11 23:49:59.244259276 -0400
1536+@@ -53,6 +53,7 @@
1537+ extern const char kCheckForUpdateIntervalSec[];
1538+ extern const char kCheckCloudPrintConnectorPolicy[];
1539+ extern const char kChromeFrameShutdownDelay[];
1540++extern const char kChromeless[];
1541+ extern const char kChromeVersion[];
1542+ extern const char kCipherSuiteBlacklist[];
1543+ extern const char kClearTokenService[];
1544+Index: src/chrome/common/chrome_switches.cc
1545+===================================================================
1546+--- src.orig/chrome/common/chrome_switches.cc 2012-07-07 01:01:18.000000000 -0400
1547++++ src/chrome/common/chrome_switches.cc 2012-07-11 23:49:59.244259276 -0400
1548+@@ -138,6 +138,9 @@
1549+ // Chrome Frame automation channel is closed.
1550+ const char kChromeFrameShutdownDelay[] = "chrome-frame-shutdown-delay";
1551+
1552++// Specifies a given URL to be opened in a chromeless mode.
1553++const char kChromeless[] = "chromeless";
1554++
1555+ // Tells chrome to load the specified version of chrome.dll on Windows. If this
1556+ // version cannot be loaded, Chrome will exit.
1557+ const char kChromeVersion[] = "chrome-version";
1558+alex@alex-Gazelle-Professional:~/dev/work/chromium/r20.0.1132.47/src$ svn diff chrome/browser/sessions/session_service.cc
1559+Index: chrome/browser/sessions/session_service.cc
1560+===================================================================
1561+--- src.orig/chrome/browser/sessions/session_service.cc (revision 136242)
1562++++ src/chrome/browser/sessions/session_service.cc (working copy)
1563+@@ -32,6 +32,7 @@
1564+ #include "chrome/browser/ui/browser_window.h"
1565+ #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
1566+ #include "chrome/common/chrome_notification_types.h"
1567++#include "chrome/common/chrome_switches.h"
1568+ #include "chrome/common/extensions/extension.h"
1569+ #include "content/public/browser/navigation_details.h"
1570+ #include "content/public/browser/navigation_entry.h"
1571+@@ -579,6 +580,14 @@
1572+ if (browser->profile() != profile() ||
1573+ !should_track_changes_for_browser_type(browser->type(), app_type))
1574+ return;
1575++
1576++ // Do not track changes for chromeless windows so that
1577++ // it won't be considered for restoration during a 'normal' browser
1578++ // instance.
1579++ if (browser->is_chromeless_mode() ||
1580++ CommandLine::ForCurrentProcess()->HasSwitch(switches::kChromeless)) {
1581++ return;
1582++ }
1583+
1584+ RestoreIfNecessary(std::vector<GURL>(), browser);
1585+ SetWindowType(browser->session_id(), browser->type(), app_type);
1586
1587=== added file 'debian/patches/desktop-integration-settings.patch'
1588--- debian/patches/desktop-integration-settings.patch 1970-01-01 00:00:00 +0000
1589+++ debian/patches/desktop-integration-settings.patch 2012-08-06 17:52:22 +0000
1590@@ -0,0 +1,1031 @@
1591+Index: src/chrome/chrome_browser.gypi
1592+===================================================================
1593+--- src.orig/chrome/chrome_browser.gypi 2012-07-31 14:30:37.000000000 -0400
1594++++ src/chrome/chrome_browser.gypi 2012-07-31 14:34:57.786804291 -0400
1595+@@ -3803,6 +3803,8 @@
1596+ 'browser/ui/webui/options2/cookies_view_handler2.h',
1597+ 'browser/ui/webui/options2/core_options_handler2.cc',
1598+ 'browser/ui/webui/options2/core_options_handler2.h',
1599++ 'browser/ui/webui/options2/desktop_integration_settings_handler2.cc',
1600++ 'browser/ui/webui/options2/desktop_integration_settings_handler2.h',
1601+ 'browser/ui/webui/options2/font_settings_handler2.cc',
1602+ 'browser/ui/webui/options2/font_settings_handler2.h',
1603+ 'browser/ui/webui/options2/font_settings_utils2.h',
1604+Index: src/chrome/app/generated_resources.grd
1605+===================================================================
1606+--- src.orig/chrome/app/generated_resources.grd 2012-07-31 14:30:37.000000000 -0400
1607++++ src/chrome/app/generated_resources.grd 2012-07-31 14:34:57.794804290 -0400
1608+@@ -10402,6 +10402,9 @@
1609+ <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT">
1610+ Web content
1611+ </message>
1612++ <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_INTEGRATION">
1613++ Desktop Integration
1614++ </message>
1615+ <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY">
1616+ HTTPS/SSL
1617+ </message>
1618+@@ -16033,6 +16036,35 @@
1619+ </message>
1620+ </if>
1621+
1622++ <!-- Desktop integration -->
1623++ <message name="IDS_PROMPT_INTEGRATION_ENABLE_BUTTON_LABEL" desc="The text to be displayed on the checkbox that enables desktop integration.">
1624++ Prompt integration options for any website
1625++ </message>
1626++ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_EXCEPTIONS_BUTTON_LABEL" desc="The text to be displayed on the button that drives integration exceptions.">
1627++ Exceptions...
1628++ </message>
1629++ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_TITLE" desc="Title for the desktop integration overlay.">
1630++ Integration prompt exceptions
1631++ </message>
1632++ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_DESCRIPTION" desc="Description for the desktop integration overlay.">
1633++ These websites won't prompt any integration options
1634++ </message>
1635++ <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_COLUMN_DESCRIPTION" desc="Description of the desktop integration overlay's integrated websites list column.">
1636++ Website domains
1637++ </message>
1638++ <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_BUTTON"
1639++ desc="The label for the add button for adding a integration websites">
1640++ Add
1641++ </message>
1642++ <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TEXT"
1643++ desc="The description text for the add overlay for adding a integration websites">
1644++ Website domain name (e.g. www.html5rocks.com)
1645++ </message>
1646++ <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TITLE"
1647++ desc="Title for add overlay for adding a integration websites">
1648++ Add Integrated Website
1649++ </message>
1650++
1651+ <!-- Manage Profile Dialog -->
1652+ <message name="IDS_PROFILES_MANAGE_TITLE" desc="Title of the manage profile dialog">
1653+ Edit user
1654+Index: src/chrome/browser/resources/options2/options.html
1655+===================================================================
1656+--- src.orig/chrome/browser/resources/options2/options.html 2012-07-31 14:30:37.000000000 -0400
1657++++ src/chrome/browser/resources/options2/options.html 2012-07-31 14:35:18.746804981 -0400
1658+@@ -19,6 +19,7 @@
1659+ <link rel="stylesheet" href="clear_browser_data_overlay.css">
1660+ <link rel="stylesheet" href="content_settings.css">
1661+ <link rel="stylesheet" href="cookies_view.css">
1662++<link rel="stylesheet" href="desktop_integration_overlay.css">
1663+ <link rel="stylesheet" href="font_settings.css">
1664+ <if expr="pp_ifdef('enable_register_protocol_handler')">
1665+ <link rel="stylesheet" href="handler_options.css">
1666+@@ -87,6 +88,7 @@
1667+ <include src="font_settings.html">
1668+ <include src="home_page_overlay.html">
1669+ <include src="import_data_overlay.html">
1670++ <include src="desktop_integration_overlay.html">
1671+ <include src="instant_confirm_overlay.html">
1672+ <include src="language_options.html">
1673+ <include src="manage_profile_overlay.html">
1674+@@ -117,6 +119,7 @@
1675+ <include src="autofill_edit_creditcard_overlay.html">
1676+ <include src="content_settings_exceptions_area.html">
1677+ <include src="cookies_view.html">
1678++ <include src="desktop_integration_add_website_overlay.html">
1679+ <include src="language_add_language_overlay.html">
1680+ <if expr="pp_ifdef('chromeos')">
1681+ <include src="chromeos/internet_detail.html">
1682+Index: src/chrome/browser/resources/options2/options.js
1683+===================================================================
1684+--- src.orig/chrome/browser/resources/options2/options.js 2012-07-31 14:30:37.000000000 -0400
1685++++ src/chrome/browser/resources/options2/options.js 2012-07-31 14:34:57.794804290 -0400
1686+@@ -13,6 +13,8 @@
1687+ var ContentSettingsExceptionsArea =
1688+ options.contentSettings.ContentSettingsExceptionsArea;
1689+ var CookiesView = options.CookiesView;
1690++var DesktopIntegrationOverlay = options.DesktopIntegrationOverlay;
1691++var AddDesktopIntegrationWebsiteOverlay = options.AddDesktopIntegrationWebsiteOverlay;
1692+ var FontSettings = options.FontSettings;
1693+ var HandlerOptions = options.HandlerOptions;
1694+ var HomePageOverlay = options.HomePageOverlay;
1695+@@ -84,6 +86,13 @@
1696+ OptionsPage.registerOverlay(FontSettings.getInstance(),
1697+ BrowserOptions.getInstance(),
1698+ [$('fontSettingsCustomizeFontsButton')]);
1699++ if (cr.isLinux && !cr.isChromeos) {
1700++ OptionsPage.registerOverlay(AddDesktopIntegrationWebsiteOverlay.getInstance(),
1701++ DesktopIntegrationOverlay.getInstance());
1702++ OptionsPage.registerOverlay(DesktopIntegrationOverlay.getInstance(),
1703++ BrowserOptions.getInstance(),
1704++ [$('desktop-integration-button')]);
1705++ }
1706+ if (HandlerOptions && $('manage-handlers-button')) {
1707+ OptionsPage.registerOverlay(HandlerOptions.getInstance(),
1708+ ContentSettings.getInstance(),
1709+Index: src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.html
1710+===================================================================
1711+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1712++++ src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.html 2012-07-31 14:34:57.794804290 -0400
1713+@@ -0,0 +1,16 @@
1714++<div id="add-desktop-integration-website-overlay-page" class="page" hidden>
1715++ <div class="close-button"></div>
1716++ <h1 i18n-content="add_desktop_website_title"></h1>
1717++
1718++ <div class="content-area">
1719++ <span i18n-content="add_desktop_website_input_label"></span>
1720++ <input id="website-url-field" type="url" data-type="url"
1721++ class="weakrtl favicon-cell hbox stretch">
1722++ </div>
1723++
1724++ <div class="action-area button-strip">
1725++ <button id="add-integration-website-overlay-cancel-button" i18n-content="cancel">
1726++ </button>
1727++ <button id="add-integration-website-overlay-ok-button" i18n-content="ok"></button>
1728++ </div>
1729++</div>
1730+Index: src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.js
1731+===================================================================
1732+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1733++++ src/chrome/browser/resources/options2/desktop_integration_add_website_overlay.js 2012-07-31 14:34:57.794804290 -0400
1734+@@ -0,0 +1,44 @@
1735++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
1736++// Use of this source code is governed by a BSD-style license that can be
1737++// found in the LICENSE file.
1738++
1739++///////////////////////////////////////////////////////////////////////////////
1740++// AddDesktopIntegrationWebsiteOverlay class:
1741++
1742++cr.define('options', function() {
1743++ /** @const */ var OptionsPage = options.OptionsPage;
1744++
1745++ /**
1746++ * @constructor
1747++ */
1748++ function AddDesktopIntegrationWebsiteOverlay() {
1749++ OptionsPage.call(this, 'addDesktopIntegrationWebsite',
1750++ localStrings.getString('add_button'),
1751++ 'add-desktop-integration-website-overlay-page');
1752++ }
1753++
1754++ cr.addSingletonGetter(AddDesktopIntegrationWebsiteOverlay);
1755++
1756++ AddDesktopIntegrationWebsiteOverlay.prototype = {
1757++ // Inherit AddDesktopIntegrationWebsiteOverlay from OptionsPage.
1758++ __proto__: OptionsPage.prototype,
1759++
1760++ /**
1761++ * Initializes AddDesktopIntegrationWebsiteOverlay page.
1762++ * Calls base class implementation to starts preference initialization.
1763++ */
1764++ initializePage: function() {
1765++ // Call base class implementation to starts preference initialization.
1766++ OptionsPage.prototype.initializePage.call(this);
1767++
1768++ // Set up the cancel button.
1769++ $('add-integration-website-overlay-cancel-button').onclick = function(e) {
1770++ OptionsPage.closeOverlay();
1771++ };
1772++ },
1773++ };
1774++
1775++ return {
1776++ AddDesktopIntegrationWebsiteOverlay: AddDesktopIntegrationWebsiteOverlay
1777++ };
1778++});
1779+Index: src/chrome/browser/resources/options2/options_bundle.js
1780+===================================================================
1781+--- src.orig/chrome/browser/resources/options2/options_bundle.js 2012-07-31 14:30:37.000000000 -0400
1782++++ src/chrome/browser/resources/options2/options_bundle.js 2012-07-31 14:34:57.794804290 -0400
1783+@@ -72,6 +72,8 @@
1784+ <include src="content_settings_ui.js"></include>
1785+ <include src="cookies_list.js"></include>
1786+ <include src="cookies_view.js"></include>
1787++<include src="desktop_integration_add_website_overlay.js"></include>
1788++<include src="desktop_integration_overlay.js"></include>
1789+ <include src="font_settings.js"></include>
1790+ <if expr="pp_ifdef('enable_register_protocol_handler')">
1791+ <include src="handler_options.js"></include>
1792+Index: src/chrome/browser/resources/options2/browser_options.html
1793+===================================================================
1794+--- src.orig/chrome/browser/resources/options2/browser_options.html 2012-07-31 14:30:37.000000000 -0400
1795++++ src/chrome/browser/resources/options2/browser_options.html 2012-07-31 14:34:57.794804290 -0400
1796+@@ -37,7 +37,7 @@
1797+ <if expr="not pp_ifdef('toolkit_views') and is_posix and not is_macosx">
1798+ <button id="themes-gallery" i18n-content="themesGallery"></button>
1799+ <button id="themes-GTK-button"
1800+- i18n-content="themesGTKButton"></button>
1801++ i18n-content="themesGTKButton"></button>
1802+ <button id="themes-reset"
1803+ i18n-content="themesSetClassic"></button>
1804+ </if>
1805+@@ -356,6 +356,22 @@
1806+ </if>
1807+ </div>
1808+ </section>
1809++
1810++<if expr="is_linux and not pp_ifdef('chromeos')">
1811++ <section id="desktop-integration-section">
1812++ <h3 i18n-content="advancedSectionTitleIntegration"></h3>
1813++ <div class="checkbox">
1814++ <label>
1815++ <input id="promptIntegrationForAnyWebsite" pref="desktop_integration_prompt.enabled"
1816++ metric="Options_PromptIntegration" type="checkbox">
1817++ <span i18n-content="promptIntegrationEnableIntegration"></span>
1818++ </label>
1819++ </div>
1820++ <button id="desktop-integration-button"
1821++ i18n-content="desktopIntegrationExceptionsSettingsButton"></button>
1822++ </section>
1823++</if>
1824++
1825+ <if expr="not pp_ifdef('chromeos')">
1826+ <section>
1827+ <h3 i18n-content="advancedSectionTitleNetwork"></h3>
1828+Index: src/chrome/browser/resources/options2/desktop_integration_overlay.html
1829+===================================================================
1830+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1831++++ src/chrome/browser/resources/options2/desktop_integration_overlay.html 2012-07-31 14:34:57.798804289 -0400
1832+@@ -0,0 +1,31 @@
1833++<div id="desktop-integration-area" class="page" hidden>
1834++
1835++ <div class="close-button"></div>
1836++ <h1 i18n-content="desktopIntegrationPage"></h1>
1837++
1838++ <span i18n-content="desktopIntegrationInfoText"></span>
1839++
1840++ <div id="desktop-integration-column-headers">
1841++ <div id="desktop-integration-description-column" i18n-content="desktopIntegrationColumnDescription">
1842++ </div>
1843++ </div>
1844++
1845++ <div class="content-area">
1846++ <list id="domains-list"></list>
1847++
1848++ <div class="desktop-integration-lower-left">
1849++ <button id="desktop-integration-add-button"
1850++ i18n-content="add_button"></button>
1851++ </div>
1852++ </div>
1853++
1854++ <div class="action-area">
1855++ <div class="button-strip">
1856++ <button id="desktop-integrations-overlay-confirm"
1857++ i18n-content="ok">
1858++ </button>
1859++ </div>
1860++ </div>
1861++
1862++</div>
1863++
1864+Index: src/chrome/browser/resources/options2/desktop_integration_overlay.js
1865+===================================================================
1866+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1867++++ src/chrome/browser/resources/options2/desktop_integration_overlay.js 2012-07-31 14:34:57.798804289 -0400
1868+@@ -0,0 +1,201 @@
1869++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
1870++// Use of this source code is governed by a BSD-style license that can be
1871++// found in the LICENSE file.
1872++
1873++cr.define('options', function() {
1874++ /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
1875++ /** @const */ var DeletableItemList = options.DeletableItemList;
1876++ /** @const */ var DeletableItem = options.DeletableItem;
1877++
1878++ /**
1879++ * Creates a new exceptions list item.
1880++ * @constructor
1881++ * @extends {options.DeletableItem}
1882++ */
1883++ function IntegratedWebsitesListItem(domain) {
1884++ var el = cr.doc.createElement('div');
1885++ el.__proto__ = IntegratedWebsitesListItem.prototype;
1886++ el.domain = domain;
1887++ el.decorate();
1888++ return el;
1889++ }
1890++
1891++ IntegratedWebsitesListItem.prototype = {
1892++ __proto__: DeletableItem.prototype,
1893++
1894++ /**
1895++ * Called when an element is decorated as a list item.
1896++ */
1897++ decorate: function() {
1898++ DeletableItem.prototype.decorate.call(this);
1899++
1900++ // The stored label.
1901++ var label = this.ownerDocument.createElement('div');
1902++ label.className = 'domain-name';
1903++ label.textContent = this.domain;
1904++ this.contentElement.appendChild(label);
1905++
1906++ this.deletable = true;
1907++ },
1908++ };
1909++
1910++ /**
1911++ * Creates a integrated websites list.
1912++ * @constructor
1913++ * @extends {cr.ui.List}
1914++ */
1915++ var IntegratedWebsitesList = cr.ui.define('list');
1916++
1917++ IntegratedWebsitesList.prototype = {
1918++ __proto__: DeletableItemList.prototype,
1919++
1920++ /**
1921++ * Called when an element is decorated as a list.
1922++ */
1923++ decorate: function() {
1924++ DeletableItemList.prototype.decorate.call(this);
1925++ this.reset();
1926++ },
1927++
1928++ /** @inheritDoc */
1929++ createItem: function(domain) {
1930++ return new IntegratedWebsitesListItem(domain);
1931++ },
1932++
1933++ /*
1934++ * Adds a website domain name to the list of allowed integrated websites.
1935++ * @param {string} domain domain name of the website to add.
1936++ */
1937++ addWebsite: function(domain) {
1938++ if (!domain || this.dataModel.indexOf(domain) >= 0) {
1939++ return;
1940++ }
1941++ this.dataModel.push(url);
1942++ this.redraw();
1943++ chrome.send('addIntegrationSite', [domain]);
1944++ },
1945++
1946++ /**
1947++ * Forces a revailidation of the list content. Content added while the list
1948++ * is hidden is not properly rendered when the list becomes visible. In
1949++ * addition, deleting a single item from the list results in a stale cache
1950++ * requiring an invalidation.
1951++ */
1952++ refresh: function() {
1953++ // TODO(kevers): Investigate if the root source of the problems can be
1954++ // fixed in cr.ui.list.
1955++ this.invalidate();
1956++ this.redraw();
1957++ },
1958++
1959++ /**
1960++ * Sets the integrated websites in the js model.
1961++ * @param {Object} entries A list of dictionaries of values, each dictionary
1962++ * represents an exception.
1963++ */
1964++ setIntegratedWebsites: function(entries) {
1965++ var integratedWebsites = null;
1966++ try {
1967++ integratedWebsites = JSON.parse(entries);
1968++ } catch(e) {
1969++ console.log("Error while parsing integrated websites json: " + entries);
1970++ return;
1971++ }
1972++ // TODO hightlight domains differently based on permission
1973++ var domains = [];
1974++ domains = domains.concat(integratedWebsites['allowed']);
1975++ domains = domains.concat(integratedWebsites['dontask']);
1976++ this.dataModel = new ArrayDataModel(domains);
1977++ this.refresh();
1978++ },
1979++
1980++ /**
1981++ * Removes all integration scripts from the js model.
1982++ */
1983++ reset: function() {
1984++ this.dataModel = new ArrayDataModel([]);
1985++ },
1986++
1987++ /** @inheritDoc */
1988++ deleteItemAtIndex: function(index) {
1989++ if (index >= 0) {
1990++ var args = [this.dataModel.item(index)];
1991++ chrome.send('removeIntegrationSite', args);
1992++ this.dataModel.splice(index, 1);
1993++ }
1994++ },
1995++
1996++ /**
1997++ * The length of the list.
1998++ */
1999++ get length() {
2000++ return null != this.dataModel ? this.dataModel.length : 0;
2001++ },
2002++ };
2003++
2004++ var OptionsPage = options.OptionsPage;
2005++
2006++ /**
2007++ * DesktopIntegrationOverlay class
2008++ * Encapsulated handling of the 'Desktop integration' page.
2009++ * @class
2010++ */
2011++ function DesktopIntegrationOverlay() {
2012++ OptionsPage.call(this, 'desktopIntegrationOverlay',
2013++ templateData.desktopIntegrationPage,
2014++ 'desktop-integration-area');
2015++ }
2016++
2017++ cr.addSingletonGetter(DesktopIntegrationOverlay);
2018++
2019++ DesktopIntegrationOverlay.prototype = {
2020++ __proto__: OptionsPage.prototype,
2021++
2022++ /**
2023++ * Initialize the page.
2024++ */
2025++ initializePage: function() {
2026++ OptionsPage.prototype.initializePage.call(this);
2027++
2028++ var integrationList = $('domains-list');
2029++ IntegratedWebsitesList.decorate(integrationList);
2030++ $('desktop-integrations-overlay-confirm').onclick =
2031++ OptionsPage.closeOverlay.bind(OptionsPage);
2032++
2033++ // Set up add button.
2034++ $('desktop-integration-add-button').onclick = function(e) {
2035++ OptionsPage.navigateToPage('addDesktopIntegrationWebsite');
2036++ };
2037++
2038++ // Listen to add website dialog ok button.
2039++ var addWebsiteOkButton = $('add-integration-website-overlay-ok-button');
2040++ addWebsiteOkButton.addEventListener('click',
2041++ this.handleAddWebsiteOkButtonClick_.bind(this));
2042++ },
2043++
2044++ handleAddWebsiteOkButtonClick_: function () {
2045++ var website = $('website-url-field').value;
2046++ $('domains-list').addWebsite(String(website));
2047++ OptionsPage.closeOverlay();
2048++ },
2049++
2050++ /**
2051++ * Called by the options page when this page has been shown.
2052++ */
2053++ didShowPage: function() {
2054++ chrome.send('updateIntegratedWebsitesList');
2055++ },
2056++ };
2057++
2058++ DesktopIntegrationOverlay.setIntegratedWebsites = function(entries) {
2059++ $('domains-list').setIntegratedWebsites(entries);
2060++ };
2061++
2062++ // Export
2063++ return {
2064++ IntegratedWebsitesListItem: IntegratedWebsitesListItem,
2065++ IntegratedWebsitesList: IntegratedWebsitesList,
2066++ DesktopIntegrationOverlay: DesktopIntegrationOverlay
2067++ };
2068++});
2069++
2070+Index: src/chrome/browser/resources/options2/desktop_integration_overlay.css
2071+===================================================================
2072+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2073++++ src/chrome/browser/resources/options2/desktop_integration_overlay.css 2012-07-31 14:34:57.798804289 -0400
2074+@@ -0,0 +1,71 @@
2075++/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2076++ * Use of this source code is governed by a BSD-style license that can be
2077++ * found in the LICENSE file. */
2078++
2079++#desktop-integration-options {
2080++ min-width: 550px;
2081++}
2082++
2083++#desktop-integration-options list {
2084++ min-height: 172px;
2085++}
2086++
2087++.desktop-integration-list-item {
2088++ -webkit-box-flex: 1;
2089++ -webkit-padding-start: 8px;
2090++ overflow: hidden;
2091++ text-overflow: ellipsis;
2092++}
2093++
2094++.desktop-integration-lower-left button {
2095++ min-width: 70px;
2096++}
2097++
2098++.desktop-integration-lower-left {
2099++ -webkit-box-flex: 0;
2100++ -webkit-padding-start: 12px;
2101++ padding-bottom: 10px;
2102++}
2103++
2104++#desktop-integration-column-headers {
2105++ -webkit-margin-start: 17px;
2106++ display: -webkit-box;
2107++ margin-top: 17px;
2108++}
2109++
2110++#desktop-integration-column-headers > div {
2111++ font-weight: bold;
2112++}
2113++
2114++#desktop-integration-pattern-column {
2115++ -webkit-box-flex: 1;
2116++}
2117++
2118++#desktop-integration-behavior-column {
2119++ width: 145px;
2120++}
2121++
2122++#desktop-integration-area list {
2123++ margin-bottom: 10px;
2124++ margin-top: 4px;
2125++}
2126++
2127++#domains-list {
2128++ -webkit-box-flex: 1;
2129++ outline: none;
2130++ padding: 1px 0 0;
2131++ width: 100%;
2132++}
2133++
2134++#domains-list .domain-name {
2135++ -webkit-box-flex: 1;
2136++ overflow: hidden;
2137++ text-overflow: ellipsis;
2138++ white-space: nowrap;
2139++}
2140++
2141++#domains-list li {
2142++ -webkit-padding-start: 12px;
2143++ padding-bottom: 2px;
2144++ padding-top: 2px;
2145++}
2146+Index: src/chrome/browser/resources/options2/browser_options.js
2147+===================================================================
2148+--- src.orig/chrome/browser/resources/options2/browser_options.js 2012-07-31 14:30:37.000000000 -0400
2149++++ src/chrome/browser/resources/options2/browser_options.js 2012-07-31 14:34:57.798804289 -0400
2150+@@ -397,6 +397,23 @@
2151+ [String(event.target.options[event.target.selectedIndex].value)]);
2152+ };
2153+
2154++ // Desktop integration section
2155++ if (cr.isLinux && !cr.isChromeOS) {
2156++ var updateButtonState = function () {
2157++ $('desktop-integration-button').disabled =
2158++ ! $('promptIntegrationForAnyWebsite').checked;
2159++ };
2160++ $('promptIntegrationForAnyWebsite').onchange = function () {
2161++ updateButtonState();
2162++ chrome.send('setDesktopIntegrationAllowed',
2163++ [$('promptIntegrationForAnyWebsite').checked]);
2164++ };
2165++ updateButtonState();
2166++ $('desktop-integration-button').onclick = function(event) {
2167++ OptionsPage.navigateToPage('desktopIntegrationOverlay');
2168++ };
2169++ }
2170++
2171+ // Languages section.
2172+ $('language-button').onclick = function(event) {
2173+ OptionsPage.navigateToPage('languages');
2174+@@ -1024,6 +1041,24 @@
2175+ },
2176+
2177+ /**
2178++ * Disable the desktop integration settings if needed.
2179++ * @private
2180++ */
2181++ disableDesktopIntegration_: function() {
2182++ $('desktop-integration-section').style.display = 'none';
2183++ },
2184++
2185++ /**
2186++ * Disable the desktop integration settings if needed.
2187++ * @private
2188++ */
2189++ setDesktopIntegrationIsAllowed_: function(enabled) {
2190++ $('promptIntegrationForAnyWebsite').checked = enabled;
2191++ $('desktop-integration-button').disabled =
2192++ ! $('promptIntegrationForAnyWebsite').checked;
2193++ },
2194++
2195++ /**
2196+ * Set the checked state of the metrics reporting checkbox.
2197+ * @private
2198+ */
2199+@@ -1357,6 +1392,7 @@
2200+ //Forward public APIs to private implementations.
2201+ [
2202+ 'addBluetoothDevice',
2203++ 'disableDesktopIntegration',
2204+ 'getStartStopSyncButton',
2205+ 'hideBluetoothSettings',
2206+ 'removeCloudPrintConnectorSection',
2207+@@ -1370,6 +1406,7 @@
2208+ 'setGtkThemeButtonEnabled',
2209+ 'setHighContrastCheckboxState',
2210+ 'setInstantFieldTrialStatus',
2211++ 'setDesktopIntegrationIsAllowed',
2212+ 'setMetricsReportingCheckboxState',
2213+ 'setMetricsReportingSettingVisibility',
2214+ 'setProfilesInfo',
2215+Index: src/chrome/browser/ui/webui/options2/options_ui2.cc
2216+===================================================================
2217+--- src.orig/chrome/browser/ui/webui/options2/options_ui2.cc 2012-07-31 14:30:37.000000000 -0400
2218++++ src/chrome/browser/ui/webui/options2/options_ui2.cc 2012-07-31 14:34:57.798804289 -0400
2219+@@ -90,6 +90,10 @@
2220+ #include "chrome/browser/ui/webui/options2/certificate_manager_handler2.h"
2221+ #endif
2222+
2223++#if defined(OS_LINUX)
2224++#include "chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h"
2225++#endif
2226++
2227+ using content::RenderViewHost;
2228+
2229+ namespace {
2230+@@ -233,6 +237,10 @@
2231+ AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler());
2232+ AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler());
2233+ AddOptionsPageUIHandler(localized_strings, new CookiesViewHandler());
2234++#if defined(OS_LINUX)
2235++ AddOptionsPageUIHandler(localized_strings,
2236++ new DesktopIntegrationSettingsHandler());
2237++#endif
2238+ AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler());
2239+ AddOptionsPageUIHandler(localized_strings, new HomePageOverlayHandler());
2240+ AddOptionsPageUIHandler(localized_strings, new WebIntentsSettingsHandler());
2241+Index: src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h
2242+===================================================================
2243+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2244++++ src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h 2012-07-31 14:34:57.798804289 -0400
2245+@@ -0,0 +1,76 @@
2246++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2247++// Use of this source code is governed by a BSD-style license that can be
2248++// found in the LICENSE file.
2249++
2250++#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS2_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
2251++#define CHROME_BROWSER_UI_WEBUI_OPTIONS2_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
2252++
2253++#include <string>
2254++
2255++#include "base/compiler_specific.h"
2256++#include "chrome/browser/ui/webui/options2/options_ui2.h"
2257++
2258++namespace base {
2259++class DictionaryValue;
2260++class ListValue;
2261++}
2262++
2263++namespace options2 {
2264++
2265++class DesktopIntegrationSettingsHandler : public OptionsPageUIHandler {
2266++ public:
2267++ DesktopIntegrationSettingsHandler();
2268++ virtual ~DesktopIntegrationSettingsHandler();
2269++
2270++ // OptionsPageUIHandler implementation.
2271++ virtual void GetLocalizedValues(
2272++ base::DictionaryValue* localized_strings) OVERRIDE;
2273++ virtual void InitializeHandler() OVERRIDE;
2274++ virtual void InitializePage() OVERRIDE;
2275++ virtual void RegisterMessages() OVERRIDE;
2276++
2277++ private:
2278++
2279++ // Loads the data associated with the currently integrated websites.
2280++ void LoadIntegratedWebsitesData();
2281++
2282++ // Initializes the list of website domain names that are currently
2283++ // either allowed or 'dontask' and send it to the overlay.
2284++ void LoadUnityWebappsEntryPoint();
2285++
2286++ // Removes an website from the list of integrated websites that won't prompt
2287++ // from integration.
2288++ // |args| - A string, the domain name of the website to remove.
2289++ void RemoveIntegrationSite(const ListValue* args);
2290++
2291++ // Adds an website from the list of integrated websites that won't prompt
2292++ // from integration. The website is being added to the list of 'allowed' sites.
2293++ // |args| - A string, the domain name of the website to add.
2294++ void AddIntegrationSite(const ListValue* args);
2295++
2296++ // Updates the integration allowed flag.
2297++ // |args| - A boolean flag indicating if integration should be allowed
2298++ void SetDesktopIntegrationAllowed(const ListValue* args);
2299++
2300++ // Updates the list of integrated websites.
2301++ void UpdateIntegratedWebsitesList(const ListValue* args);
2302++
2303++ // Predicate informing if we have been able to initialize the connection
2304++ // with the unity-webapps library (entry point for website integration
2305++ // permissions).
2306++ bool IsUnityWebappsInitialized() const;
2307++
2308++ //
2309++ void * lib_unity_webapps_handle_;
2310++ void * get_all_func_handle_;
2311++ void * remove_from_permissions_func_handle_;
2312++ void * add_allowed_domain_func_handle_;
2313++ void * is_integration_allowed_func_handle_;
2314++ void * set_integration_allowed_func_handle_;
2315++
2316++ DISALLOW_COPY_AND_ASSIGN(DesktopIntegrationSettingsHandler);
2317++};
2318++
2319++} // namespace options2
2320++
2321++#endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
2322+Index: src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.cc
2323+===================================================================
2324+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
2325++++ src/chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.cc 2012-07-31 14:37:18.294808913 -0400
2326+@@ -0,0 +1,264 @@
2327++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2328++// Use of this source code is governed by a BSD-style license that can be
2329++// found in the LICENSE file.
2330++
2331++#include "chrome/browser/ui/webui/options2/desktop_integration_settings_handler2.h"
2332++
2333++#include <glib.h>
2334++#include <dlfcn.h>
2335++#include <vector>
2336++
2337++#include "base/bind.h"
2338++#include "base/bind_helpers.h"
2339++#include "base/logging.h"
2340++#include "base/string16.h"
2341++#include "base/string_number_conversions.h"
2342++#include "base/utf_string_conversions.h"
2343++#include "base/values.h"
2344++#include "chrome/browser/ui/webui/web_ui_util.h"
2345++#include "chrome/common/guid.h"
2346++#include "chrome/common/url_constants.h"
2347++#include "content/public/browser/web_ui.h"
2348++#include "grit/generated_resources.h"
2349++#include "grit/webkit_resources.h"
2350++#include "ui/base/l10n/l10n_util.h"
2351++
2352++// Not a constant but preprocessor definition for easy concatenation.
2353++#define kLibunityWebappsEntryPointLibName "libunity_webapps.so.0"
2354++
2355++namespace options2 {
2356++
2357++// TODO: -> extract to function
2358++DesktopIntegrationSettingsHandler::DesktopIntegrationSettingsHandler()
2359++ : lib_unity_webapps_handle_(NULL),
2360++ get_all_func_handle_(NULL),
2361++ remove_from_permissions_func_handle_(NULL),
2362++ add_allowed_domain_func_handle_(NULL),
2363++ is_integration_allowed_func_handle_(NULL),
2364++ set_integration_allowed_func_handle_(NULL) {
2365++}
2366++
2367++DesktopIntegrationSettingsHandler::~DesktopIntegrationSettingsHandler() {
2368++ if (lib_unity_webapps_handle_) {
2369++ dlclose (lib_unity_webapps_handle_);
2370++ lib_unity_webapps_handle_ = NULL;
2371++
2372++ remove_from_permissions_func_handle_ = NULL;
2373++ get_all_func_handle_ = NULL;
2374++ add_allowed_domain_func_handle_ = NULL;
2375++ is_integration_allowed_func_handle_ = NULL;
2376++ set_integration_allowed_func_handle_ = NULL;
2377++ }
2378++}
2379++
2380++/////////////////////////////////////////////////////////////////////////////
2381++// OptionsPageUIHandler implementation:
2382++void DesktopIntegrationSettingsHandler::GetLocalizedValues(
2383++ DictionaryValue* localized_strings) {
2384++ DCHECK(localized_strings);
2385++
2386++ static OptionsStringResource resources[] = {
2387++ { "desktopIntegrationInfoText",
2388++ IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_DESCRIPTION },
2389++ { "desktopIntegrationColumnDescription",
2390++ IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_COLUMN_DESCRIPTION },
2391++ };
2392++
2393++ localized_strings->SetString("add_button",
2394++ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_BUTTON));
2395++ localized_strings->SetString("add_desktop_website_input_label",
2396++ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TEXT));
2397++ localized_strings->SetString("add_desktop_website_title",
2398++ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TITLE));
2399++
2400++ RegisterStrings(localized_strings, resources, arraysize(resources));
2401++ RegisterTitle(localized_strings, "desktopIntegrationPage",
2402++ IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_TITLE);
2403++}
2404++
2405++void DesktopIntegrationSettingsHandler::InitializeHandler() {
2406++ if (!IsUnityWebappsInitialized()) {
2407++ LoadUnityWebappsEntryPoint();
2408++ }
2409++}
2410++
2411++void DesktopIntegrationSettingsHandler::InitializePage() {
2412++ DCHECK(IsUnityWebappsInitialized());
2413++ LoadIntegratedWebsitesData();
2414++}
2415++
2416++void DesktopIntegrationSettingsHandler::RegisterMessages() {
2417++ web_ui()->RegisterMessageCallback(
2418++ "addIntegrationSite",
2419++ base::Bind(&DesktopIntegrationSettingsHandler::AddIntegrationSite,
2420++ base::Unretained(this)));
2421++ web_ui()->RegisterMessageCallback(
2422++ "setDesktopIntegrationAllowed",
2423++ base::Bind(&DesktopIntegrationSettingsHandler::SetDesktopIntegrationAllowed,
2424++ base::Unretained(this)));
2425++ web_ui()->RegisterMessageCallback(
2426++ "removeIntegrationSite",
2427++ base::Bind(&DesktopIntegrationSettingsHandler::RemoveIntegrationSite,
2428++ base::Unretained(this)));
2429++ web_ui()->RegisterMessageCallback(
2430++ "updateIntegratedWebsitesList",
2431++ base::Bind(&DesktopIntegrationSettingsHandler::UpdateIntegratedWebsitesList,
2432++ base::Unretained(this)));
2433++}
2434++
2435++void DesktopIntegrationSettingsHandler::LoadUnityWebappsEntryPoint() {
2436++ DCHECK(!IsUnityWebappsInitialized());
2437++
2438++ // TODO run on FILE thread
2439++ static const char* const search_paths[] = {
2440++ kLibunityWebappsEntryPointLibName,
2441++ "/usr/local/lib/" kLibunityWebappsEntryPointLibName
2442++ , "/usr/lib/" kLibunityWebappsEntryPointLibName
2443++ };
2444++
2445++ void * handle = NULL;
2446++ for (size_t i = 0; i < sizeof(search_paths)/sizeof(search_paths[0]); ++i) {
2447++ DCHECK(handle == NULL);
2448++ // TODO validate path?
2449++ handle = dlopen (search_paths[i], RTLD_LAZY|RTLD_GLOBAL);
2450++ if (handle) {
2451++ LOG(INFO) << "Found libunitywebapps entry point:" << search_paths[i];
2452++ break;
2453++ }
2454++ }
2455++ if (!handle) {
2456++ LOG(INFO) << "Could not load Unity Webapps entry point library";
2457++ return;
2458++ }
2459++
2460++ void * get_all_handle =
2461++ dlsym (handle, "unity_webapps_permissions_get_all_domains");
2462++ void * remove_from_permissions_handle =
2463++ dlsym (handle, "unity_webapps_permissions_remove_domain_from_permissions");
2464++ void * add_allowed_domain_handle =
2465++ dlsym (handle, "unity_webapps_permissions_allow_domain");
2466++ void * is_integration_allowed_handle =
2467++ dlsym (handle, "unity_webapps_permissions_is_integration_allowed");
2468++ void * set_integration_allowed_handle =
2469++ dlsym (handle, "unity_webapps_permissions_set_integration_allowed");
2470++
2471++ if (!get_all_handle ||
2472++ !remove_from_permissions_handle ||
2473++ !add_allowed_domain_handle ||
2474++ !is_integration_allowed_handle ||
2475++ !set_integration_allowed_handle) {
2476++ LOG(WARNING) << "Could not load Unity Webapps entry point functions";
2477++ dlclose(handle);
2478++ return;
2479++ }
2480++
2481++ lib_unity_webapps_handle_ = handle;
2482++ get_all_func_handle_ = get_all_handle;
2483++ remove_from_permissions_func_handle_ = remove_from_permissions_handle;
2484++ add_allowed_domain_func_handle_ = add_allowed_domain_handle;
2485++ is_integration_allowed_func_handle_ = is_integration_allowed_handle;
2486++ set_integration_allowed_func_handle_ = set_integration_allowed_handle;
2487++}
2488++
2489++bool DesktopIntegrationSettingsHandler::IsUnityWebappsInitialized() const {
2490++ return NULL != lib_unity_webapps_handle_
2491++ && NULL != get_all_func_handle_
2492++ && NULL != remove_from_permissions_func_handle_
2493++ && NULL != add_allowed_domain_func_handle_
2494++ && NULL != is_integration_allowed_func_handle_
2495++ && NULL != set_integration_allowed_func_handle_;
2496++}
2497++
2498++void DesktopIntegrationSettingsHandler::LoadIntegratedWebsitesData() {
2499++ if (!IsUnityWebappsInitialized()) {
2500++ web_ui()->CallJavascriptFunction(
2501++ "BrowserOptions.disableDesktopIntegration");
2502++ LOG(INFO) << "Disabling Desktop Integration options";
2503++ return;
2504++ }
2505++
2506++ typedef gboolean (* IsIntegrationAllowedFunc) (void);
2507++ gboolean isallowed =
2508++ ((IsIntegrationAllowedFunc) is_integration_allowed_func_handle_) ();
2509++ web_ui()->CallJavascriptFunction(
2510++ "BrowserOptions.setDesktopIntegrationIsAllowed",
2511++ base::FundamentalValue(isallowed));
2512++}
2513++
2514++void DesktopIntegrationSettingsHandler::UpdateIntegratedWebsitesList(
2515++ const ListValue* args) {
2516++ DCHECK(IsUnityWebappsInitialized());
2517++
2518++ // TODO move elsewhere
2519++ typedef gchar* (* GetAllDomainsFunc) (void);
2520++
2521++ gchar* all_domains = ((GetAllDomainsFunc) get_all_func_handle_) ();
2522++ if (all_domains) {
2523++ web_ui()->CallJavascriptFunction(
2524++ "DesktopIntegrationOverlay.setIntegratedWebsites",
2525++ StringValue(all_domains));
2526++ }
2527++}
2528++
2529++void DesktopIntegrationSettingsHandler::SetDesktopIntegrationAllowed(
2530++ const ListValue* args) {
2531++ DCHECK(IsUnityWebappsInitialized());
2532++
2533++ // TODO move elsewhere
2534++ typedef void (* SetDesktopIntegrationAllowedFunc) (gboolean);
2535++
2536++ bool is_allowed;
2537++ if (!args->GetBoolean(0, &is_allowed)) {
2538++ NOTREACHED();
2539++ return;
2540++ }
2541++
2542++ LOG(INFO) << "Setting desktop integration:" << is_allowed;
2543++
2544++ ((SetDesktopIntegrationAllowedFunc) set_integration_allowed_func_handle_) (
2545++ is_allowed ? TRUE : FALSE);
2546++}
2547++
2548++void DesktopIntegrationSettingsHandler::AddIntegrationSite(
2549++ const ListValue* args) {
2550++ DCHECK(IsUnityWebappsInitialized());
2551++
2552++ // TODO move elsewhere
2553++ typedef void (* AddDomainFromPermissionsFunc) (gchar *);
2554++
2555++ std::string domain;
2556++ if (!args->GetString(0, &domain)) {
2557++ NOTREACHED();
2558++ return;
2559++ }
2560++
2561++ LOG(INFO) << "Adding domain:" << domain << " to the list of websites allowed";
2562++
2563++ ((AddDomainFromPermissionsFunc) add_allowed_domain_func_handle_) (
2564++ const_cast<gchar *>(domain.c_str()));
2565++
2566++ LoadIntegratedWebsitesData ();
2567++}
2568++
2569++void DesktopIntegrationSettingsHandler::RemoveIntegrationSite(
2570++ const ListValue* args) {
2571++ DCHECK(IsUnityWebappsInitialized());
2572++
2573++ // TODO move elsewhere
2574++ typedef void (* RemoveDomainFromPermissionsFunc) (gchar *);
2575++
2576++ std::string domain;
2577++ if (!args->GetString(0, &domain)) {
2578++ NOTREACHED();
2579++ return;
2580++ }
2581++
2582++ LOG(INFO) << "Removing domain:" << domain << " from the list of websites not prompting integration";
2583++
2584++ ((RemoveDomainFromPermissionsFunc) remove_from_permissions_func_handle_) (
2585++ const_cast<gchar *>(domain.c_str()));
2586++
2587++ LoadIntegratedWebsitesData ();
2588++}
2589++
2590++} // namespace options2
2591+Index: src/chrome/browser/ui/webui/options2/browser_options_handler2.cc
2592+===================================================================
2593+--- src.orig/chrome/browser/ui/webui/options2/browser_options_handler2.cc 2012-07-31 14:30:37.000000000 -0400
2594++++ src/chrome/browser/ui/webui/options2/browser_options_handler2.cc 2012-07-31 14:34:57.798804289 -0400
2595+@@ -152,6 +152,8 @@
2596+ { "advancedSectionTitleCloudPrint", IDS_GOOGLE_CLOUD_PRINT },
2597+ { "advancedSectionTitleContent",
2598+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT },
2599++ { "advancedSectionTitleIntegration",
2600++ IDS_OPTIONS_ADVANCED_SECTION_TITLE_INTEGRATION },
2601+ { "advancedSectionTitleLanguages",
2602+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_LANGUAGES },
2603+ { "advancedSectionTitleNetwork",
2604+@@ -171,6 +173,8 @@
2605+ { "defaultFontSizeLabel", IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL },
2606+ { "defaultSearchManageEngines", IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES },
2607+ { "defaultZoomFactorLabel", IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL },
2608++ { "desktopIntegrationExceptionsSettingsButton",
2609++ IDS_DESKTOP_INTEGRATION_SETTINGS_EXCEPTIONS_BUTTON_LABEL },
2610+ #if defined(OS_CHROMEOS)
2611+ { "disableGData", IDS_OPTIONS_DISABLE_GDATA },
2612+ #endif
2613+@@ -222,6 +226,8 @@
2614+ { "profilesDeleteSingle", IDS_PROFILES_DELETE_SINGLE_BUTTON_LABEL },
2615+ { "profilesListItemCurrent", IDS_PROFILES_LIST_ITEM_CURRENT },
2616+ { "profilesManage", IDS_PROFILES_MANAGE_BUTTON_LABEL },
2617++ { "promptIntegrationEnableIntegration",
2618++ IDS_PROMPT_INTEGRATION_ENABLE_BUTTON_LABEL },
2619+ { "proxiesLabel", IDS_OPTIONS_PROXIES_LABEL },
2620+ { "safeBrowsingEnableProtection",
2621+ IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION },
2622
2623=== modified file 'debian/patches/dlopen_sonamed_gl.patch'
2624--- debian/patches/dlopen_sonamed_gl.patch 2011-10-26 06:14:33 +0000
2625+++ debian/patches/dlopen_sonamed_gl.patch 2012-08-06 17:52:22 +0000
2626@@ -9,9 +9,9 @@
2627
2628 Index: src/ui/gfx/gl/gl_implementation_linux.cc
2629 ===================================================================
2630---- src.orig/ui/gfx/gl/gl_implementation_linux.cc 2011-10-21 17:35:43.000000000 +0100
2631-+++ src/ui/gfx/gl/gl_implementation_linux.cc 2011-10-21 18:40:52.767139411 +0100
2632-@@ -73,7 +73,7 @@
2633+--- src.orig/ui/gfx/gl/gl_implementation_linux.cc 2012-06-21 16:09:03.011162386 -0400
2634++++ src/ui/gfx/gl/gl_implementation_linux.cc 2012-06-21 16:14:21.867172877 -0400
2635+@@ -75,7 +75,7 @@
2636 }
2637
2638 base::NativeLibrary library = LoadLibrary(
2639@@ -20,16 +20,3 @@
2640 if (!library)
2641 return false;
2642
2643-@@ -120,10 +120,10 @@
2644- }
2645- #endif // !defined(USE_WAYLAND)
2646- case kGLImplementationEGLGLES2: {
2647-- base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so");
2648-+ base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so.2");
2649- if (!gles_library)
2650- return false;
2651-- base::NativeLibrary egl_library = LoadLibrary("libEGL.so");
2652-+ base::NativeLibrary egl_library = LoadLibrary("libEGL.so.1");
2653- if (!egl_library) {
2654- base::UnloadNativeLibrary(gles_library);
2655- return false;
2656
2657=== modified file 'debian/patches/fix-armhf-ftbfs.patch'
2658--- debian/patches/fix-armhf-ftbfs.patch 2012-03-07 07:24:59 +0000
2659+++ debian/patches/fix-armhf-ftbfs.patch 2012-08-06 17:52:22 +0000
2660@@ -2,23 +2,11 @@
2661 Subject: Fix FTBFS on armhf
2662 Bug-Ubuntu: https://bugs.launchpad.net/bugs/943281
2663
2664-Index: src/build/common.gypi
2665-===================================================================
2666---- src.orig/build/common.gypi 2012-03-05 10:39:30.082526500 +0200
2667-+++ src/build/common.gypi 2012-03-05 11:02:24.082526500 +0200
2668-@@ -1814,7 +1814,6 @@
2669- 'cflags': [
2670- '-march=armv7-a',
2671- '-mtune=cortex-a8',
2672-- '-mfloat-abi=softfp',
2673- ],
2674- 'conditions': [
2675- ['arm_neon==1', {
2676 Index: src/native_client/build/common.gypi
2677 ===================================================================
2678---- src.orig/native_client/build/common.gypi 2012-02-15 23:35:45.000000000 +0200
2679-+++ src/native_client/build/common.gypi 2012-03-05 11:03:09.160651492 +0200
2680-@@ -289,7 +289,6 @@
2681+--- src.orig/native_client/build/common.gypi 2012-06-21 14:40:40.000000000 -0400
2682++++ src/native_client/build/common.gypi 2012-06-21 16:16:02.195176177 -0400
2683+@@ -294,7 +294,6 @@
2684 '-march=armv7-a',
2685 '-mtune=cortex-a8',
2686 '-mfpu=neon',
2687@@ -26,15 +14,3 @@
2688 '-fno-exceptions',
2689 '-Wall',
2690 '-fPIC',
2691-Index: src/third_party/ffmpeg/ffmpeg.gyp
2692-===================================================================
2693---- src.orig/third_party/ffmpeg/ffmpeg.gyp 2012-02-15 23:35:36.000000000 +0200
2694-+++ src/third_party/ffmpeg/ffmpeg.gyp 2012-03-05 11:02:34.004401501 +0200
2695-@@ -170,7 +170,6 @@
2696- '-mthumb',
2697- '-march=armv7-a',
2698- '-mtune=cortex-a8',
2699-- '-mfloat-abi=softfp',
2700- ],
2701- 'conditions': [
2702- ['arm_neon == 0', {
2703
2704=== added file 'debian/patches/grd_parse_fix.patch'
2705--- debian/patches/grd_parse_fix.patch 1970-01-01 00:00:00 +0000
2706+++ debian/patches/grd_parse_fix.patch 2012-08-06 17:52:22 +0000
2707@@ -0,0 +1,12 @@
2708+Index: src/chrome/app/chromium_strings.grd
2709+===================================================================
2710+--- src.orig/chrome/app/chromium_strings.grd 2012-07-09 14:16:01.091449368 -0400
2711++++ src/chrome/app/chromium_strings.grd 2012-07-09 14:25:12.951467521 -0400
2712+@@ -111,7 +111,6 @@
2713+ <if expr="not pp_ifdef('use_third_party_translations')">
2714+ <file path="resources/chromium_strings_am.xtb" lang="am" />
2715+ <file path="resources/chromium_strings_ar.xtb" lang="ar" />
2716+- </if>
2717+ <file path="../../third_party/launchpad_translations/chromium_strings_ast.xtb" lang="ast" />
2718+ <file path="../../third_party/launchpad_translations/chromium_strings_bg.xtb" lang="bg" />
2719+ <file path="resources/chromium_strings_bn.xtb" lang="bn" />
2720
2721=== modified file 'debian/patches/series'
2722--- debian/patches/series 2012-03-30 08:42:27 +0000
2723+++ debian/patches/series 2012-08-06 17:52:22 +0000
2724@@ -1,8 +1,13 @@
2725 # system_v8.patch
2726-ubuntu_dont_overwrite_default_download_directory.patch
2727 chromium_useragent.patch
2728 disable_dlog_and_dcheck_in_release_builds.patch
2729 webkit_rev_parser.patch
2730 dlopen_sonamed_gl.patch
2731-glib-header-single-entry.patch
2732 fix-armhf-ftbfs.patch
2733+arm.patch
2734+grd_parse_fix.patch
2735+1-infobars.patch
2736+2-get-domain-tld.patch
2737+3-chrome-xid.patch
2738+chromeless-window-launch-option.patch
2739+desktop-integration-settings.patch
2740
2741=== removed file 'debian/patches/ubuntu_dont_overwrite_default_download_directory.patch'
2742--- debian/patches/ubuntu_dont_overwrite_default_download_directory.patch 2011-05-06 22:59:06 +0000
2743+++ debian/patches/ubuntu_dont_overwrite_default_download_directory.patch 1970-01-01 00:00:00 +0000
2744@@ -1,47 +0,0 @@
2745-See http://code.google.com/p/chromium/issues/detail?id=16442
2746-Restore the default Downloads location used on Ubuntu.
2747-
2748----
2749- chrome/common/chrome_paths_linux.cc | 15 ---------------
2750- 1 file changed, 15 deletions(-)
2751-
2752-Index: src/chrome/common/chrome_paths_linux.cc
2753-===================================================================
2754---- src.orig/chrome/common/chrome_paths_linux.cc
2755-+++ src/chrome/common/chrome_paths_linux.cc
2756-@@ -79,35 +79,20 @@
2757- }
2758-
2759- bool GetUserDocumentsDirectory(FilePath* result) {
2760- scoped_ptr<base::Environment> env(base::Environment::Create());
2761- *result = base::nix::GetXDGUserDirectory(env.get(), "DOCUMENTS", "Documents");
2762- return true;
2763- }
2764-
2765--// We respect the user's preferred download location, unless it is
2766--// ~ or their desktop directory, in which case we default to ~/Downloads.
2767- bool GetUserDownloadsDirectory(FilePath* result) {
2768- scoped_ptr<base::Environment> env(base::Environment::Create());
2769- *result = base::nix::GetXDGUserDirectory(env.get(), "DOWNLOAD",
2770- kDownloadsDir);
2771--
2772-- FilePath home = file_util::GetHomeDir();
2773-- if (*result == home) {
2774-- *result = home.Append(kDownloadsDir);
2775-- return true;
2776-- }
2777--
2778-- FilePath desktop;
2779-- GetUserDesktop(&desktop);
2780-- if (*result == desktop) {
2781-- *result = home.Append(kDownloadsDir);
2782-- }
2783--
2784- return true;
2785- }
2786-
2787- bool GetUserDesktop(FilePath* result) {
2788- scoped_ptr<base::Environment> env(base::Environment::Create());
2789- *result = base::nix::GetXDGUserDirectory(env.get(), "DESKTOP", "Desktop");
2790- return true;
2791- }
2792
2793=== modified file 'debian/rules'
2794--- debian/rules 2012-06-18 14:17:58 +0000
2795+++ debian/rules 2012-08-06 17:52:22 +0000
2796@@ -72,9 +72,13 @@
2797 # Disable NaCl until we figure out what to do with the private toolchain
2798 GYP_DEFINES += disable_nacl=1
2799
2800+# do not use third_party/gold as the linker.
2801+GYP_DEFINES += linux_use_gold_binary=0 linux_use_gold_flags=0
2802+
2803 ifneq (,$(findstring armhf,$(DEB_BUILD_ARCH)))
2804 GYP_DEFINES += \
2805 v8_use_arm_eabi_hardfloat=true \
2806+ arm_float_abi=hard \
2807 $(NULL)
2808 endif
2809
2810@@ -143,6 +147,17 @@
2811
2812 CC_VERSION := $(shell gcc -dumpversion | cut -d. -f-2)
2813
2814+# Set this to use gcc 4.6 instead of 4.7
2815+AVOID_GCC_47 ?= 1
2816+ifeq (4.7,$(CC_VERSION))
2817+GYP_DEFINES += werror=$(NULL)
2818+ifeq (1,$(AVOID_GCC_47))
2819+CC := gcc-4.6
2820+CXX := g++-4.6
2821+BUILD_ARGS += CC=$(CC) CXX=$(CXX) CC.host=$(CC) CXX.host=$(CXX) LINK.host=$(CXX)
2822+endif
2823+endif
2824+
2825 # Set this to use gcc 4.5 instead of 4.6
2826 AVOID_GCC_46 ?= 0
2827
2828@@ -235,6 +250,14 @@
2829 FFMPEG_MT_STD_GYP_DEFINES = $(NULL)
2830 FFMPEG_MT_EXTRA_GYP_DEFINES = ffmpeg_branding=Chrome
2831
2832+ifneq (,$(filter 12.10 unstable development,$(DEBIAN_DIST)))
2833+# enable compile-time dependency on gnome-keyring
2834+GYP_DEFINES += use_gnome_keyring=1 linux_link_gnome_keyring=1
2835+# controlling the use of GConf (the classic GNOME configuration
2836+# and GIO, which contains GSettings (the new GNOME config system)
2837+GYP_DEFINES += use_gconf=1 use_gio=1
2838+endif
2839+
2840 USE_SYSTEM_SQLITE := $(shell pkg-config 'sqlite3 >= 3.6.1' && echo 1 || echo 0)
2841 USE_SYSTEM_SQLITE := 0
2842
2843@@ -549,6 +572,7 @@
2844 third_party/ffmpeg/binaries \
2845 third_party/fuzzymatch \
2846 third_party/gles_book_examples \
2847+ third_party/gold \
2848 third_party/hunspell/dictionaries \
2849 third_party/icu/mac \
2850 third_party/lcov \

Subscribers

People subscribed via source and target branches

to all changes: