~ps-jenkins/unity-chromium-extension/trusty-proposed

« back to all changes in this revision

Viewing changes to chromium-patches/stable-28.0.1500.45/5-desktop-integration-settings.patch

  • Committer: CI bot
  • Author(s): Justin McPherson
  • Date: 2014-02-17 23:43:23 UTC
  • mfrom: (239.2.1 remove-patches)
  • Revision ID: ps-jenkins@lists.canonical.com-20140217234323-4pw656wfrooeinde
Chromium patches are no longer maintained in this repo, remove them to avoid confusion. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: src/chrome/app/generated_resources.grd
2
 
===================================================================
3
 
--- src/chrome/app/generated_resources.grd      (revision 205727)
4
 
+++ src/chrome/app/generated_resources.grd      (working copy)
5
 
@@ -12234,6 +12234,9 @@
6
 
       <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT">
7
 
         Web content
8
 
       </message>
9
 
+      <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_INTEGRATION">
10
 
+        Installed Websites
11
 
+      </message>
12
 
       <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY">
13
 
         HTTPS/SSL
14
 
       </message>
15
 
@@ -14928,6 +14931,35 @@
16
 
       </message>
17
 
     </if>
18
 
 
19
 
+    <!-- Desktop integration -->
20
 
+    <message name="IDS_PROMPT_INTEGRATION_ENABLE_BUTTON_LABEL" desc="The text to be displayed on the checkbox that enables desktop integration.">
21
 
+      Notify me when the website I am visiting can run as an application
22
 
+    </message>
23
 
+    <message name="IDS_DESKTOP_INTEGRATION_NOTE_DESCRIPTION" desc="The text to be displayed below the Exceptions button in the Integrated Websites section.">
24
 
+      Websites which have been installed can be removed, like any other application, using Ubuntu Software Center.
25
 
+    </message>
26
 
+    <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_EXCEPTIONS_BUTTON_LABEL" desc="The text to be displayed on the button that drives integration exceptions.">
27
 
+      Exceptions...
28
 
+    </message>
29
 
+    <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_TITLE" desc="Title for the desktop integration overlay.">
30
 
+      Integration prompt exceptions
31
 
+    </message>
32
 
+    <message name="IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_DESCRIPTION" desc="Description for the desktop integration overlay.">
33
 
+      These websites won't prompt to be installed:
34
 
+    </message>
35
 
+    <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_BUTTON"
36
 
+             desc="The label for the add button for adding a integration websites">
37
 
+      Add
38
 
+    </message>
39
 
+    <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TEXT"
40
 
+             desc="The description text for the add overlay for adding a integration websites">
41
 
+      Website domain name (e.g. www.html5rocks.com)
42
 
+    </message>
43
 
+    <message name="IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TITLE"
44
 
+             desc="Title for add overlay for adding a integration websites">
45
 
+      Add Integrated Website
46
 
+    </message>
47
 
+
48
 
     <!-- Manage Profile Dialog -->
49
 
     <message name="IDS_PROFILES_MANAGE_TITLE" desc="Title of the manage profile dialog">
50
 
       Edit user
51
 
Index: src/chrome/browser/resources/options/browser_options.html
52
 
===================================================================
53
 
--- src/chrome/browser/resources/options/browser_options.html   (revision 205727)
54
 
+++ src/chrome/browser/resources/options/browser_options.html   (working copy)
55
 
@@ -381,6 +381,22 @@
56
 
     </div>
57
 
   </section>
58
 
 </if>  <!-- pp_ifdef('chromeos') -->
59
 
+
60
 
+<if expr="is_linux and not pp_ifdef('chromeos')">
61
 
+  <section id="desktop-integration-section">
62
 
+    <h3 i18n-content="advancedSectionTitleIntegration"></h3>
63
 
+    <div class="checkbox">
64
 
+      <label>
65
 
+        <input id="promptIntegrationForAnyWebsite"
66
 
+            metric="Options_PromptIntegration" type="checkbox">
67
 
+        <span i18n-content="promptIntegrationEnableIntegration"></span>
68
 
+      </label>
69
 
+    </div>
70
 
+    <button id="desktop-integration-button"
71
 
+        i18n-content="desktopIntegrationExceptionsSettingsButton"></button>
72
 
+  </section>
73
 
+</if>
74
 
+
75
 
   <section id="passwords-and-autofill-section">
76
 
     <h3 i18n-content="passwordsAndAutofillGroupName"></h3>
77
 
     <div class="checkbox">
78
 
Index: src/chrome/browser/resources/options/browser_options.js
79
 
===================================================================
80
 
--- src/chrome/browser/resources/options/browser_options.js     (revision 205727)
81
 
+++ src/chrome/browser/resources/options/browser_options.js     (working copy)
82
 
@@ -366,6 +366,23 @@
83
 
             [String(event.target.options[event.target.selectedIndex].value)]);
84
 
       };
85
 
 
86
 
+      // Desktop integration section.
87
 
+      if (cr.isLinux && !cr.isChromeOS) {
88
 
+        var updateButtonState = function () {
89
 
+          $('desktop-integration-button').disabled =
90
 
+            ! $('promptIntegrationForAnyWebsite').checked;
91
 
+        };
92
 
+        $('promptIntegrationForAnyWebsite').onchange = function () {
93
 
+          updateButtonState();
94
 
+          chrome.send('setDesktopIntegrationAllowed',
95
 
+                      [$('promptIntegrationForAnyWebsite').checked]);
96
 
+        };
97
 
+        updateButtonState();
98
 
+        $('desktop-integration-button').onclick = function(event) {
99
 
+          OptionsPage.navigateToPage('desktopIntegrationOverlay');
100
 
+        };
101
 
+      }
102
 
+
103
 
       // Languages section.
104
 
       $('language-button').onclick = function(event) {
105
 
         OptionsPage.navigateToPage('languages');
106
 
@@ -1110,6 +1127,24 @@
107
 
     },
108
 
 
109
 
     /**
110
 
+     * Disable the desktop integration settings if needed.
111
 
+     * @private
112
 
+     */
113
 
+    disableDesktopIntegration_: function() {
114
 
+      $('desktop-integration-section').style.display = 'none';
115
 
+    },
116
 
+
117
 
+    /**
118
 
+     * Disable the desktop integration settings if needed.
119
 
+     * @private
120
 
+     */
121
 
+    setDesktopIntegrationIsAllowed_: function(enabled) {
122
 
+      $('promptIntegrationForAnyWebsite').checked = enabled;
123
 
+      $('desktop-integration-button').disabled =
124
 
+        ! $('promptIntegrationForAnyWebsite').checked;
125
 
+    },
126
 
+
127
 
+    /**
128
 
      * Set the checked state of the metrics reporting checkbox.
129
 
      * @private
130
 
      */
131
 
@@ -1401,6 +1436,7 @@
132
 
   //Forward public APIs to private implementations.
133
 
   [
134
 
     'addBluetoothDevice',
135
 
+    'disableDesktopIntegration',
136
 
     'enableFactoryResetSection',
137
 
     'getCurrentProfile',
138
 
     'getStartStopSyncButton',
139
 
@@ -1414,6 +1450,7 @@
140
 
     'setFontSize',
141
 
     'setGtkThemeButtonEnabled',
142
 
     'setHighContrastCheckboxState',
143
 
+    'setDesktopIntegrationIsAllowed',
144
 
     'setMetricsReportingCheckboxState',
145
 
     'setMetricsReportingSettingVisibility',
146
 
     'setPasswordGenerationSettingVisibility',
147
 
Index: src/chrome/browser/resources/options/options.html
148
 
===================================================================
149
 
--- src/chrome/browser/resources/options/options.html   (revision 205727)
150
 
+++ src/chrome/browser/resources/options/options.html   (working copy)
151
 
@@ -20,6 +20,7 @@
152
 
 <link rel="stylesheet" href="clear_browser_data_overlay.css">
153
 
 <link rel="stylesheet" href="content_settings.css">
154
 
 <link rel="stylesheet" href="cookies_view.css">
155
 
+<link rel="stylesheet" href="desktop_integration_overlay.css">
156
 
 <link rel="stylesheet" href="do_not_track_confirm_overlay.css">
157
 
 <link rel="stylesheet" href="managed_user_set_passphrase.css">
158
 
 <link rel="stylesheet" href="managed_user_settings.css">
159
 
@@ -101,6 +102,7 @@
160
 
   <include src="font_settings.html">
161
 
   <include src="home_page_overlay.html">
162
 
   <include src="import_data_overlay.html">
163
 
+  <include src="desktop_integration_overlay.html">
164
 
   <include src="language_options.html">
165
 
   <include src="manage_profile_overlay.html">
166
 
   <include src="password_manager.html">
167
 
@@ -129,6 +131,7 @@
168
 
   <include src="autofill_edit_creditcard_overlay.html">
169
 
   <include src="content_settings_exceptions_area.html">
170
 
   <include src="cookies_view.html">
171
 
+  <include src="desktop_integration_add_website_overlay.html">
172
 
   <include src="handler_options.html">
173
 
   <include src="language_add_language_overlay.html">
174
 
   <include src="managed_user_set_passphrase.html">
175
 
Index: src/chrome/browser/resources/options/options.js
176
 
===================================================================
177
 
--- src/chrome/browser/resources/options/options.js     (revision 205727)
178
 
+++ src/chrome/browser/resources/options/options.js     (working copy)
179
 
@@ -14,6 +14,8 @@
180
 
     options.contentSettings.ContentSettingsExceptionsArea;
181
 
 var ContentSettings = options.ContentSettings;
182
 
 var CookiesView = options.CookiesView;
183
 
+var DesktopIntegrationOverlay = options.DesktopIntegrationOverlay;
184
 
+var AddDesktopIntegrationWebsiteOverlay = options.AddDesktopIntegrationWebsiteOverlay;
185
 
 var CreateProfileOverlay = options.CreateProfileOverlay;
186
 
 var EditDictionaryOverlay = cr.IsMac ? null : options.EditDictionaryOverlay;
187
 
 var FactoryResetOverlay = options.FactoryResetOverlay;
188
 
@@ -120,6 +122,13 @@
189
 
   OptionsPage.registerOverlay(FontSettings.getInstance(),
190
 
                               BrowserOptions.getInstance(),
191
 
                               [$('fontSettingsCustomizeFontsButton')]);
192
 
+  if (cr.isLinux && !cr.isChromeos) {
193
 
+    OptionsPage.registerOverlay(AddDesktopIntegrationWebsiteOverlay.getInstance(),
194
 
+                                DesktopIntegrationOverlay.getInstance());
195
 
+    OptionsPage.registerOverlay(DesktopIntegrationOverlay.getInstance(),
196
 
+                                BrowserOptions.getInstance(),
197
 
+                                [$('desktop-integration-button')]);
198
 
+  }
199
 
   if (HandlerOptions && $('manage-handlers-button')) {
200
 
     OptionsPage.registerOverlay(HandlerOptions.getInstance(),
201
 
                                 ContentSettings.getInstance(),
202
 
Index: src/chrome/browser/resources/options/options_bundle.js
203
 
===================================================================
204
 
--- src/chrome/browser/resources/options/options_bundle.js      (revision 205727)
205
 
+++ src/chrome/browser/resources/options/options_bundle.js      (working copy)
206
 
@@ -75,6 +75,8 @@
207
 
 <include src="content_settings_ui.js"></include>
208
 
 <include src="cookies_list.js"></include>
209
 
 <include src="cookies_view.js"></include>
210
 
+<include src="desktop_integration_add_website_overlay.js"></include>
211
 
+<include src="desktop_integration_overlay.js"></include>
212
 
 <include src="factory_reset_overlay.js"></include>
213
 
 <include src="managed_user_exceptions_area.js"></include>
214
 
 <include src="managed_user_settings.js"></include>
215
 
Index: src/chrome/browser/ui/webui/options/browser_options_handler.cc
216
 
===================================================================
217
 
--- src/chrome/browser/ui/webui/options/browser_options_handler.cc      (revision 205727)
218
 
+++ src/chrome/browser/ui/webui/options/browser_options_handler.cc      (working copy)
219
 
@@ -183,6 +183,8 @@
220
 
     { "currentUserOnly", IDS_OPTIONS_CURRENT_USER_ONLY },
221
 
     { "advancedSectionTitleContent",
222
 
       IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT },
223
 
+    { "advancedSectionTitleIntegration",
224
 
+      IDS_OPTIONS_ADVANCED_SECTION_TITLE_INTEGRATION },
225
 
     { "advancedSectionTitleLanguages",
226
 
       IDS_OPTIONS_ADVANCED_SECTION_TITLE_LANGUAGES },
227
 
     { "advancedSectionTitleNetwork",
228
 
@@ -202,6 +204,10 @@
229
 
     { "defaultFontSizeLabel", IDS_OPTIONS_DEFAULT_FONT_SIZE_LABEL },
230
 
     { "defaultSearchManageEngines", IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES },
231
 
     { "defaultZoomFactorLabel", IDS_OPTIONS_DEFAULT_ZOOM_LEVEL_LABEL },
232
 
+    { "desktopIntegrationExceptionsSettingsButton",
233
 
+      IDS_DESKTOP_INTEGRATION_SETTINGS_EXCEPTIONS_BUTTON_LABEL },
234
 
+    { "desktopIntegrationNoteSettingsContent",
235
 
+      IDS_DESKTOP_INTEGRATION_NOTE_DESCRIPTION },
236
 
 #if defined(OS_CHROMEOS)
237
 
     { "disableGData", IDS_OPTIONS_DISABLE_GDATA },
238
 
 #endif
239
 
@@ -260,6 +266,8 @@
240
 
     { "profilesDeleteSingle", IDS_PROFILES_DELETE_SINGLE_BUTTON_LABEL },
241
 
     { "profilesListItemCurrent", IDS_PROFILES_LIST_ITEM_CURRENT },
242
 
     { "profilesManage", IDS_PROFILES_MANAGE_BUTTON_LABEL },
243
 
+    { "promptIntegrationEnableIntegration",
244
 
+      IDS_PROMPT_INTEGRATION_ENABLE_BUTTON_LABEL },
245
 
 #if defined(ENABLE_SETTINGS_APP)
246
 
     { "profilesAppListSwitch", IDS_SETTINGS_APP_PROFILES_SWITCH_BUTTON_LABEL },
247
 
 #endif
248
 
Index: src/chrome/browser/ui/webui/options/options_ui.cc
249
 
===================================================================
250
 
--- src/chrome/browser/ui/webui/options/options_ui.cc   (revision 205727)
251
 
+++ src/chrome/browser/ui/webui/options/options_ui.cc   (working copy)
252
 
@@ -88,6 +88,10 @@
253
 
 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h"
254
 
 #endif
255
 
 
256
 
+#if defined(OS_LINUX)
257
 
+#include "chrome/browser/ui/webui/options/desktop_integration_settings_handler.h"
258
 
+#endif
259
 
+
260
 
 using content::RenderViewHost;
261
 
 
262
 
 namespace {
263
 
@@ -255,6 +259,10 @@
264
 
   AddOptionsPageUIHandler(localized_strings, new ClearBrowserDataHandler());
265
 
   AddOptionsPageUIHandler(localized_strings, new ContentSettingsHandler());
266
 
   AddOptionsPageUIHandler(localized_strings, new CookiesViewHandler());
267
 
+#if defined(OS_LINUX)
268
 
+  AddOptionsPageUIHandler(localized_strings,
269
 
+                          new DesktopIntegrationSettingsHandler());
270
 
+#endif
271
 
   AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler());
272
 
   AddOptionsPageUIHandler(localized_strings, new HomePageOverlayHandler());
273
 
   AddOptionsPageUIHandler(localized_strings,
274
 
Index: src/chrome/chrome_browser_ui.gypi
275
 
===================================================================
276
 
--- src/chrome/chrome_browser_ui.gypi   (revision 205727)
277
 
+++ src/chrome/chrome_browser_ui.gypi   (working copy)
278
 
@@ -2142,6 +2142,8 @@
279
 
         'browser/ui/webui/options/cookies_view_handler.h',
280
 
         'browser/ui/webui/options/core_options_handler.cc',
281
 
         'browser/ui/webui/options/core_options_handler.h',
282
 
+        'browser/ui/webui/options/desktop_integration_settings_handler.cc',
283
 
+        'browser/ui/webui/options/desktop_integration_settings_handler.h',
284
 
         'browser/ui/webui/options/font_settings_handler.cc',
285
 
         'browser/ui/webui/options/font_settings_handler.h',
286
 
         'browser/ui/webui/options/font_settings_utils.h',
287
 
Index: src/chrome/browser/ui/webui/options/desktop_integration_settings_handler.cc
288
 
===================================================================
289
 
--- src/chrome/browser/ui/webui/options/desktop_integration_settings_handler.cc (revision 0)
290
 
+++ src/chrome/browser/ui/webui/options/desktop_integration_settings_handler.cc (working copy)
291
 
@@ -0,0 +1,261 @@
292
 
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
293
 
+// Use of this source code is governed by a BSD-style license that can be
294
 
+// found in the LICENSE file.
295
 
+
296
 
+#include "chrome/browser/ui/webui/options/desktop_integration_settings_handler.h"
297
 
+
298
 
+#include <glib.h>
299
 
+#include <dlfcn.h>
300
 
+#include <vector>
301
 
+
302
 
+#include "base/bind.h"
303
 
+#include "base/bind_helpers.h"
304
 
+#include "base/logging.h"
305
 
+#include "base/string16.h"
306
 
+#include "base/string_number_conversions.h"
307
 
+#include "base/utf_string_conversions.h"
308
 
+#include "base/values.h"
309
 
+#include "chrome/common/url_constants.h"
310
 
+#include "content/public/browser/web_ui.h"
311
 
+#include "grit/generated_resources.h"
312
 
+#include "grit/webkit_resources.h"
313
 
+#include "ui/base/l10n/l10n_util.h"
314
 
+
315
 
+// Not a constant but preprocessor definition for easy concatenation.
316
 
+#define kLibunityWebappsEntryPointLibName "libunity-webapps.so.0"
317
 
+
318
 
+namespace options {
319
 
+
320
 
+// TODO: -> extract to function
321
 
+DesktopIntegrationSettingsHandler::DesktopIntegrationSettingsHandler()
322
 
+    : lib_unity_webapps_handle_(NULL),
323
 
+      get_all_func_handle_(NULL),
324
 
+      remove_from_permissions_func_handle_(NULL),
325
 
+      add_allowed_domain_func_handle_(NULL),
326
 
+      is_integration_allowed_func_handle_(NULL),
327
 
+      set_integration_allowed_func_handle_(NULL) {
328
 
+}
329
 
+
330
 
+DesktopIntegrationSettingsHandler::~DesktopIntegrationSettingsHandler() {
331
 
+  if (lib_unity_webapps_handle_) {
332
 
+    dlclose (lib_unity_webapps_handle_);
333
 
+    lib_unity_webapps_handle_ = NULL;
334
 
+
335
 
+    remove_from_permissions_func_handle_ = NULL;
336
 
+    get_all_func_handle_ = NULL;
337
 
+    add_allowed_domain_func_handle_ = NULL;
338
 
+    is_integration_allowed_func_handle_ = NULL;
339
 
+    set_integration_allowed_func_handle_ = NULL;
340
 
+  }
341
 
+}
342
 
+
343
 
+/////////////////////////////////////////////////////////////////////////////
344
 
+// OptionsPageUIHandler implementation:
345
 
+void DesktopIntegrationSettingsHandler::GetLocalizedValues(
346
 
+    DictionaryValue* localized_strings) {
347
 
+  DCHECK(localized_strings);
348
 
+
349
 
+  static OptionsStringResource resources[] = {
350
 
+    { "desktopIntegrationInfoText",
351
 
+      IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_DESCRIPTION }
352
 
+  };
353
 
+
354
 
+  localized_strings->SetString("add_button",
355
 
+      l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_BUTTON));
356
 
+  localized_strings->SetString("add_desktop_website_input_label",
357
 
+      l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TEXT));
358
 
+  localized_strings->SetString("add_desktop_website_title",
359
 
+      l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INTEGRATION_WEBSITE_ADD_TITLE));
360
 
+
361
 
+  RegisterStrings(localized_strings, resources, arraysize(resources));
362
 
+  RegisterTitle(localized_strings, "desktopIntegrationPage",
363
 
+                IDS_DESKTOP_INTEGRATION_SETTINGS_OVERLAY_TITLE);
364
 
+}
365
 
+
366
 
+void DesktopIntegrationSettingsHandler::InitializeHandler() {
367
 
+  if (!IsUnityWebappsInitialized()) {
368
 
+    LoadUnityWebappsEntryPoint();
369
 
+  }
370
 
+}
371
 
+
372
 
+void DesktopIntegrationSettingsHandler::InitializePage() {
373
 
+  DCHECK(IsUnityWebappsInitialized());
374
 
+  LoadIntegratedWebsitesData();
375
 
+}
376
 
+
377
 
+void DesktopIntegrationSettingsHandler::RegisterMessages() {
378
 
+  web_ui()->RegisterMessageCallback(
379
 
+      std::string("addIntegrationSite"),
380
 
+      base::Bind(&DesktopIntegrationSettingsHandler::AddIntegrationSite,
381
 
+                 base::Unretained(this)));
382
 
+  web_ui()->RegisterMessageCallback(
383
 
+      std::string("setDesktopIntegrationAllowed"),
384
 
+      base::Bind(&DesktopIntegrationSettingsHandler::SetDesktopIntegrationAllowed,
385
 
+                 base::Unretained(this)));
386
 
+  web_ui()->RegisterMessageCallback(
387
 
+      std::string("removeIntegrationSite"),
388
 
+      base::Bind(&DesktopIntegrationSettingsHandler::RemoveIntegrationSite,
389
 
+                 base::Unretained(this)));
390
 
+  web_ui()->RegisterMessageCallback(
391
 
+      std::string("updateIntegratedWebsitesList"),
392
 
+      base::Bind(&DesktopIntegrationSettingsHandler::UpdateIntegratedWebsitesList,
393
 
+                 base::Unretained(this)));
394
 
+}
395
 
+
396
 
+void DesktopIntegrationSettingsHandler::LoadUnityWebappsEntryPoint() {
397
 
+  DCHECK(!IsUnityWebappsInitialized());
398
 
+
399
 
+  // TODO run on FILE thread
400
 
+  static const char* const search_paths[] = {
401
 
+    kLibunityWebappsEntryPointLibName,
402
 
+    "/usr/local/lib/" kLibunityWebappsEntryPointLibName
403
 
+    , "/usr/lib/" kLibunityWebappsEntryPointLibName
404
 
+  };
405
 
+
406
 
+  void * handle = NULL;
407
 
+  for (size_t i = 0; i < sizeof(search_paths)/sizeof(search_paths[0]); ++i) {
408
 
+    DCHECK(handle == NULL);
409
 
+    // TODO validate path?
410
 
+    handle = dlopen (search_paths[i], RTLD_LAZY|RTLD_GLOBAL);
411
 
+    if (handle) {
412
 
+      LOG(INFO) << "Found libunitywebapps entry point:" << search_paths[i];
413
 
+      break;
414
 
+    }
415
 
+  }
416
 
+  if (!handle) {
417
 
+    LOG(INFO) << "Could not load Unity Webapps entry point library";
418
 
+    return;
419
 
+  }
420
 
+
421
 
+  void * get_all_handle =
422
 
+    dlsym (handle, "unity_webapps_permissions_get_all_domains");
423
 
+  void * remove_from_permissions_handle =
424
 
+    dlsym (handle, "unity_webapps_permissions_remove_domain_from_permissions");
425
 
+  void * add_allowed_domain_handle =
426
 
+    dlsym (handle, "unity_webapps_permissions_allow_domain");
427
 
+  void * is_integration_allowed_handle =
428
 
+    dlsym (handle, "unity_webapps_permissions_is_integration_allowed");
429
 
+  void * set_integration_allowed_handle =
430
 
+    dlsym (handle, "unity_webapps_permissions_set_integration_allowed");
431
 
+
432
 
+  if (!get_all_handle ||
433
 
+      !remove_from_permissions_handle ||
434
 
+      !add_allowed_domain_handle ||
435
 
+      !is_integration_allowed_handle ||
436
 
+      !set_integration_allowed_handle) {
437
 
+    LOG(WARNING) << "Could not load Unity Webapps entry point functions";
438
 
+    dlclose(handle);
439
 
+    return;
440
 
+  }
441
 
+
442
 
+  // TODO(FIXME): cleanup that mess
443
 
+  lib_unity_webapps_handle_ = handle;
444
 
+  get_all_func_handle_ = get_all_handle;
445
 
+  remove_from_permissions_func_handle_ = remove_from_permissions_handle;
446
 
+  add_allowed_domain_func_handle_ = add_allowed_domain_handle;
447
 
+  is_integration_allowed_func_handle_ = is_integration_allowed_handle;
448
 
+  set_integration_allowed_func_handle_ = set_integration_allowed_handle;
449
 
+}
450
 
+
451
 
+bool DesktopIntegrationSettingsHandler::IsUnityWebappsInitialized() const {
452
 
+  return NULL != lib_unity_webapps_handle_
453
 
+    && NULL != get_all_func_handle_
454
 
+    && NULL != remove_from_permissions_func_handle_
455
 
+    && NULL != add_allowed_domain_func_handle_
456
 
+    && NULL != is_integration_allowed_func_handle_
457
 
+    && NULL != set_integration_allowed_func_handle_;
458
 
+}
459
 
+
460
 
+void DesktopIntegrationSettingsHandler::LoadIntegratedWebsitesData() {
461
 
+  if (!IsUnityWebappsInitialized()) {
462
 
+    web_ui()->CallJavascriptFunction(
463
 
+        "BrowserOptions.disableDesktopIntegration");
464
 
+    LOG(INFO) << "Disabling Desktop Integration options";
465
 
+    return;
466
 
+  }
467
 
+
468
 
+  typedef gboolean (* IsIntegrationAllowedFunc) (void);
469
 
+  gboolean isallowed =
470
 
+    ((IsIntegrationAllowedFunc) is_integration_allowed_func_handle_) ();
471
 
+  web_ui()->CallJavascriptFunction(
472
 
+       "BrowserOptions.setDesktopIntegrationIsAllowed",
473
 
+       base::FundamentalValue(isallowed));
474
 
+}
475
 
+
476
 
+void DesktopIntegrationSettingsHandler::UpdateIntegratedWebsitesList(
477
 
+    const base::ListValue* args) {
478
 
+  DCHECK(IsUnityWebappsInitialized());
479
 
+
480
 
+  // TODO move elsewhere
481
 
+  typedef gchar* (* GetAllDomainsFunc) (void);
482
 
+
483
 
+  gchar* all_domains = ((GetAllDomainsFunc) get_all_func_handle_) ();
484
 
+  if (all_domains) { 
485
 
+    web_ui()->CallJavascriptFunction(
486
 
+        "DesktopIntegrationOverlay.setIntegratedWebsites",
487
 
+        StringValue(all_domains));
488
 
+  }
489
 
+}
490
 
+
491
 
+void DesktopIntegrationSettingsHandler::SetDesktopIntegrationAllowed(
492
 
+    const base::ListValue* args) {
493
 
+  DCHECK(IsUnityWebappsInitialized());
494
 
+
495
 
+  // TODO move elsewhere
496
 
+  typedef void (* SetDesktopIntegrationAllowedFunc) (gboolean);
497
 
+
498
 
+  bool is_allowed;
499
 
+  if (!args->GetBoolean(0, &is_allowed)) {
500
 
+    NOTREACHED();
501
 
+    return;
502
 
+  }
503
 
+
504
 
+  LOG(INFO) << "Setting desktop integration:" << is_allowed;
505
 
+
506
 
+  ((SetDesktopIntegrationAllowedFunc) set_integration_allowed_func_handle_) (
507
 
+      is_allowed ? TRUE : FALSE);
508
 
+}
509
 
+
510
 
+void DesktopIntegrationSettingsHandler::AddIntegrationSite(
511
 
+    const base::ListValue* args) {
512
 
+  DCHECK(IsUnityWebappsInitialized());
513
 
+
514
 
+  // TODO move elsewhere
515
 
+  typedef void (* AddDomainFromPermissionsFunc) (gchar *);
516
 
+
517
 
+  std::string domain;
518
 
+  if (!args->GetString(0, &domain)) {
519
 
+    NOTREACHED();
520
 
+    return;
521
 
+  }
522
 
+
523
 
+  LOG(INFO) << "Adding domain:" << domain << " to the list of websites allowed";
524
 
+
525
 
+  ((AddDomainFromPermissionsFunc) add_allowed_domain_func_handle_) (
526
 
+      const_cast<gchar *>(domain.c_str()));
527
 
+
528
 
+  LoadIntegratedWebsitesData ();
529
 
+}
530
 
+
531
 
+void DesktopIntegrationSettingsHandler::RemoveIntegrationSite(
532
 
+    const base::ListValue* args) {
533
 
+  DCHECK(IsUnityWebappsInitialized());
534
 
+
535
 
+  // TODO move elsewhere
536
 
+  typedef void (* RemoveDomainFromPermissionsFunc) (gchar *);
537
 
+
538
 
+  std::string domain;
539
 
+  if (!args->GetString(0, &domain)) {
540
 
+    NOTREACHED();
541
 
+    return;
542
 
+  }
543
 
+
544
 
+  LOG(INFO) << "Removing domain:" << domain << " from the list of websites not prompting integration";
545
 
+
546
 
+  ((RemoveDomainFromPermissionsFunc) remove_from_permissions_func_handle_) (
547
 
+      const_cast<gchar *>(domain.c_str()));
548
 
+
549
 
+  LoadIntegratedWebsitesData ();
550
 
+}
551
 
+
552
 
+}  // namespace options
553
 
Index: src/chrome/browser/ui/webui/options/desktop_integration_settings_handler.h
554
 
===================================================================
555
 
--- src/chrome/browser/ui/webui/options/desktop_integration_settings_handler.h  (revision 0)
556
 
+++ src/chrome/browser/ui/webui/options/desktop_integration_settings_handler.h  (working copy)
557
 
@@ -0,0 +1,76 @@
558
 
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
559
 
+// Use of this source code is governed by a BSD-style license that can be
560
 
+// found in the LICENSE file.
561
 
+
562
 
+#ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
563
 
+#define CHROME_BROWSER_UI_WEBUI_OPTIONS_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
564
 
+
565
 
+#include <string>
566
 
+
567
 
+#include "base/compiler_specific.h"
568
 
+#include "chrome/browser/ui/webui/options/options_ui.h"
569
 
+
570
 
+namespace base {
571
 
+class DictionaryValue;
572
 
+class ListValue;
573
 
+}
574
 
+
575
 
+namespace options {
576
 
+
577
 
+class DesktopIntegrationSettingsHandler : public OptionsPageUIHandler {
578
 
+ public:
579
 
+  DesktopIntegrationSettingsHandler();
580
 
+  virtual ~DesktopIntegrationSettingsHandler();
581
 
+
582
 
+  // OptionsPageUIHandler implementation.
583
 
+  virtual void GetLocalizedValues(
584
 
+      base::DictionaryValue* localized_strings) OVERRIDE;
585
 
+  virtual void InitializeHandler() OVERRIDE;
586
 
+  virtual void InitializePage() OVERRIDE;
587
 
+  virtual void RegisterMessages() OVERRIDE;
588
 
+
589
 
+ private:
590
 
+
591
 
+  // Loads the data associated with the currently integrated websites.
592
 
+  void LoadIntegratedWebsitesData();
593
 
+
594
 
+  // Initializes the list of website domain names that are currently
595
 
+  // either allowed or 'dontask' and send it to the overlay.
596
 
+  void LoadUnityWebappsEntryPoint();
597
 
+
598
 
+  // Removes an website from the list of integrated websites that won't prompt
599
 
+  // from integration.
600
 
+  // |args| - A string, the domain name of the website to remove.
601
 
+  void RemoveIntegrationSite(const base::ListValue* args);
602
 
+
603
 
+  // Adds an website from the list of integrated websites that won't prompt
604
 
+  // from integration. The website is being added to the list of 'allowed' sites.
605
 
+  // |args| - A string, the domain name of the website to add.
606
 
+  void AddIntegrationSite(const base::ListValue* args);
607
 
+
608
 
+  // Updates the integration allowed flag.
609
 
+  // |args| - A boolean flag indicating if integration should be allowed
610
 
+  void SetDesktopIntegrationAllowed(const base::ListValue* args);
611
 
+
612
 
+  // Updates the list of integrated websites.
613
 
+  void UpdateIntegratedWebsitesList(const base::ListValue* args);
614
 
+
615
 
+  // Predicate informing if we have been able to initialize the connection
616
 
+  // with the unity-webapps library (entry point for website integration
617
 
+  // permissions).
618
 
+  bool IsUnityWebappsInitialized() const;
619
 
+
620
 
+  // 
621
 
+  void * lib_unity_webapps_handle_;
622
 
+  void * get_all_func_handle_;
623
 
+  void * remove_from_permissions_func_handle_;
624
 
+  void * add_allowed_domain_func_handle_;
625
 
+  void * is_integration_allowed_func_handle_;
626
 
+  void * set_integration_allowed_func_handle_;
627
 
+
628
 
+  DISALLOW_COPY_AND_ASSIGN(DesktopIntegrationSettingsHandler);
629
 
+};
630
 
+
631
 
+}  // namespace options
632
 
+
633
 
+#endif  // CHROME_BROWSER_UI_WEBUI_OPTIONS_DESKTOP_INTEGRATION_SETTINGS_HANDLER2_H_
634
 
Index: src/chrome/browser/resources/options/desktop_integration_overlay.css
635
 
===================================================================
636
 
--- src/chrome/browser/resources/options/desktop_integration_overlay.css        (revision 0)
637
 
+++ src/chrome/browser/resources/options/desktop_integration_overlay.css        (working copy)
638
 
@@ -0,0 +1,71 @@
639
 
+/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
640
 
+ * Use of this source code is governed by a BSD-style license that can be
641
 
+ * found in the LICENSE file. */
642
 
+
643
 
+#desktop-integration-options {
644
 
+  min-width: 550px;
645
 
+}
646
 
+
647
 
+#desktop-integration-options list {
648
 
+  min-height: 172px;
649
 
+}
650
 
+
651
 
+.desktop-integration-list-item {
652
 
+  -webkit-box-flex: 1;
653
 
+  -webkit-padding-start: 8px;
654
 
+  overflow: hidden;
655
 
+  text-overflow: ellipsis;
656
 
+}
657
 
+
658
 
+.desktop-integration-lower-left button {
659
 
+  min-width: 70px;
660
 
+}
661
 
+
662
 
+.desktop-integration-lower-left {
663
 
+  -webkit-box-flex: 0;
664
 
+  -webkit-padding-start: 12px;
665
 
+  padding-bottom: 10px;
666
 
+}
667
 
+
668
 
+#desktop-integration-column-headers {
669
 
+  -webkit-margin-start: 17px;
670
 
+  display: -webkit-box;
671
 
+  margin-top: 17px;
672
 
+}
673
 
+
674
 
+#desktop-integration-column-headers > div {
675
 
+  font-weight: bold;
676
 
+}
677
 
+
678
 
+#desktop-integration-pattern-column {
679
 
+  -webkit-box-flex: 1;
680
 
+}
681
 
+
682
 
+#desktop-integration-behavior-column {
683
 
+  width: 145px;
684
 
+}
685
 
+
686
 
+#desktop-integration-area list {
687
 
+  margin-bottom: 10px;
688
 
+  margin-top: 4px;
689
 
+}
690
 
+
691
 
+#domains-list {
692
 
+  -webkit-box-flex: 1;
693
 
+  outline: none;
694
 
+  padding: 1px 0 0;
695
 
+  width: 100%;
696
 
+}
697
 
+
698
 
+#domains-list .domain-name {
699
 
+  -webkit-box-flex: 1;
700
 
+  overflow: hidden;
701
 
+  text-overflow: ellipsis;
702
 
+  white-space: nowrap;
703
 
+}
704
 
+
705
 
+#domains-list li {
706
 
+  -webkit-padding-start: 12px;
707
 
+  padding-bottom: 2px;
708
 
+  padding-top: 2px;
709
 
+}
710
 
Index: src/chrome/browser/resources/options/desktop_integration_add_website_overlay.html
711
 
===================================================================
712
 
--- src/chrome/browser/resources/options/desktop_integration_add_website_overlay.html   (revision 0)
713
 
+++ src/chrome/browser/resources/options/desktop_integration_add_website_overlay.html   (working copy)
714
 
@@ -0,0 +1,16 @@
715
 
+<div id="add-desktop-integration-website-overlay-page" class="page" hidden>
716
 
+  <div class="close-button"></div>
717
 
+  <h1 i18n-content="add_desktop_website_title"></h1>
718
 
+
719
 
+  <div class="content-area">
720
 
+    <span i18n-content="add_desktop_website_input_label"></span>
721
 
+    <input id="integration-domain-url-field" type="url" data-type="url"
722
 
+           class="weakrtl favicon-cell hbox stretch">
723
 
+  </div>
724
 
+
725
 
+  <div class="action-area button-strip">
726
 
+    <button id="add-integration-website-overlay-cancel-button" i18n-content="cancel">
727
 
+    </button>
728
 
+    <button id="add-integration-website-overlay-ok-button" i18n-content="ok"></button>
729
 
+  </div>
730
 
+</div>
731
 
Index: src/chrome/browser/resources/options/desktop_integration_overlay.html
732
 
===================================================================
733
 
--- src/chrome/browser/resources/options/desktop_integration_overlay.html       (revision 0)
734
 
+++ src/chrome/browser/resources/options/desktop_integration_overlay.html       (working copy)
735
 
@@ -0,0 +1,26 @@
736
 
+<div id="desktop-integration-area" class="page" hidden>
737
 
+
738
 
+  <div class="close-button"></div>
739
 
+  <h1 i18n-content="desktopIntegrationPage"></h1>
740
 
+  
741
 
+  <span i18n-content="desktopIntegrationInfoText"></span>
742
 
743
 
+  <div class="content-area">
744
 
+    <list id="domains-list"></list>
745
 
+
746
 
+    <div class="desktop-integration-lower-left">
747
 
+      <button id="desktop-integration-add-button"
748
 
+              i18n-content="add_button"></button>
749
 
+    </div>
750
 
+  </div>
751
 
+
752
 
+  <div class="action-area">
753
 
+    <div class="button-strip">
754
 
+      <button id="desktop-integrations-overlay-confirm"
755
 
+          i18n-content="ok">
756
 
+      </button>
757
 
+    </div>
758
 
+  </div>
759
 
+
760
 
+</div>
761
 
+
762
 
Index: src/chrome/browser/resources/options/desktop_integration_overlay.js
763
 
===================================================================
764
 
--- src/chrome/browser/resources/options/desktop_integration_overlay.js (revision 0)
765
 
+++ src/chrome/browser/resources/options/desktop_integration_overlay.js (working copy)
766
 
@@ -0,0 +1,203 @@
767
 
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
768
 
+// Use of this source code is governed by a BSD-style license that can be
769
 
+// found in the LICENSE file.
770
 
+
771
 
+cr.define('options', function() {
772
 
+  /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
773
 
+  /** @const */ var DeletableItemList = options.DeletableItemList;
774
 
+  /** @const */ var DeletableItem = options.DeletableItem;
775
 
+
776
 
+  /**
777
 
+   * Creates a new exceptions list item.
778
 
+   * @constructor
779
 
+   * @extends {options.DeletableItem}
780
 
+   */
781
 
+  function IntegratedWebsitesListItem(domain) {
782
 
+    var el = cr.doc.createElement('div');
783
 
+    el.__proto__ = IntegratedWebsitesListItem.prototype;
784
 
+    el.domain = domain;
785
 
+    el.decorate();
786
 
+    return el;
787
 
+  }
788
 
+
789
 
+  IntegratedWebsitesListItem.prototype = {
790
 
+    __proto__: DeletableItem.prototype,
791
 
+
792
 
+    /**
793
 
+     * Called when an element is decorated as a list item.
794
 
+     */
795
 
+    decorate: function() {
796
 
+      DeletableItem.prototype.decorate.call(this);
797
 
+
798
 
+      // The stored label.
799
 
+      var label = this.ownerDocument.createElement('div');
800
 
+      label.className = 'domain-name';
801
 
+      label.textContent = this.domain;
802
 
+      this.contentElement.appendChild(label);
803
 
+
804
 
+      this.deletable = true;
805
 
+    },
806
 
+  };
807
 
+
808
 
+  /**
809
 
+   * Creates a integrated websites list.
810
 
+   * @constructor
811
 
+   * @extends {cr.ui.List}
812
 
+   */
813
 
+  var IntegratedWebsitesList = cr.ui.define('list');
814
 
+
815
 
+  IntegratedWebsitesList.prototype = {
816
 
+    __proto__: DeletableItemList.prototype,
817
 
+
818
 
+    /**
819
 
+     * Called when an element is decorated as a list.
820
 
+     */
821
 
+    decorate: function() {
822
 
+      DeletableItemList.prototype.decorate.call(this);
823
 
+      this.reset();
824
 
+    },
825
 
+
826
 
+    /** @inheritDoc */
827
 
+    createItem: function(domain) {
828
 
+      return new IntegratedWebsitesListItem(domain);
829
 
+    },
830
 
+
831
 
+    /*
832
 
+     * Adds a website domain name to the list of allowed integrated websites.
833
 
+     * @param {string} domain domain name of the website to add.
834
 
+     */
835
 
+    addWebsite: function(domain) {
836
 
+      if (!domain || this.dataModel.indexOf(domain) >= 0) {
837
 
+        return;
838
 
+      }
839
 
+      this.dataModel.push(domain);
840
 
+      this.redraw();
841
 
+      chrome.send('addIntegrationSite', [domain]);
842
 
+    },
843
 
+
844
 
+    /**
845
 
+     * Forces a revailidation of the list content. Content added while the list
846
 
+     * is hidden is not properly rendered when the list becomes visible. In
847
 
+     * addition, deleting a single item from the list results in a stale cache
848
 
+     * requiring an invalidation.
849
 
+     */
850
 
+    refresh: function() {
851
 
+      // TODO(kevers): Investigate if the root source of the problems can be
852
 
+      // fixed in cr.ui.list.
853
 
+      this.invalidate();
854
 
+      this.redraw();
855
 
+    },
856
 
+
857
 
+    /**
858
 
+     * Sets the integrated websites in the js model.
859
 
+     * @param {Object} entries A list of dictionaries of values, each dictionary
860
 
+     *     represents an exception.
861
 
+     */
862
 
+    setIntegratedWebsites: function(entries) {
863
 
+      var integratedWebsites = null;
864
 
+      try {
865
 
+        integratedWebsites = JSON.parse(entries);
866
 
+      } catch(e) {
867
 
+        console.log("Error while parsing integrated websites json: " + entries);
868
 
+        return;
869
 
+      }
870
 
+      // TODO hightlight domains differently based on permission
871
 
+      var domains = [];
872
 
+      domains = domains.concat(integratedWebsites['allowed']);
873
 
+      domains = domains.concat(integratedWebsites['dontask']);
874
 
+      this.dataModel = new ArrayDataModel(domains);
875
 
+      this.refresh();
876
 
+    },
877
 
+
878
 
+    /**
879
 
+     * Removes all integration scripts from the js model.
880
 
+     */
881
 
+    reset: function() {
882
 
+      this.dataModel = new ArrayDataModel([]);
883
 
+    },
884
 
+
885
 
+    /** @inheritDoc */
886
 
+    deleteItemAtIndex: function(index) {
887
 
+      if (index >= 0) {
888
 
+        var args = [this.dataModel.item(index)];
889
 
+        chrome.send('removeIntegrationSite', args);
890
 
+        this.dataModel.splice(index, 1);
891
 
+      }
892
 
+    },
893
 
+
894
 
+    /**
895
 
+     * The length of the list.
896
 
+     */
897
 
+    get length() {
898
 
+      return null != this.dataModel ? this.dataModel.length : 0;
899
 
+    },
900
 
+  };
901
 
+
902
 
+  var OptionsPage = options.OptionsPage;
903
 
+
904
 
+  /**
905
 
+   * DesktopIntegrationOverlay class
906
 
+   * Encapsulated handling of the 'Desktop integration' page.
907
 
+   * @class
908
 
+   */
909
 
+  function DesktopIntegrationOverlay() {
910
 
+    OptionsPage.call(this, 'desktopIntegrationOverlay',
911
 
+                     loadTimeData.getString('desktopIntegrationPage'),
912
 
+                     'desktop-integration-area');
913
 
+  }
914
 
+
915
 
+  cr.addSingletonGetter(DesktopIntegrationOverlay);
916
 
+
917
 
+  DesktopIntegrationOverlay.prototype = {
918
 
+    __proto__: OptionsPage.prototype,
919
 
+
920
 
+    /**
921
 
+     * Initialize the page.
922
 
+     */
923
 
+    initializePage: function() {
924
 
+      OptionsPage.prototype.initializePage.call(this);
925
 
+
926
 
+      var integrationList = $('domains-list');
927
 
+      IntegratedWebsitesList.decorate(integrationList);
928
 
+      $('desktop-integrations-overlay-confirm').onclick =
929
 
+          OptionsPage.closeOverlay.bind(OptionsPage);
930
 
+
931
 
+      // Set up add button.
932
 
+      $('desktop-integration-add-button').onclick = function(e) {
933
 
+        OptionsPage.navigateToPage('addDesktopIntegrationWebsite');
934
 
+      };
935
 
+
936
 
+      // Listen to add website dialog ok button.
937
 
+      var addWebsiteOkButton = $('add-integration-website-overlay-ok-button');
938
 
+      addWebsiteOkButton.addEventListener('click',
939
 
+          this.handleAddWebsiteOkButtonClick_.bind(this));
940
 
+    },
941
 
+
942
 
+    handleAddWebsiteOkButtonClick_: function () {
943
 
+      var website = $('integration-domain-url-field').value;
944
 
+      var integratedDomain = website.replace(/\s*/g, '')
945
 
+      console.log (integratedDomain);
946
 
+      $('domains-list').addWebsite(integratedDomain);
947
 
+      OptionsPage.closeOverlay();
948
 
+    },
949
 
+
950
 
+    /**
951
 
+     * Called by the options page when this page has been shown.
952
 
+     */
953
 
+    didShowPage: function() {
954
 
+      chrome.send('updateIntegratedWebsitesList');
955
 
+    },
956
 
+  };
957
 
+
958
 
+  DesktopIntegrationOverlay.setIntegratedWebsites = function(entries) {
959
 
+    $('domains-list').setIntegratedWebsites(entries);
960
 
+  };
961
 
+
962
 
+  // Export
963
 
+  return {
964
 
+    IntegratedWebsitesListItem: IntegratedWebsitesListItem,
965
 
+    IntegratedWebsitesList: IntegratedWebsitesList,
966
 
+    DesktopIntegrationOverlay: DesktopIntegrationOverlay
967
 
+  };
968
 
+});
969
 
+
970
 
Index: src/chrome/browser/resources/options/desktop_integration_add_website_overlay.js
971
 
===================================================================
972
 
--- src/chrome/browser/resources/options/desktop_integration_add_website_overlay.js     (revision 0)
973
 
+++ src/chrome/browser/resources/options/desktop_integration_add_website_overlay.js     (working copy)
974
 
@@ -0,0 +1,47 @@
975
 
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
976
 
+// Use of this source code is governed by a BSD-style license that can be
977
 
+// found in the LICENSE file.
978
 
+
979
 
+///////////////////////////////////////////////////////////////////////////////
980
 
+// AddDesktopIntegrationWebsiteOverlay class:
981
 
+
982
 
+cr.define('options', function() {
983
 
+  /** @const */ var OptionsPage = options.OptionsPage;
984
 
+
985
 
+  /**
986
 
+   * @constructor
987
 
+   */
988
 
+  function AddDesktopIntegrationWebsiteOverlay() {
989
 
+    OptionsPage.call(this, 'addDesktopIntegrationWebsite',
990
 
+                     loadTimeData.getString('add_button'),
991
 
+                     'add-desktop-integration-website-overlay-page');
992
 
+  }
993
 
+
994
 
+  cr.addSingletonGetter(AddDesktopIntegrationWebsiteOverlay);
995
 
+
996
 
+  AddDesktopIntegrationWebsiteOverlay.prototype = {
997
 
+    // Inherit AddDesktopIntegrationWebsiteOverlay from OptionsPage.
998
 
+    __proto__: OptionsPage.prototype,
999
 
+
1000
 
+    /**
1001
 
+     * Initializes AddDesktopIntegrationWebsiteOverlay page.
1002
 
+     * Calls base class implementation to starts preference initialization.
1003
 
+     */
1004
 
+    initializePage: function() {
1005
 
+      // Call base class implementation to starts preference initialization.
1006
 
+      OptionsPage.prototype.initializePage.call(this);
1007
 
+      
1008
 
+      // Cleanup any previously entered text.
1009
 
+      $('integration-domain-url-field').value = '';
1010
 
+
1011
 
+      // Set up the cancel button.
1012
 
+      $('add-integration-website-overlay-cancel-button').onclick = function(e) {
1013
 
+        OptionsPage.closeOverlay();
1014
 
+      };
1015
 
+    },
1016
 
+  };
1017
 
+
1018
 
+  return {
1019
 
+    AddDesktopIntegrationWebsiteOverlay: AddDesktopIntegrationWebsiteOverlay
1020
 
+  };
1021
 
+});