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

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

Issue 3038016: Stop Syncing Overlay and Import Data Overlay (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: order include Created 10 years, 4 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
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/personal_options_handler.h" 5 #include "chrome/browser/dom_ui/personal_options_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 14 matching lines...) Expand all
25 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
26 26
27 PersonalOptionsHandler::PersonalOptionsHandler() { 27 PersonalOptionsHandler::PersonalOptionsHandler() {
28 } 28 }
29 29
30 PersonalOptionsHandler::~PersonalOptionsHandler() { 30 PersonalOptionsHandler::~PersonalOptionsHandler() {
31 } 31 }
32 32
33 void PersonalOptionsHandler::GetLocalizedValues( 33 void PersonalOptionsHandler::GetLocalizedValues(
34 DictionaryValue* localized_strings) { 34 DictionaryValue* localized_strings) {
35 FilePath user_data_dir;
36 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
37 ProfileManager* profile_manager = g_browser_process->profile_manager();
38 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir);
39 ProfileSyncService* service = profile->GetProfileSyncService();
40 35
41 DCHECK(localized_strings); 36 DCHECK(localized_strings);
42 //Personal Stuff page 37 //Personal Stuff page
43 localized_strings->SetString(L"sync_section", 38 localized_strings->SetString(L"sync_section",
44 l10n_util::GetString(IDS_SYNC_OPTIONS_GROUP_NAME)); 39 l10n_util::GetString(IDS_SYNC_OPTIONS_GROUP_NAME));
45 localized_strings->SetString(L"sync_not_setup_info", 40 localized_strings->SetString(L"sync_not_setup_info",
46 l10n_util::GetStringF(IDS_SYNC_NOT_SET_UP_INFO, 41 l10n_util::GetStringF(IDS_SYNC_NOT_SET_UP_INFO,
47 l10n_util::GetString(IDS_PRODUCT_NAME))); 42 l10n_util::GetString(IDS_PRODUCT_NAME)));
48 localized_strings->SetString(L"start_sync", 43 localized_strings->SetString(L"start_sync",
49 l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL)); 44 l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL));
50 localized_strings->SetString(L"synced_to_user_with_time",
51 l10n_util::GetStringF(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME,
52 UTF16ToWide(service->GetAuthenticatedUsername()),
53 service->GetLastSyncedTimeString()));
54 localized_strings->SetString(L"sync_customize", 45 localized_strings->SetString(L"sync_customize",
55 l10n_util::GetString(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL)); 46 l10n_util::GetString(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL));
56 localized_strings->SetString(L"stop_sync", 47 localized_strings->SetString(L"stop_sync",
57 l10n_util::GetString(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL)); 48 l10n_util::GetString(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL));
58 49
59 localized_strings->SetString(L"passwords", 50 localized_strings->SetString(L"passwords",
60 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME)); 51 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME));
61 localized_strings->SetString(L"passwords_asktosave", 52 localized_strings->SetString(L"passwords_asktosave",
62 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_ASKTOSAVE)); 53 l10n_util::GetString(IDS_OPTIONS_PASSWORDS_ASKTOSAVE));
63 localized_strings->SetString(L"passwords_neversave", 54 localized_strings->SetString(L"passwords_neversave",
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 localized_strings->SetString(L"themes", 87 localized_strings->SetString(L"themes",
97 l10n_util::GetString(IDS_THEMES_GROUP_NAME)); 88 l10n_util::GetString(IDS_THEMES_GROUP_NAME));
98 localized_strings->SetString(L"themes_reset", 89 localized_strings->SetString(L"themes_reset",
99 l10n_util::GetString(IDS_THEMES_RESET_BUTTON)); 90 l10n_util::GetString(IDS_THEMES_RESET_BUTTON));
100 localized_strings->SetString(L"themes_gallery", 91 localized_strings->SetString(L"themes_gallery",
101 l10n_util::GetString(IDS_THEMES_GALLERY_BUTTON)); 92 l10n_util::GetString(IDS_THEMES_GALLERY_BUTTON));
102 localized_strings->SetString(L"themes_default", 93 localized_strings->SetString(L"themes_default",
103 l10n_util::GetString(IDS_THEMES_DEFAULT_THEME_LABEL)); 94 l10n_util::GetString(IDS_THEMES_DEFAULT_THEME_LABEL));
104 #endif 95 #endif
105 } 96 }
97
98 void PersonalOptionsHandler::RegisterMessages() {
99 DCHECK(dom_ui_);
100 dom_ui_->RegisterMessageCallback(
101 "getSyncStatus",
102 NewCallback(this,&PersonalOptionsHandler::SetSyncStatusUIString));
103 }
104
105 void PersonalOptionsHandler::SetSyncStatusUIString(const Value* value) {
106 DCHECK(dom_ui_);
107
108 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService();
109 if(service != NULL && ProfileSyncService::IsSyncEnabled()) {
110 scoped_ptr<Value> status_string(Value::CreateStringValue(
111 l10n_util::GetStringF(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME,
112 UTF16ToWide(service->GetAuthenticatedUsername()),
113 service->GetLastSyncedTimeString())));
114
115 dom_ui_->CallJavascriptFunction(
116 L"PersonalOptions.syncStatusCallback",
117 *(status_string.get()));
118 }
119 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/personal_options_handler.h ('k') | chrome/browser/dom_ui/stop_syncing_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698