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

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

Issue 6344004: DOMUI: Move the meat of SyncOptionsHandler into PersonalOptionsHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months 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
« no previous file with comments | « chrome/browser/dom_ui/options/sync_options_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/dom_ui/options/sync_options_handler.h"
6
7 #include "app/l10n_util.h"
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "base/stl_util-inl.h"
11 #include "base/time.h"
12 #include "base/utf_string_conversions.h"
13 #include "base/values.h"
14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/sync/profile_sync_service.h"
16 #include "chrome/browser/sync/sync_setup_flow.h"
17 #include "chrome/common/notification_service.h"
18 #include "grit/browser_resources.h"
19 #include "grit/chromium_strings.h"
20 #include "grit/generated_resources.h"
21 #include "grit/locale_settings.h"
22 #include "grit/theme_resources.h"
23
24 SyncOptionsHandler::SyncOptionsHandler() {}
25
26 SyncOptionsHandler::~SyncOptionsHandler() {}
27
28 bool SyncOptionsHandler::IsEnabled() {
29 return ProfileSyncService::IsSyncEnabled();
30 }
31
32 void SyncOptionsHandler::GetLocalizedValues(
33 DictionaryValue* localized_strings) {
34 DCHECK(localized_strings);
35 // Sync page - ChromeOS
36 localized_strings->SetString("syncPage",
37 l10n_util::GetStringUTF16(IDS_SYNC_NTP_SYNC_SECTION_TITLE));
38 localized_strings->SetString("sync_title",
39 l10n_util::GetStringUTF16(IDS_CUSTOMIZE_SYNC_DESCRIPTION));
40 localized_strings->SetString("syncsettings",
41 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_PREFERENCES));
42 localized_strings->SetString("syncbookmarks",
43 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_BOOKMARKS));
44 localized_strings->SetString("synctypedurls",
45 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_TYPED_URLS));
46 localized_strings->SetString("syncpasswords",
47 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_PASSWORDS));
48 localized_strings->SetString("syncextensions",
49 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_EXTENSIONS));
50 localized_strings->SetString("syncautofill",
51 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_AUTOFILL));
52 localized_strings->SetString("syncthemes",
53 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_THEMES));
54 localized_strings->SetString("syncapps",
55 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_APPS));
56 localized_strings->SetString("syncsessions",
57 l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_SESSIONS));
58 }
59
60 void SyncOptionsHandler::Initialize() {
61 ProfileSyncService* service =
62 dom_ui_->GetProfile()->GetProfileSyncService();
63 if (!service)
64 return; // Can happen in ChromeOS if called before login.
65
66 DictionaryValue args;
67 SyncSetupFlow::GetArgsForConfigure(service, &args);
68
69 dom_ui_->CallJavascriptFunction(
70 L"PersonalOptions.setRegisteredDataTypes", args);
71 }
72
73 void SyncOptionsHandler::RegisterMessages() {
74 dom_ui_->RegisterMessageCallback("updatePreferredDataTypes",
75 NewCallback(this, &SyncOptionsHandler::OnPreferredDataTypesUpdated));
76 }
77
78 void SyncOptionsHandler::OnPreferredDataTypesUpdated(const ListValue* args) {
79 NotificationService::current()->Notify(
80 NotificationType::SYNC_DATA_TYPES_UPDATED,
81 Source<Profile>(dom_ui_->GetProfile()),
82 NotificationService::NoDetails());
83 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/options/sync_options_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698