| 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 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 | 1260 |
| 1261 base::FilePath file_path; | 1261 base::FilePath file_path; |
| 1262 if (!base::GetValueAsFilePath(*file_path_value, &file_path)) | 1262 if (!base::GetValueAsFilePath(*file_path_value, &file_path)) |
| 1263 return; | 1263 return; |
| 1264 helper::DeleteProfileAtPath(file_path, web_ui()); | 1264 helper::DeleteProfileAtPath(file_path, web_ui()); |
| 1265 } | 1265 } |
| 1266 | 1266 |
| 1267 void BrowserOptionsHandler::ObserveThemeChanged() { | 1267 void BrowserOptionsHandler::ObserveThemeChanged() { |
| 1268 Profile* profile = Profile::FromWebUI(web_ui()); | 1268 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1269 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 1269 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
| 1270 bool is_native_theme = false; | 1270 bool is_system_theme = false; |
| 1271 | 1271 |
| 1272 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1272 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1273 bool profile_is_managed = profile->IsManaged(); | 1273 bool profile_is_managed = profile->IsManaged(); |
| 1274 is_native_theme = theme_service->UsingNativeTheme(); | 1274 is_system_theme = theme_service->UsingSystemTheme(); |
| 1275 base::FundamentalValue native_theme_enabled(!is_native_theme && | 1275 base::FundamentalValue native_theme_enabled(!is_system_theme && |
| 1276 !profile_is_managed); | 1276 !profile_is_managed); |
| 1277 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", | 1277 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", |
| 1278 native_theme_enabled); | 1278 native_theme_enabled); |
| 1279 #endif | 1279 #endif |
| 1280 | 1280 |
| 1281 bool is_classic_theme = !is_native_theme && | 1281 bool is_classic_theme = !is_system_theme && |
| 1282 theme_service->UsingDefaultTheme(); | 1282 theme_service->UsingDefaultTheme(); |
| 1283 base::FundamentalValue enabled(!is_classic_theme); | 1283 base::FundamentalValue enabled(!is_classic_theme); |
| 1284 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", | 1284 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", |
| 1285 enabled); | 1285 enabled); |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 void BrowserOptionsHandler::ThemesReset(const base::ListValue* args) { | 1288 void BrowserOptionsHandler::ThemesReset(const base::ListValue* args) { |
| 1289 Profile* profile = Profile::FromWebUI(web_ui()); | 1289 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1290 content::RecordAction(UserMetricsAction("Options_ThemesReset")); | 1290 content::RecordAction(UserMetricsAction("Options_ThemesReset")); |
| 1291 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); | 1291 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); |
| 1292 } | 1292 } |
| 1293 | 1293 |
| 1294 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1294 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1295 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { | 1295 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { |
| 1296 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); | 1296 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); |
| 1297 Profile* profile = Profile::FromWebUI(web_ui()); | 1297 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1298 ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme(); | 1298 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); |
| 1299 } | 1299 } |
| 1300 #endif | 1300 #endif |
| 1301 | 1301 |
| 1302 #if defined(OS_CHROMEOS) | 1302 #if defined(OS_CHROMEOS) |
| 1303 void BrowserOptionsHandler::UpdateAccountPicture() { | 1303 void BrowserOptionsHandler::UpdateAccountPicture() { |
| 1304 std::string email = chromeos::UserManager::Get()->GetLoggedInUser()->email(); | 1304 std::string email = chromeos::UserManager::Get()->GetLoggedInUser()->email(); |
| 1305 if (!email.empty()) { | 1305 if (!email.empty()) { |
| 1306 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); | 1306 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); |
| 1307 base::StringValue email_value(email); | 1307 base::StringValue email_value(email); |
| 1308 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", | 1308 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 ExtensionRegistry::ENABLED); | 1785 ExtensionRegistry::ENABLED); |
| 1786 } | 1786 } |
| 1787 AppendExtensionData("newTabPage", extension, &extension_controlled); | 1787 AppendExtensionData("newTabPage", extension, &extension_controlled); |
| 1788 | 1788 |
| 1789 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", | 1789 web_ui()->CallJavascriptFunction("BrowserOptions.toggleExtensionIndicators", |
| 1790 extension_controlled); | 1790 extension_controlled); |
| 1791 #endif // defined(OS_WIN) | 1791 #endif // defined(OS_WIN) |
| 1792 } | 1792 } |
| 1793 | 1793 |
| 1794 } // namespace options | 1794 } // namespace options |
| OLD | NEW |