Chromium Code Reviews| 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 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1219 | 1219 |
| 1220 base::FilePath file_path; | 1220 base::FilePath file_path; |
| 1221 if (!base::GetValueAsFilePath(*file_path_value, &file_path)) | 1221 if (!base::GetValueAsFilePath(*file_path_value, &file_path)) |
| 1222 return; | 1222 return; |
| 1223 helper::DeleteProfileAtPath(file_path, web_ui()); | 1223 helper::DeleteProfileAtPath(file_path, web_ui()); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 void BrowserOptionsHandler::ObserveThemeChanged() { | 1226 void BrowserOptionsHandler::ObserveThemeChanged() { |
| 1227 Profile* profile = Profile::FromWebUI(web_ui()); | 1227 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1228 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 1228 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
| 1229 bool is_native_theme = false; | 1229 bool is_system_theme = false; |
| 1230 | 1230 |
| 1231 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1231 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1232 bool profile_is_managed = profile->IsManaged(); | 1232 bool profile_is_managed = profile->IsManaged(); |
| 1233 is_native_theme = theme_service->UsingNativeTheme(); | 1233 is_system_theme = theme_service->UsingSystemTheme(); |
| 1234 base::FundamentalValue native_theme_enabled(!is_native_theme && | 1234 base::FundamentalValue native_theme_enabled(!is_system_theme && |
| 1235 !profile_is_managed); | 1235 !profile_is_managed); |
| 1236 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", | 1236 web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled", |
|
msw
2014/04/22 18:02:13
Q: will you followup and rename this to be consist
Evan Stade
2014/04/22 18:16:06
possibly
| |
| 1237 native_theme_enabled); | 1237 native_theme_enabled); |
| 1238 #endif | 1238 #endif |
| 1239 | 1239 |
| 1240 bool is_classic_theme = !is_native_theme && | 1240 bool is_classic_theme = !is_system_theme && |
| 1241 theme_service->UsingDefaultTheme(); | 1241 theme_service->UsingDefaultTheme(); |
| 1242 base::FundamentalValue enabled(!is_classic_theme); | 1242 base::FundamentalValue enabled(!is_classic_theme); |
| 1243 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", | 1243 web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled", |
| 1244 enabled); | 1244 enabled); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 void BrowserOptionsHandler::ThemesReset(const base::ListValue* args) { | 1247 void BrowserOptionsHandler::ThemesReset(const base::ListValue* args) { |
| 1248 Profile* profile = Profile::FromWebUI(web_ui()); | 1248 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1249 content::RecordAction(UserMetricsAction("Options_ThemesReset")); | 1249 content::RecordAction(UserMetricsAction("Options_ThemesReset")); |
| 1250 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); | 1250 ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme(); |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1253 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 1254 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { | 1254 void BrowserOptionsHandler::ThemesSetNative(const base::ListValue* args) { |
|
msw
2014/04/22 18:02:13
Q: will you followup and rename this to be consist
Evan Stade
2014/04/22 18:16:06
possibly
| |
| 1255 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); | 1255 content::RecordAction(UserMetricsAction("Options_GtkThemeSet")); |
| 1256 Profile* profile = Profile::FromWebUI(web_ui()); | 1256 Profile* profile = Profile::FromWebUI(web_ui()); |
| 1257 ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme(); | 1257 ThemeServiceFactory::GetForProfile(profile)->UseSystemTheme(); |
| 1258 } | 1258 } |
| 1259 #endif | 1259 #endif |
| 1260 | 1260 |
| 1261 #if defined(OS_CHROMEOS) | 1261 #if defined(OS_CHROMEOS) |
| 1262 void BrowserOptionsHandler::UpdateAccountPicture() { | 1262 void BrowserOptionsHandler::UpdateAccountPicture() { |
| 1263 std::string email = chromeos::UserManager::Get()->GetLoggedInUser()->email(); | 1263 std::string email = chromeos::UserManager::Get()->GetLoggedInUser()->email(); |
| 1264 if (!email.empty()) { | 1264 if (!email.empty()) { |
| 1265 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); | 1265 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture"); |
| 1266 base::StringValue email_value(email); | 1266 base::StringValue email_value(email); |
| 1267 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", | 1267 web_ui()->CallJavascriptFunction("BrowserOptions.updateAccountPicture", |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1733 extension_name = base::StringValue( | 1733 extension_name = base::StringValue( |
| 1734 extension ? extension->name() : std::string()); | 1734 extension ? extension->name() : std::string()); |
| 1735 web_ui()->CallJavascriptFunction( | 1735 web_ui()->CallJavascriptFunction( |
| 1736 "BrowserOptions.toggleStartupPagesControlled", | 1736 "BrowserOptions.toggleStartupPagesControlled", |
| 1737 extension_id, | 1737 extension_id, |
| 1738 extension_name); | 1738 extension_name); |
| 1739 } | 1739 } |
| 1740 #endif // defined(OS_WIN) | 1740 #endif // defined(OS_WIN) |
| 1741 | 1741 |
| 1742 } // namespace options | 1742 } // namespace options |
| OLD | NEW |