OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "apps/app_window.h" | 10 #include "apps/app_window.h" |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 | 1233 |
1234 base::FilePath file_path; | 1234 base::FilePath file_path; |
1235 if (!base::GetValueAsFilePath(*file_path_value, &file_path)) | 1235 if (!base::GetValueAsFilePath(*file_path_value, &file_path)) |
1236 return; | 1236 return; |
1237 helper::DeleteProfileAtPath(file_path, web_ui()); | 1237 helper::DeleteProfileAtPath(file_path, web_ui()); |
1238 } | 1238 } |
1239 | 1239 |
1240 void BrowserOptionsHandler::ObserveThemeChanged() { | 1240 void BrowserOptionsHandler::ObserveThemeChanged() { |
1241 Profile* profile = Profile::FromWebUI(web_ui()); | 1241 Profile* profile = Profile::FromWebUI(web_ui()); |
1242 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 1242 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
1243 bool is_native_theme = false; | 1243 bool is_system_theme = false; |
1244 | 1244 |
1245 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1245 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1246 bool profile_is_managed = profile->IsManaged(); | 1246 bool profile_is_managed = profile->IsManaged(); |
1247 is_native_theme = theme_service->UsingNativeTheme(); | 1247 is_system_theme = theme_service->UsingSystemTheme(); |
1248 base::FundamentalValue native_theme_enabled(!is_native_theme && | 1248 base::FundamentalValue native_theme_enabled(!is_system_theme && |
1249 !profile_is_managed); | 1249 !profile_is_managed); |
1250 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", | 1250 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", |
1251 native_theme_enabled); | 1251 native_theme_enabled); |
1252 #endif | 1252 #endif |
1253 | 1253 |
1254 bool is_classic_theme = !is_native_theme && | 1254 bool is_classic_theme = !is_system_theme && |
1255 theme_service->UsingDefaultTheme(); | 1255 theme_service->UsingDefaultTheme(); |
1256 base::FundamentalValue enabled(!is_classic_theme); | 1256 base::FundamentalValue enabled(!is_classic_theme); |
1257 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", | 1257 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", |
1258 enabled); | 1258 enabled); |
1259 } | 1259 } |
1260 | 1260 |
1261 void BrowserOptionsHandler::ThemesReset(const base::ListValue* args) { | 1261 void BrowserOptionsHandler::ThemesReset(const base::ListValue* args) { |
1262 Profile* profile = Profile::FromWebUI(web_ui()); | 1262 Profile* profile = Profile::FromWebUI(web_ui()); |
1263 content::RecordAction(UserMetricsAction("Options_ThemesReset")); | 1263 content::RecordAction(UserMetricsAction("Options_ThemesReset")); |
1264 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); | 1264 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); |
1265 } | 1265 } |
1266 | 1266 |
1267 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1267 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1268 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { | 1268 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { |
1269 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); | 1269 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); |
1270 Profile* profile = Profile::FromWebUI(web_ui()); | 1270 Profile* profile = Profile::FromWebUI(web_ui()); |
1271 ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme(); | 1271 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); |
1272 } | 1272 } |
1273 #endif | 1273 #endif |
1274 | 1274 |
1275 #if defined(OS_CHROMEOS) | 1275 #if defined(OS_CHROMEOS) |
1276 void BrowserOptionsHandler::UpdateAccountPicture() { | 1276 void BrowserOptionsHandler::UpdateAccountPicture() { |
1277 std::string email = chromeos::UserManager::Get()->GetLoggedInUser()->email(); | 1277 std::string email = chromeos::UserManager::Get()->GetLoggedInUser()->email(); |
1278 if (!email.empty()) { | 1278 if (!email.empty()) { |
1279 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); | 1279 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); |
1280 base::StringValue email_value(email); | 1280 base::StringValue email_value(email); |
1281 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", | 1281 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 extension_name = base::StringValue( | 1747 extension_name = base::StringValue( |
1748 extension ? extension->name() : std::string()); | 1748 extension ? extension->name() : std::string()); |
1749 web_ui()->CallJavascriptFunction( | 1749 web_ui()->CallJavascriptFunction( |
1750 "BrowserOptions.toggleStartupPagesControlled", | 1750 "BrowserOptions.toggleStartupPagesControlled", |
1751 extension_id, | 1751 extension_id, |
1752 extension_name); | 1752 extension_name); |
1753 } | 1753 } |
1754 #endif // defined(OS_WIN) | 1754 #endif // defined(OS_WIN) |
1755 | 1755 |
1756 } // namespace options | 1756 } // namespace options |
OLD | NEW |