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