summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsargrass@google.com <sargrass@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 23:00:31 +0000
committersargrass@google.com <sargrass@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-28 23:00:31 +0000
commitb1c504c1d1ee61db9a77a606e0f93dd7a165971d (patch)
tree636bb15e19e46961cacac1659e7f376c406e28f3
parentbab6495e6a0493e7419b07108d9b8cada17853d6 (diff)
downloadchromium_src-b1c504c1d1ee61db9a77a606e0f93dd7a165971d.zip
chromium_src-b1c504c1d1ee61db9a77a606e0f93dd7a165971d.tar.gz
chromium_src-b1c504c1d1ee61db9a77a606e0f93dd7a165971d.tar.bz2
remove the chromeos include and reland
Review URL: http://codereview.chromium.org/3069008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54056 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/clear_browser_data_handler.h1
-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/resources/options.html8
-rw-r--r--chrome/browser/resources/options/personal_options.html12
-rw-r--r--chrome/browser/resources/options/personal_options.js30
-rw-r--r--chrome/chrome_browser.gypi6
8 files changed, 75 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/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/resources/options.html b/chrome/browser/resources/options.html
index da70394..fb2e0bc 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,8 @@ 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">
</div>
</div>
<div id="main-content">
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/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',