Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2047)

Side by Side Diff: chrome/browser/dom_ui/options/personal_options_handler.cc

Issue 5144001: DOMUI: Hide the sync section if sync is disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/dom_ui/options/personal_options_handler.h" 5 #include "chrome/browser/dom_ui/options/personal_options_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 29 matching lines...) Expand all
40 ProfileSyncService* sync_service = 40 ProfileSyncService* sync_service =
41 dom_ui_->GetProfile()->GetProfileSyncService(); 41 dom_ui_->GetProfile()->GetProfileSyncService();
42 if (sync_service) 42 if (sync_service)
43 sync_service->RemoveObserver(this); 43 sync_service->RemoveObserver(this);
44 } 44 }
45 45
46 void PersonalOptionsHandler::GetLocalizedValues( 46 void PersonalOptionsHandler::GetLocalizedValues(
47 DictionaryValue* localized_strings) { 47 DictionaryValue* localized_strings) {
48 DCHECK(localized_strings); 48 DCHECK(localized_strings);
49 49
50 localized_strings->SetString("sync_disabled_info",
51 l10n_util::GetStringUTF16(IDS_SYNC_IS_DISABLED_INFO));
52 localized_strings->SetString("sync_section", 50 localized_strings->SetString("sync_section",
53 l10n_util::GetStringUTF16(IDS_SYNC_OPTIONS_GROUP_NAME)); 51 l10n_util::GetStringUTF16(IDS_SYNC_OPTIONS_GROUP_NAME));
54 localized_strings->SetString("sync_not_setup_info", 52 localized_strings->SetString("sync_not_setup_info",
55 l10n_util::GetStringFUTF16(IDS_SYNC_NOT_SET_UP_INFO, 53 l10n_util::GetStringFUTF16(IDS_SYNC_NOT_SET_UP_INFO,
56 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))); 54 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
57 localized_strings->SetString("start_sync", 55 localized_strings->SetString("start_sync",
58 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL)); 56 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL));
59 localized_strings->SetString("sync_customize", 57 localized_strings->SetString("sync_customize",
60 l10n_util::GetStringUTF16(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL)); 58 l10n_util::GetStringUTF16(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL));
61 localized_strings->SetString("stop_sync", 59 localized_strings->SetString("stop_sync",
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // Listen for theme installation. 255 // Listen for theme installation.
258 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, 256 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
259 NotificationService::AllSources()); 257 NotificationService::AllSources());
260 ObserveThemeChanged(); 258 ObserveThemeChanged();
261 259
262 ProfileSyncService* sync_service = 260 ProfileSyncService* sync_service =
263 dom_ui_->GetProfile()->GetProfileSyncService(); 261 dom_ui_->GetProfile()->GetProfileSyncService();
264 if (sync_service) { 262 if (sync_service) {
265 sync_service->AddObserver(this); 263 sync_service->AddObserver(this);
266 OnStateChanged(); 264 OnStateChanged();
265 } else {
266 dom_ui_->CallJavascriptFunction(L"options.PersonalOptions.hideSyncSection");
267 } 267 }
268 } 268 }
269 269
270 void PersonalOptionsHandler::ShowSyncLoginDialog(const ListValue* args) { 270 void PersonalOptionsHandler::ShowSyncLoginDialog(const ListValue* args) {
271 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService(); 271 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
272 service->ShowLoginDialog(NULL); 272 service->ShowLoginDialog(NULL);
273 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS); 273 ProfileSyncService::SyncEvent(ProfileSyncService::START_FROM_OPTIONS);
274 } 274 }
275 275
276 void PersonalOptionsHandler::ThemesReset(const ListValue* args) { 276 void PersonalOptionsHandler::ThemesReset(const ListValue* args) {
277 UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset")); 277 UserMetricsRecordAction(UserMetricsAction("Options_ThemesReset"));
278 dom_ui_->GetProfile()->ClearTheme(); 278 dom_ui_->GetProfile()->ClearTheme();
279 } 279 }
280 280
281 #if defined(TOOLKIT_GTK) 281 #if defined(TOOLKIT_GTK)
282 void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) { 282 void PersonalOptionsHandler::ThemesSetGTK(const ListValue* args) {
283 UserMetricsRecordAction(UserMetricsAction("Options_GtkThemeSet")); 283 UserMetricsRecordAction(UserMetricsAction("Options_GtkThemeSet"));
284 dom_ui_->GetProfile()->SetNativeTheme(); 284 dom_ui_->GetProfile()->SetNativeTheme();
285 } 285 }
286 #endif 286 #endif
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/resources/options/personal_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698