summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsargrass@google.com <sargrass@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 21:55:15 +0000
committersargrass@google.com <sargrass@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 21:55:15 +0000
commit8e37a7c3177865b339724cac41ba5463b5b0b89e (patch)
tree5b83c636e22a691db6e9d1457777c0ebe596463b
parent42dc0c200a52e7644f22156c4839ae414ae941d6 (diff)
downloadchromium_src-8e37a7c3177865b339724cac41ba5463b5b0b89e.zip
chromium_src-8e37a7c3177865b339724cac41ba5463b5b0b89e.tar.gz
chromium_src-8e37a7c3177865b339724cac41ba5463b5b0b89e.tar.bz2
Stop Syncing Overlay and Import Data Overlay
BUG=48883 TEST=Exercise Personal Stuff page via --enabled-tabbed-options Review URL: http://codereview.chromium.org/3038016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54032 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/clear_browser_data_handler.h1
-rw-r--r--chrome/browser/dom_ui/import_data_handler.cc71
-rw-r--r--chrome/browser/dom_ui/import_data_handler.h34
-rw-r--r--chrome/browser/dom_ui/options_ui.cc4
-rw-r--r--chrome/browser/dom_ui/personal_options_handler.cc32
-rw-r--r--chrome/browser/dom_ui/personal_options_handler.h6
-rw-r--r--chrome/browser/dom_ui/stop_syncing_handler.cc48
-rw-r--r--chrome/browser/dom_ui/stop_syncing_handler.h28
-rw-r--r--chrome/browser/resources/options.html11
-rw-r--r--chrome/browser/resources/options/import_data_overlay.html28
-rw-r--r--chrome/browser/resources/options/import_data_overlay.js64
-rw-r--r--chrome/browser/resources/options/personal_options.html12
-rw-r--r--chrome/browser/resources/options/personal_options.js30
-rw-r--r--chrome/browser/resources/options/stop_syncing_overlay.html8
-rw-r--r--chrome/browser/resources/options/stop_syncing_overlay.js38
-rw-r--r--chrome/chrome_browser.gypi6
16 files changed, 397 insertions, 24 deletions
diff --git a/chrome/browser/dom_ui/clear_browser_data_handler.h b/chrome/browser/dom_ui/clear_browser_data_handler.h
index c5ff399..8345598 100644
--- a/chrome/browser/dom_ui/clear_browser_data_handler.h
+++ b/chrome/browser/dom_ui/clear_browser_data_handler.h
@@ -36,4 +36,3 @@ class ClearBrowserDataHandler : public OptionsPageUIHandler,
};
#endif // CHROME_BROWSER_DOM_UI_CLEAR_BROWSER_DATA_HANDLER_H_
-
diff --git a/chrome/browser/dom_ui/import_data_handler.cc b/chrome/browser/dom_ui/import_data_handler.cc
new file mode 100644
index 0000000..dac2ee4
--- /dev/null
+++ b/chrome/browser/dom_ui/import_data_handler.cc
@@ -0,0 +1,71 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/dom_ui/import_data_handler.h"
+
+#include "app/l10n_util.h"
+#include "base/basictypes.h"
+#include "base/values.h"
+#include "base/callback.h"
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
+#include "chrome/browser/importer/importer_data_types.h"
+
+ImportDataHandler::ImportDataHandler() {
+}
+
+ImportDataHandler::~ImportDataHandler() {
+}
+
+void ImportDataHandler::Initialize() {
+ importer_host_ = new ImporterHost();
+ DetectSupportedBrowsers();
+}
+
+void ImportDataHandler::GetLocalizedValues(
+ DictionaryValue* localized_strings) {
+ DCHECK(localized_strings);
+ localized_strings->SetString(L"import_data_title",
+ l10n_util::GetString(IDS_IMPORT_SETTINGS_TITLE));
+ localized_strings->SetString(L"import_from_label",
+ l10n_util::GetString(IDS_IMPORT_FROM_LABEL));
+ localized_strings->SetString(L"import_commit",
+ l10n_util::GetString(IDS_IMPORT_COMMIT));
+ localized_strings->SetString(L"import_description",
+ l10n_util::GetString(IDS_IMPORT_ITEMS_LABEL));
+ localized_strings->SetString(L"import_favorites",
+ l10n_util::GetString(IDS_IMPORT_FAVORITES_CHKBOX));
+ localized_strings->SetString(L"import_search",
+ l10n_util::GetString(IDS_IMPORT_SEARCH_ENGINES_CHKBOX));
+ localized_strings->SetString(L"import_passwords",
+ l10n_util::GetString(IDS_IMPORT_PASSWORDS_CHKBOX));
+ localized_strings->SetString(L"import_history",
+ l10n_util::GetString(IDS_IMPORT_HISTORY_CHKBOX));
+}
+
+void ImportDataHandler::RegisterMessages() {
+}
+
+void ImportDataHandler::DetectSupportedBrowsers() {
+ ListValue supported_browsers;
+ int profiles_count = importer_host_->GetAvailableProfileCount();
+
+ if (profiles_count > 0) {
+ for (int i = 0; i < profiles_count; i++) {
+ std::wstring profile = importer_host_->GetSourceProfileNameAt(i);
+ DictionaryValue* entry = new DictionaryValue();
+ entry->SetString(L"name", profile);
+ entry->SetInteger(L"index", i);
+ supported_browsers.Append(entry);
+ }
+ } else {
+ DictionaryValue* entry = new DictionaryValue();
+ entry->SetString(L"name", l10n_util::GetString(IDS_IMPORT_FROM_LABEL));
+ entry->SetInteger(L"index", 0);
+ supported_browsers.Append(entry);
+ }
+
+ dom_ui_->CallJavascriptFunction(
+ L"ImportDataOverlay.updateSupportedBrowsers", supported_browsers);
+}
diff --git a/chrome/browser/dom_ui/import_data_handler.h b/chrome/browser/dom_ui/import_data_handler.h
new file mode 100644
index 0000000..1e86fc6
--- /dev/null
+++ b/chrome/browser/dom_ui/import_data_handler.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DOM_UI_IMPORT_DATA_HANDLER_H_
+#define CHROME_BROWSER_DOM_UI_IMPORT_DATA_HANDLER_H_
+
+#include "chrome/browser/dom_ui/options_ui.h"
+#include "chrome/browser/importer/importer.h"
+
+// Chrome personal stuff import data overlay UI handler.
+class ImportDataHandler : public OptionsPageUIHandler {
+ public:
+ ImportDataHandler();
+ virtual ~ImportDataHandler();
+
+ virtual void Initialize();
+
+ // OptionsUIHandler implementation.
+ virtual void GetLocalizedValues(DictionaryValue* localized_strings);
+
+ // DOMMessageHandler implementation.
+ virtual void RegisterMessages();
+
+ private:
+ void DetectSupportedBrowsers();
+
+ // Utility class that does the actual import.
+ scoped_refptr<ImporterHost> importer_host_;
+
+ DISALLOW_COPY_AND_ASSIGN(ImportDataHandler);
+};
+
+#endif // CHROME_BROWSER_DOM_UI_IMPORT_DATA_HANDLER_H_
diff --git a/chrome/browser/dom_ui/options_ui.cc b/chrome/browser/dom_ui/options_ui.cc
index 84d553d..8aa97de 100644
--- a/chrome/browser/dom_ui/options_ui.cc
+++ b/chrome/browser/dom_ui/options_ui.cc
@@ -25,8 +25,10 @@
#include "chrome/browser/dom_ui/content_settings_handler.h"
#include "chrome/browser/dom_ui/core_options_handler.h"
#include "chrome/browser/dom_ui/font_settings_handler.h"
+#include "chrome/browser/dom_ui/import_data_handler.h"
#include "chrome/browser/dom_ui/personal_options_handler.h"
#include "chrome/browser/dom_ui/search_engine_manager_handler.h"
+#include "chrome/browser/dom_ui/stop_syncing_handler.h"
#include "chrome/browser/dom_ui/sync_options_handler.h"
#include "chrome/browser/dom_ui/dom_ui_theme_source.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -133,6 +135,8 @@ OptionsUI::OptionsUI(TabContents* contents) : DOMUI(contents) {
AddOptionsPageUIHandler(localized_strings, new FontSettingsHandler());
AddOptionsPageUIHandler(localized_strings, new PersonalOptionsHandler());
AddOptionsPageUIHandler(localized_strings, new SearchEngineManagerHandler());
+ AddOptionsPageUIHandler(localized_strings, new ImportDataHandler());
+ AddOptionsPageUIHandler(localized_strings, new StopSyncingHandler());
AddOptionsPageUIHandler(localized_strings, new SyncOptionsHandler());
#if defined(OS_CHROMEOS)
AddOptionsPageUIHandler(localized_strings,
diff --git a/chrome/browser/dom_ui/personal_options_handler.cc b/chrome/browser/dom_ui/personal_options_handler.cc
index 1db6a8a..8e39ba5 100644
--- a/chrome/browser/dom_ui/personal_options_handler.cc
+++ b/chrome/browser/dom_ui/personal_options_handler.cc
@@ -32,11 +32,6 @@ PersonalOptionsHandler::~PersonalOptionsHandler() {
void PersonalOptionsHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
- FilePath user_data_dir;
- PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
- ProfileManager* profile_manager = g_browser_process->profile_manager();
- Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
- ProfileSyncService* service = profile->GetProfileSyncService();
DCHECK(localized_strings);
//Personal Stuff page
@@ -47,10 +42,6 @@ void PersonalOptionsHandler::GetLocalizedValues(
l10n_util::GetString(IDS_PRODUCT_NAME)));
localized_strings->SetString(L"start_sync",
l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL));
- localized_strings->SetString(L"synced_to_user_with_time",
- l10n_util::GetStringF(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME,
- UTF16ToWide(service->GetAuthenticatedUsername()),
- service->GetLastSyncedTimeString()));
localized_strings->SetString(L"sync_customize",
l10n_util::GetString(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL));
localized_strings->SetString(L"stop_sync",
@@ -103,3 +94,26 @@ void PersonalOptionsHandler::GetLocalizedValues(
l10n_util::GetString(IDS_THEMES_DEFAULT_THEME_LABEL));
#endif
}
+
+void PersonalOptionsHandler::RegisterMessages() {
+ DCHECK(dom_ui_);
+ dom_ui_->RegisterMessageCallback(
+ "getSyncStatus",
+ NewCallback(this,&PersonalOptionsHandler::SetSyncStatusUIString));
+}
+
+void PersonalOptionsHandler::SetSyncStatusUIString(const Value* value) {
+ DCHECK(dom_ui_);
+
+ ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
+ if(service != NULL && ProfileSyncService::IsSyncEnabled()) {
+ scoped_ptr<Value> status_string(Value::CreateStringValue(
+ l10n_util::GetStringF(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME,
+ UTF16ToWide(service->GetAuthenticatedUsername()),
+ service->GetLastSyncedTimeString())));
+
+ dom_ui_->CallJavascriptFunction(
+ L"PersonalOptions.syncStatusCallback",
+ *(status_string.get()));
+ }
+}
diff --git a/chrome/browser/dom_ui/personal_options_handler.h b/chrome/browser/dom_ui/personal_options_handler.h
index e667bf8..93f898d 100644
--- a/chrome/browser/dom_ui/personal_options_handler.h
+++ b/chrome/browser/dom_ui/personal_options_handler.h
@@ -7,6 +7,7 @@
#pragma once
#include "chrome/browser/dom_ui/options_ui.h"
+#include "chrome/browser/sync/profile_sync_service.h"
// Chrome personal options page UI handler.
class PersonalOptionsHandler : public OptionsPageUIHandler {
@@ -17,7 +18,12 @@ class PersonalOptionsHandler : public OptionsPageUIHandler {
// OptionsUIHandler implementation.
virtual void GetLocalizedValues(DictionaryValue* localized_strings);
+ // DOMMessageHandler implementation.
+ virtual void RegisterMessages();
+
private:
+ virtual void SetSyncStatusUIString(const Value* value);
+
DISALLOW_COPY_AND_ASSIGN(PersonalOptionsHandler);
};
diff --git a/chrome/browser/dom_ui/stop_syncing_handler.cc b/chrome/browser/dom_ui/stop_syncing_handler.cc
new file mode 100644
index 0000000..95df28f
--- /dev/null
+++ b/chrome/browser/dom_ui/stop_syncing_handler.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/dom_ui/stop_syncing_handler.h"
+
+#include "app/l10n_util.h"
+#include "base/basictypes.h"
+#include "base/values.h"
+#include "base/callback.h"
+#include "grit/chromium_strings.h"
+#include "grit/generated_resources.h"
+#include "chrome/browser/sync/profile_sync_service.h"
+#include "chrome/browser/profile.h"
+#include "chrome/browser/profile_manager.h"
+
+StopSyncingHandler::StopSyncingHandler() {
+}
+
+StopSyncingHandler::~StopSyncingHandler() {
+}
+
+void StopSyncingHandler::GetLocalizedValues(
+ DictionaryValue* localized_strings) {
+ DCHECK(localized_strings);
+ localized_strings->SetString(L"stop_syncing_explanation",
+ l10n_util::GetStringF(IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL,
+ l10n_util::GetString(IDS_PRODUCT_NAME)));
+ localized_strings->SetString(L"stop_syncing_title",
+ l10n_util::GetString(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE));
+ localized_strings->SetString(L"stop_syncing_confirm",
+ l10n_util::GetString(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL));
+}
+
+void StopSyncingHandler::RegisterMessages() {
+ DCHECK(dom_ui_);
+ dom_ui_->RegisterMessageCallback("stopSyncing",
+ NewCallback(this, &StopSyncingHandler::StopSyncing));
+}
+
+void StopSyncingHandler::StopSyncing(const Value* value){
+ DCHECK(dom_ui_);
+ ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
+ if(service != NULL && ProfileSyncService::IsSyncEnabled()) {
+ service->DisableForUser();
+ ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
+ }
+}
diff --git a/chrome/browser/dom_ui/stop_syncing_handler.h b/chrome/browser/dom_ui/stop_syncing_handler.h
new file mode 100644
index 0000000..f97132b
--- /dev/null
+++ b/chrome/browser/dom_ui/stop_syncing_handler.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DOM_UI_STOP_SYNCING_HANDLER_H_
+#define CHROME_BROWSER_DOM_UI_STOP_SYNCING_HANDLER_H_
+
+#include "chrome/browser/dom_ui/options_ui.h"
+
+// Chrome personal stuff stop syncing overlay UI handler.
+class StopSyncingHandler : public OptionsPageUIHandler {
+ public:
+ StopSyncingHandler();
+ virtual ~StopSyncingHandler();
+
+ // OptionsUIHandler implementation.
+ virtual void GetLocalizedValues(DictionaryValue* localized_strings);
+
+ // DOMMessageHandler implementation.
+ virtual void RegisterMessages();
+
+ private:
+ void StopSyncing(const Value* value);
+
+ DISALLOW_COPY_AND_ASSIGN(StopSyncingHandler);
+};
+
+#endif // CHROME_BROWSER_DOM_UI_STOP_SYNCING_HANDLER_H_
diff --git a/chrome/browser/resources/options.html b/chrome/browser/resources/options.html
index da70394..07d0d58 100644
--- a/chrome/browser/resources/options.html
+++ b/chrome/browser/resources/options.html
@@ -38,8 +38,10 @@
<script src="options/content_settings_exceptions_area.js"></script>
<script src="options/content_settings_ui.js"></script>
<script src="options/font_settings_overlay.js"></script>
+<script src="options/import_data_overlay.js"></script>
<script src="options/personal_options.js"></script>
<script src="options/search_engine_manager.js"></script>
+<script src="options/stop_syncing_overlay.js"></script>
<script>
///////////////////////////////////////////////////////////////////////////////
@@ -72,14 +74,16 @@ function load() {
// 'languagePinyinPage'));
}
+ OptionsPage.register(AdvancedOptions.getInstance());
OptionsPage.register(BrowserOptions.getInstance());
OptionsPage.register(PersonalOptions.getInstance());
- OptionsPage.register(AdvancedOptions.getInstance());
OptionsPage.registerSubPage(ContentSettings.getInstance());
OptionsPage.registerSubPage(SearchEngineManager.getInstance());
OptionsPage.registerOverlay(AddStartupPageOverlay.getInstance());
OptionsPage.registerOverlay(ClearBrowserDataOverlay.getInstance());
OptionsPage.registerOverlay(FontSettingsOverlay.getInstance());
+ OptionsPage.registerOverlay(ImportDataOverlay.getInstance());
+ OptionsPage.registerOverlay(StopSyncingOverlay.getInstance());
if (cr.isChromeOS) {
OptionsPage.register(AccountsOptions.getInstance());
@@ -135,6 +139,11 @@ window.onpopstate = function(e) {
<include src="options/add_startup_page_overlay.html">
<include src="options/clear_browser_data_overlay.html">
<include src="options/font_settings_overlay.html">
+ <include src="options/import_data_overlay.html">
+ <include src="options/stop_syncing_overlay.html">
+ <if expr="pp_ifdef('chromeos')">
+ <include src="options/chromeos_accounts_add_user_overlay.html">
+ </if>
</div>
</div>
<div id="main-content">
diff --git a/chrome/browser/resources/options/import_data_overlay.html b/chrome/browser/resources/options/import_data_overlay.html
new file mode 100644
index 0000000..35d2e3e
--- /dev/null
+++ b/chrome/browser/resources/options/import_data_overlay.html
@@ -0,0 +1,28 @@
+<div class="page hidden" id="importDataOverlay">
+ <h1 i18n-content="import_data_title"></h1>
+ <div>
+ <span i18n-content="import_from_label"></span>
+ <select id="supported-browsers"></select>
+ </div>
+ <div>
+ <span i18n-content="import_description"></span>
+ <label>
+ <input id="import-favorites" type="checkbox">
+ <span i18n-content="import_favorites">
+ </label><br>
+ <label>
+ <input id="import-search" type="checkbox">
+ <span i18n-content="import_search">
+ </label><br>
+ <label>
+ <input id="import-passwords" type="checkbox">
+ <span i18n-content="import_passwords">
+ </label><br>
+ <label>
+ <input id="import-history" type="checkbox">
+ <span i18n-content="import_history">
+ </label><br>
+ </div>
+ <button id="import-data-cancel" i18n-content="cancel"></button>
+ <button id="import-data-commit" i18n-content="import_commit"></button>
+</div>
diff --git a/chrome/browser/resources/options/import_data_overlay.js b/chrome/browser/resources/options/import_data_overlay.js
new file mode 100644
index 0000000..2d8c945
--- /dev/null
+++ b/chrome/browser/resources/options/import_data_overlay.js
@@ -0,0 +1,64 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * ImportDataOverlay class
+ * Encapsulated handling of the 'Import Data' overlay page.
+ * @class
+ */
+function ImportDataOverlay() {
+ OptionsPage.call(this, 'importDataOverlay',
+ templateData.import_data_title,
+ 'importDataOverlay');
+}
+
+cr.addSingletonGetter(ImportDataOverlay);
+
+ImportDataOverlay.prototype = {
+ // Inherit ImportDataOverlay from OptionsPage.
+ __proto__: OptionsPage.prototype,
+
+ /**
+ * Initialize the page.
+ */
+ initializePage: function() {
+ // Call base class implementation to starts preference initialization.
+ OptionsPage.prototype.initializePage.call(this);
+
+ $('import-data-cancel').onclick = function(e) {
+ OptionsPage.clearOverlays();
+ }
+
+ $('import-data-commit').onclick = function(e) {
+ var paramList = new Array();
+ }
+ },
+
+ /**
+ * Clear the supported browsers popup
+ * @private
+ */
+ clearSupportedBrowsers_: function() {
+ $('supported-browsers').textContent = '';
+ },
+
+ /**
+ * Update the supported browsers popup with given entries.
+ * @param {Array} list of supported browsers name.
+ */
+ updateSupportedBrowsers_: function(browsers) {
+ this.clearSupportedBrowsers_();
+ browserSelect = $('supported-browsers');
+ browserCount = browsers.length
+ for (var i = 0; i < browserCount; i++) {
+ var browser = browsers[i]
+ var option = new Option(browser['name'], browser['index']);
+ browserSelect.appendChild(option);
+ }
+ },
+};
+
+ImportDataOverlay.updateSupportedBrowsers = function(browsers) {
+ ImportDataOverlay.getInstance().updateSupportedBrowsers_(browsers);
+}
diff --git a/chrome/browser/resources/options/personal_options.html b/chrome/browser/resources/options/personal_options.html
index 94a6168..a6eff2b 100644
--- a/chrome/browser/resources/options/personal_options.html
+++ b/chrome/browser/resources/options/personal_options.html
@@ -15,12 +15,9 @@
<button id="start-sync" i18n-content="start_sync"></button>
</td>
</tr>
- </div>
- <div>
<tr id="text-when-synced">
<td>
- <div class="section-text" id="synced_to_user_with_time"
- i18n-content="synced_to_user_with_time"/>
+ <div class="section-text" id="synced_to_user_with_time"/>
</td>
</tr>
<tr id="button-when-synced">
@@ -29,7 +26,6 @@
<button id="sync-customize" i18n-content="sync_customize"></button>
</td>
</tr>
- </div>
</table>
</section>
<section>
@@ -111,7 +107,8 @@
</button>
<button id="themes_set_classic" i18n-content="themes_set_classic">
</button>
- <a id="linux_themes_gallery" i18n-content="themes_gallery"></a>
+ <a i18n-content="themes_gallery" target="_blank"
+ href="https://tools.google.com/chrome/intl/en/themes/index.html" />
</td></tr>
<tr>
<td class="option-name">
@@ -142,7 +139,8 @@
<table class="option-control-table">
<tr><td>
<button id="themes_reset" i18n-content="themes_reset"></button>
- <a id="nonlinux_themes_gallery" i18n-content="themes_gallery"></a>
+ <a i18n-content="themes_gallery" target="_blank"
+ href="https://tools.google.com/chrome/intl/en/themes/index.html" />
</td></tr>
</table>
</section>
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js
index 9925adc..b5d2d28 100644
--- a/chrome/browser/resources/options/personal_options.js
+++ b/chrome/browser/resources/options/personal_options.js
@@ -21,23 +21,36 @@ PersonalOptions.prototype = {
// Call base class implementation to starts preference initialization.
OptionsPage.prototype.initializePage.call(this);
-
// Listen to pref changes.
Preferences.getInstance().addEventListener('sync.has_setup_completed',
function(event) {
if(event.value) {
+ chrome.send('getSyncStatus');
$('text-when-synced').style.display = 'block';
$('button-when-synced').style.display = 'block';
+ $('stop-sync').onclick = function(event) {
+ OptionsPage.showOverlay('stopSyncingOverlay');
+ };
+
+ $('sync-customize').onclick = function(event) {
+ OptionsPage.showPageByName('sync');
+ };
+
+ $('text-when-not-synced').style.display = 'none';
+ $('button-when-not-synced').style.display = 'none';
}
else {
$('text-when-not-synced').style.display = 'block';
$('button-when-not-synced').style.display = 'block';
+ $('start-sync').onclick = function(event) {
+ //TODO(sargrass): Show start-sync subpage, after dhg done.
+ };
+
+ $('text-when-synced').style.display = 'none';
+ $('button-when-synced').style.display = 'none';
}
});
- $('sync-customize').onclick = function(event) {
- OptionsPage.showPageByName('sync');
- };
$('showpasswords').onclick = function(event) {
//TODO(sargrass): Show passwords dialog here.
@@ -48,7 +61,7 @@ PersonalOptions.prototype = {
};
$('import_data').onclick = function(event) {
- //TODO(sargrass): Show import_data dialog here.
+ OptionsPage.showOverlay('importDataOverlay');
};
if(!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) {
@@ -66,6 +79,13 @@ PersonalOptions.prototype = {
//TODO(sargrass): Show themes reset dialog here.
};
}
+ },
+ syncStatusCallback_: function(statusString) {
+ $('synced_to_user_with_time').textContent = statusString;
},
};
+
+PersonalOptions.syncStatusCallback = function(statusString){
+ PersonalOptions.getInstance().syncStatusCallback_(statusString);
+};
diff --git a/chrome/browser/resources/options/stop_syncing_overlay.html b/chrome/browser/resources/options/stop_syncing_overlay.html
new file mode 100644
index 0000000..79b3770
--- /dev/null
+++ b/chrome/browser/resources/options/stop_syncing_overlay.html
@@ -0,0 +1,8 @@
+<div class="page hidden" id="stopSyncingOverlay">
+ <h1 i18n-content="stop_syncing_title"></h1>
+
+ <div i18n-content="stop_syncing_explanation"></div>
+ <button id="stop-syncing-cancel" i18n-content="cancel"></button>
+ <button id="stop-syncing-confirm"
+ i18n-content="stop_syncing_confirm"></button>
+</div>
diff --git a/chrome/browser/resources/options/stop_syncing_overlay.js b/chrome/browser/resources/options/stop_syncing_overlay.js
new file mode 100644
index 0000000..07dbca0
--- /dev/null
+++ b/chrome/browser/resources/options/stop_syncing_overlay.js
@@ -0,0 +1,38 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * StopSyncingOverlay class
+ * Encapsulated handling of the 'Stop Syncing This Account' overlay page.
+ * @class
+ */
+function StopSyncingOverlay() {
+ OptionsPage.call(this, 'stopSyncingOverlay',
+ templateData.stop_syncing_title,
+ 'stopSyncingOverlay');
+}
+
+cr.addSingletonGetter(StopSyncingOverlay);
+
+StopSyncingOverlay.prototype = {
+ // Inherit StopSyncingOverlay from OptionsPage.
+ __proto__: OptionsPage.prototype,
+
+ /**
+ * Initialize the page.
+ */
+ initializePage: function() {
+ // Call base class implementation to starts preference initialization.
+ OptionsPage.prototype.initializePage.call(this);
+
+ $('stop-syncing-cancel').onclick = function(e) {
+ OptionsPage.clearOverlays();
+ }
+
+ $('stop-syncing-confirm').onclick = function(e) {
+ chrome.send('stopSyncing');
+ OptionsPage.clearOverlays();
+ }
+ }
+};
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index fd8e81d..b2bd6c5 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1146,6 +1146,8 @@
'browser/dom_ui/html_dialog_tab_contents_delegate.h',
'browser/dom_ui/html_dialog_ui.cc',
'browser/dom_ui/html_dialog_ui.h',
+ 'browser/dom_ui/import_data_handler.cc',
+ 'browser/dom_ui/import_data_handler.h',
'browser/dom_ui/mediaplayer_ui.cc',
'browser/dom_ui/mediaplayer_ui.h',
'browser/dom_ui/most_visited_handler.cc',
@@ -1163,7 +1165,7 @@
'browser/dom_ui/plugins_ui.cc',
'browser/dom_ui/plugins_ui.h',
'browser/dom_ui/register_page_ui.cc',
- 'browser/dom_ui/register_page_ui.h',
+ 'browser/dom_ui/register_page_ui.h',
'browser/dom_ui/remoting_ui.cc',
'browser/dom_ui/remoting_ui.h',
'browser/dom_ui/shared_resources_data_source.cc',
@@ -1172,6 +1174,8 @@
'browser/dom_ui/shown_sections_handler.h',
'browser/dom_ui/slideshow_ui.cc',
'browser/dom_ui/slideshow_ui.h',
+ 'browser/dom_ui/stop_syncing_handler.cc',
+ 'browser/dom_ui/stop_syncing_handler.h',
'browser/dom_ui/tips_handler.cc',
'browser/dom_ui/tips_handler.h',
'browser/download/download_exe.cc',