| OLD | NEW |
| 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 "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" |
| 11 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_list.h" | 14 #include "chrome/browser/browser_list.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/dom_ui/options_managed_banner_handler.h" |
| 16 #include "chrome/browser/options_page_base.h" | 17 #include "chrome/browser/options_page_base.h" |
| 18 #include "chrome/browser/options_window.h" |
| 17 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
| 18 #include "chrome/browser/profile_manager.h" | 20 #include "chrome/browser/profile_manager.h" |
| 19 #include "chrome/browser/sync/profile_sync_service.h" | 21 #include "chrome/browser/sync/profile_sync_service.h" |
| 20 #include "chrome/common/notification_service.h" | 22 #include "chrome/common/notification_service.h" |
| 21 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 22 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
| 23 #include "grit/chromium_strings.h" | 25 #include "grit/chromium_strings.h" |
| 24 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 25 #include "grit/locale_settings.h" | 27 #include "grit/locale_settings.h" |
| 26 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 dom_ui_->RegisterMessageCallback( | 105 dom_ui_->RegisterMessageCallback( |
| 104 "themesGallery", | 106 "themesGallery", |
| 105 NewCallback(this, &PersonalOptionsHandler::ThemesGallery)); | 107 NewCallback(this, &PersonalOptionsHandler::ThemesGallery)); |
| 106 #if defined(TOOLKIT_GTK) | 108 #if defined(TOOLKIT_GTK) |
| 107 dom_ui_->RegisterMessageCallback( | 109 dom_ui_->RegisterMessageCallback( |
| 108 "themesSetGTK", | 110 "themesSetGTK", |
| 109 NewCallback(this, &PersonalOptionsHandler::ThemesSetGTK)); | 111 NewCallback(this, &PersonalOptionsHandler::ThemesSetGTK)); |
| 110 #endif | 112 #endif |
| 111 } | 113 } |
| 112 | 114 |
| 115 void PersonalOptionsHandler::Initialize() { |
| 116 banner_handler_.reset( |
| 117 new OptionsManagedBannerHandler(dom_ui_, |
| 118 ASCIIToUTF16("PersonalOptions"), |
| 119 OPTIONS_PAGE_CONTENT)); |
| 120 } |
| 121 |
| 113 void PersonalOptionsHandler::SetSyncStatusUIString(const Value* value) { | 122 void PersonalOptionsHandler::SetSyncStatusUIString(const Value* value) { |
| 114 DCHECK(dom_ui_); | 123 DCHECK(dom_ui_); |
| 115 | 124 |
| 116 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService(); | 125 ProfileSyncService* service = dom_ui_->GetProfile()->GetProfileSyncService(); |
| 117 if (service != NULL && ProfileSyncService::IsSyncEnabled()) { | 126 if (service != NULL && ProfileSyncService::IsSyncEnabled()) { |
| 118 scoped_ptr<Value> status_string(Value::CreateStringValue( | 127 scoped_ptr<Value> status_string(Value::CreateStringValue( |
| 119 l10n_util::GetStringFUTF16(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, | 128 l10n_util::GetStringFUTF16(IDS_SYNC_ACCOUNT_SYNCED_TO_USER_WITH_TIME, |
| 120 service->GetAuthenticatedUsername(), | 129 service->GetAuthenticatedUsername(), |
| 121 service->GetLastSyncedTimeString()))); | 130 service->GetLastSyncedTimeString()))); |
| 122 | 131 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 144 | 153 |
| 145 #if defined(TOOLKIT_GTK) | 154 #if defined(TOOLKIT_GTK) |
| 146 void PersonalOptionsHandler::ThemesSetGTK(const Value* value) { | 155 void PersonalOptionsHandler::ThemesSetGTK(const Value* value) { |
| 147 DCHECK(dom_ui_); | 156 DCHECK(dom_ui_); |
| 148 | 157 |
| 149 UserMetricsRecordAction(UserMetricsAction("Options_GtkThemeSet"), | 158 UserMetricsRecordAction(UserMetricsAction("Options_GtkThemeSet"), |
| 150 dom_ui_->GetProfile()->GetPrefs()); | 159 dom_ui_->GetProfile()->GetPrefs()); |
| 151 dom_ui_->GetProfile()->SetNativeTheme(); | 160 dom_ui_->GetProfile()->SetNativeTheme(); |
| 152 } | 161 } |
| 153 #endif | 162 #endif |
| OLD | NEW |