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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/metrics/histogram.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
17 #include "base/stl_util.h" | 18 #include "base/stl_util.h" |
18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
19 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
20 #include "base/value_conversions.h" | 21 #include "base/value_conversions.h" |
21 #include "base/values.h" | 22 #include "base/values.h" |
22 #include "chrome/browser/auto_launch_trial.h" | 23 #include "chrome/browser/auto_launch_trial.h" |
23 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/chrome_page_zoom.h" | 25 #include "chrome/browser/chrome_page_zoom.h" |
25 #include "chrome/browser/custom_home_pages_table_model.h" | 26 #include "chrome/browser/custom_home_pages_table_model.h" |
26 #include "chrome/browser/download/download_prefs.h" | 27 #include "chrome/browser/download/download_prefs.h" |
27 #include "chrome/browser/gpu/gpu_mode_manager.h" | 28 #include "chrome/browser/gpu/gpu_mode_manager.h" |
28 #include "chrome/browser/lifetime/application_lifetime.h" | 29 #include "chrome/browser/lifetime/application_lifetime.h" |
29 #include "chrome/browser/net/url_fixer_upper.h" | 30 #include "chrome/browser/net/url_fixer_upper.h" |
30 #include "chrome/browser/prefs/session_startup_pref.h" | 31 #include "chrome/browser/prefs/session_startup_pref.h" |
31 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 32 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
32 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 33 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
33 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" | 34 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" |
34 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" | 35 #include "chrome/browser/printing/cloud_print/cloud_print_url.h" |
| 36 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/profiles/profile_info_cache.h" | 37 #include "chrome/browser/profiles/profile_info_cache.h" |
36 #include "chrome/browser/profiles/profile_info_util.h" | 38 #include "chrome/browser/profiles/profile_info_util.h" |
| 39 #include "chrome/browser/profiles/profile_metrics.h" |
37 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 40 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
38 #include "chrome/browser/search/search.h" | 41 #include "chrome/browser/search/search.h" |
39 #include "chrome/browser/search_engines/template_url.h" | 42 #include "chrome/browser/search_engines/template_url.h" |
40 #include "chrome/browser/search_engines/template_url_service.h" | 43 #include "chrome/browser/search_engines/template_url_service.h" |
41 #include "chrome/browser/search_engines/template_url_service_factory.h" | 44 #include "chrome/browser/search_engines/template_url_service_factory.h" |
42 #include "chrome/browser/service/service_process_control.h" | 45 #include "chrome/browser/service/service_process_control.h" |
43 #include "chrome/browser/signin/signin_manager.h" | 46 #include "chrome/browser/signin/signin_manager.h" |
44 #include "chrome/browser/signin/signin_manager_factory.h" | 47 #include "chrome/browser/signin/signin_manager_factory.h" |
45 #include "chrome/browser/sync/profile_sync_service.h" | 48 #include "chrome/browser/sync/profile_sync_service.h" |
46 #include "chrome/browser/sync/profile_sync_service_factory.h" | 49 #include "chrome/browser/sync/profile_sync_service_factory.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 142 } |
140 | 143 |
141 void CreateDesktopShortcutForProfile(Profile* profile, | 144 void CreateDesktopShortcutForProfile(Profile* profile, |
142 Profile::CreateStatus status) { | 145 Profile::CreateStatus status) { |
143 ProfileShortcutManager* shortcut_manager = | 146 ProfileShortcutManager* shortcut_manager = |
144 g_browser_process->profile_manager()->profile_shortcut_manager(); | 147 g_browser_process->profile_manager()->profile_shortcut_manager(); |
145 if (shortcut_manager) | 148 if (shortcut_manager) |
146 shortcut_manager->CreateProfileShortcut(profile->GetPath()); | 149 shortcut_manager->CreateProfileShortcut(profile->GetPath()); |
147 } | 150 } |
148 | 151 |
| 152 void RunProfileCreationCallbacks( |
| 153 const std::vector<ProfileManager::CreateCallback>& callbacks, |
| 154 Profile* profile, |
| 155 Profile::CreateStatus status) { |
| 156 std::vector<ProfileManager::CreateCallback>::const_iterator it; |
| 157 for (it = callbacks.begin(); it != callbacks.end(); ++it) { |
| 158 it->Run(profile, status); |
| 159 } |
| 160 } |
| 161 |
| 162 void OpenNewWindowForProfile( |
| 163 chrome::HostDesktopType desktop_type, |
| 164 Profile* profile, |
| 165 Profile::CreateStatus status) { |
| 166 if (status != Profile::CREATE_STATUS_INITIALIZED) |
| 167 return; |
| 168 |
| 169 ProfileManager::FindOrCreateNewWindowForProfile( |
| 170 profile, |
| 171 chrome::startup::IS_PROCESS_STARTUP, |
| 172 chrome::startup::IS_FIRST_RUN, |
| 173 desktop_type, |
| 174 false); |
| 175 } |
| 176 |
149 } // namespace | 177 } // namespace |
150 | 178 |
151 BrowserOptionsHandler::BrowserOptionsHandler() | 179 BrowserOptionsHandler::BrowserOptionsHandler() |
152 : page_initialized_(false), | 180 : page_initialized_(false), |
153 template_url_service_(NULL), | 181 template_url_service_(NULL), |
154 weak_ptr_factory_(this) { | 182 weak_ptr_factory_(this) { |
155 #if !defined(OS_MACOSX) | 183 #if !defined(OS_MACOSX) |
156 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); | 184 default_browser_worker_ = new ShellIntegration::DefaultBrowserWorker(this); |
157 #endif | 185 #endif |
158 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) | 186 #if(!defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN)) |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 values->SetString("macPasswordsWarning", | 506 values->SetString("macPasswordsWarning", |
479 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); | 507 l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MAC_WARNING)); |
480 values->SetBoolean("multiple_profiles", | 508 values->SetBoolean("multiple_profiles", |
481 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); | 509 g_browser_process->profile_manager()->GetNumberOfProfiles() > 1); |
482 #endif | 510 #endif |
483 | 511 |
484 if (ShouldShowMultiProfilesUserList()) | 512 if (ShouldShowMultiProfilesUserList()) |
485 values->Set("profilesInfo", GetProfilesInfoList().release()); | 513 values->Set("profilesInfo", GetProfilesInfoList().release()); |
486 | 514 |
487 #if defined(ENABLE_MANAGED_USERS) | 515 #if defined(ENABLE_MANAGED_USERS) |
488 ManagedUserService* service = | 516 values->SetBoolean("profileIsManaged", |
489 ManagedUserServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); | 517 ManagedUserService::ProfileIsManaged(Profile::FromWebUI(web_ui()))); |
490 values->SetBoolean("profileIsManaged", service->ProfileIsManaged()); | |
491 #endif | 518 #endif |
492 | 519 |
493 #if !defined(OS_CHROMEOS) | 520 #if !defined(OS_CHROMEOS) |
494 values->SetBoolean( | 521 values->SetBoolean( |
495 "gpuEnabledAtStart", | 522 "gpuEnabledAtStart", |
496 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); | 523 g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); |
497 #endif | 524 #endif |
498 | 525 |
499 values->SetBoolean("enableResetProfileSettingsSection", | 526 values->SetBoolean("enableResetProfileSettingsSection", |
500 CommandLine::ForCurrentProcess()->HasSwitch( | 527 CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 base::Unretained(this))); | 559 base::Unretained(this))); |
533 web_ui()->RegisterMessageCallback( | 560 web_ui()->RegisterMessageCallback( |
534 "setDefaultSearchEngine", | 561 "setDefaultSearchEngine", |
535 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, | 562 base::Bind(&BrowserOptionsHandler::SetDefaultSearchEngine, |
536 base::Unretained(this))); | 563 base::Unretained(this))); |
537 web_ui()->RegisterMessageCallback( | 564 web_ui()->RegisterMessageCallback( |
538 "createProfile", | 565 "createProfile", |
539 base::Bind(&BrowserOptionsHandler::CreateProfile, | 566 base::Bind(&BrowserOptionsHandler::CreateProfile, |
540 base::Unretained(this))); | 567 base::Unretained(this))); |
541 web_ui()->RegisterMessageCallback( | 568 web_ui()->RegisterMessageCallback( |
| 569 "deleteProfile", |
| 570 base::Bind(&BrowserOptionsHandler::DeleteProfile, |
| 571 base::Unretained(this))); |
| 572 web_ui()->RegisterMessageCallback( |
542 "themesReset", | 573 "themesReset", |
543 base::Bind(&BrowserOptionsHandler::ThemesReset, | 574 base::Bind(&BrowserOptionsHandler::ThemesReset, |
544 base::Unretained(this))); | 575 base::Unretained(this))); |
545 #if defined(TOOLKIT_GTK) | 576 #if defined(TOOLKIT_GTK) |
546 web_ui()->RegisterMessageCallback( | 577 web_ui()->RegisterMessageCallback( |
547 "themesSetGTK", | 578 "themesSetGTK", |
548 base::Bind(&BrowserOptionsHandler::ThemesSetGTK, | 579 base::Bind(&BrowserOptionsHandler::ThemesSetGTK, |
549 base::Unretained(this))); | 580 base::Unretained(this))); |
550 #endif | 581 #endif |
551 web_ui()->RegisterMessageCallback( | 582 web_ui()->RegisterMessageCallback( |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 return; | 1096 return; |
1066 web_ui()->CallJavascriptFunction("BrowserOptions.setProfilesInfo", | 1097 web_ui()->CallJavascriptFunction("BrowserOptions.setProfilesInfo", |
1067 *GetProfilesInfoList()); | 1098 *GetProfilesInfoList()); |
1068 } | 1099 } |
1069 | 1100 |
1070 void BrowserOptionsHandler::CreateProfile(const ListValue* args) { | 1101 void BrowserOptionsHandler::CreateProfile(const ListValue* args) { |
1071 #if defined(ENABLE_MANAGED_USERS) | 1102 #if defined(ENABLE_MANAGED_USERS) |
1072 // This handler could have been called in managed mode, for example because | 1103 // This handler could have been called in managed mode, for example because |
1073 // the user fiddled with the web inspector. Silently return in this case. | 1104 // the user fiddled with the web inspector. Silently return in this case. |
1074 Profile* profile = Profile::FromWebUI(web_ui()); | 1105 Profile* profile = Profile::FromWebUI(web_ui()); |
1075 ManagedUserService* service = | 1106 if (ManagedUserService::ProfileIsManaged(profile)) |
1076 ManagedUserServiceFactory::GetForProfile(profile); | |
1077 if (service->ProfileIsManaged()) | |
1078 return; | 1107 return; |
1079 #endif | 1108 #endif |
1080 | 1109 |
1081 if (!ProfileManager::IsMultipleProfilesEnabled()) | 1110 if (!ProfileManager::IsMultipleProfilesEnabled()) |
1082 return; | 1111 return; |
1083 | 1112 |
1084 Browser* browser = | 1113 Browser* browser = |
1085 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); | 1114 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
1086 chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; | 1115 chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; |
1087 if (browser) | 1116 if (browser) |
1088 desktop_type = browser->host_desktop_type(); | 1117 desktop_type = browser->host_desktop_type(); |
1089 | 1118 |
1090 string16 name; | 1119 string16 name; |
1091 string16 icon; | 1120 string16 icon; |
1092 std::vector<ProfileManager::CreateCallback> callbacks; | |
1093 bool create_shortcut = false; | 1121 bool create_shortcut = false; |
1094 bool managed_user = false; | 1122 bool managed_user = false; |
1095 if (args->GetString(0, &name) && args->GetString(1, &icon)) { | 1123 if (args->GetString(0, &name) && args->GetString(1, &icon)) { |
1096 if (args->GetBoolean(2, &create_shortcut)) { | 1124 if (args->GetBoolean(2, &create_shortcut)) { |
1097 bool success = args->GetBoolean(3, &managed_user); | 1125 bool success = args->GetBoolean(3, &managed_user); |
1098 DCHECK(success); | 1126 DCHECK(success); |
1099 } | 1127 } |
1100 } | 1128 } |
1101 | 1129 |
| 1130 std::vector<ProfileManager::CreateCallback> callbacks; |
1102 if (create_shortcut) | 1131 if (create_shortcut) |
1103 callbacks.push_back(base::Bind(&CreateDesktopShortcutForProfile)); | 1132 callbacks.push_back(base::Bind(&CreateDesktopShortcutForProfile)); |
1104 | 1133 |
| 1134 ProfileManager::CreateCallback show_user_feedback = |
| 1135 base::Bind(&BrowserOptionsHandler::ShowProfileCreationFeedback, |
| 1136 weak_ptr_factory_.GetWeakPtr(), desktop_type, managed_user); |
| 1137 |
1105 if (managed_user && ManagedUserService::AreManagedUsersEnabled()) { | 1138 if (managed_user && ManagedUserService::AreManagedUsersEnabled()) { |
1106 #if defined(ENABLE_MANAGED_USERS) | 1139 #if defined(ENABLE_MANAGED_USERS) |
1107 ManagedUserRegistrationService* registration_service = | 1140 callbacks.push_back( |
1108 ManagedUserRegistrationServiceFactory::GetForProfile(profile); | 1141 base::Bind(&BrowserOptionsHandler::RegisterNewManagedUser, |
1109 callbacks.push_back(registration_service->GetRegistrationAndInitCallback()); | 1142 weak_ptr_factory_.GetWeakPtr(), show_user_feedback)); |
1110 #else | 1143 #else |
1111 NOTREACHED(); | 1144 NOTREACHED(); |
1112 #endif | 1145 #endif |
| 1146 } else { |
| 1147 callbacks.push_back(show_user_feedback); |
1113 } | 1148 } |
1114 | 1149 |
| 1150 ProfileMetrics::LogProfileAddNewUser(ProfileMetrics::ADD_NEW_USER_DIALOG); |
| 1151 |
1115 ProfileManager::CreateMultiProfileAsync( | 1152 ProfileManager::CreateMultiProfileAsync( |
1116 name, icon, base::Bind(&BrowserOptionsHandler::OnProfileCreated, | 1153 name, icon, base::Bind(&RunProfileCreationCallbacks, callbacks), |
1117 weak_ptr_factory_.GetWeakPtr(), | |
1118 desktop_type, managed_user, callbacks), | |
1119 managed_user); | 1154 managed_user); |
1120 } | 1155 } |
1121 | 1156 |
1122 void BrowserOptionsHandler::OnProfileCreated( | 1157 void BrowserOptionsHandler::RegisterNewManagedUser( |
| 1158 const ProfileManager::CreateCallback& callback, |
| 1159 Profile* profile, |
| 1160 Profile::CreateStatus status) { |
| 1161 if (status != Profile::CREATE_STATUS_INITIALIZED) |
| 1162 return; |
| 1163 |
| 1164 ManagedUserService* managed_user_service = |
| 1165 ManagedUserServiceFactory::GetForProfile(profile); |
| 1166 DCHECK(managed_user_service->ProfileIsManaged()); |
| 1167 ManagedUserRegistrationService* registration_service = |
| 1168 ManagedUserRegistrationServiceFactory::GetForProfile(profile); |
| 1169 |
| 1170 managed_user_service->RegisterAndInitSync(registration_service, callback); |
| 1171 } |
| 1172 |
| 1173 void BrowserOptionsHandler::ShowProfileCreationFeedback( |
1123 chrome::HostDesktopType desktop_type, | 1174 chrome::HostDesktopType desktop_type, |
1124 bool is_managed, | 1175 bool is_managed, |
1125 const std::vector<ProfileManager::CreateCallback>& callbacks, | |
1126 Profile* profile, | 1176 Profile* profile, |
1127 Profile::CreateStatus status) { | 1177 Profile::CreateStatus status) { |
1128 std::vector<ProfileManager::CreateCallback>::const_iterator it; | 1178 if (status != Profile::CREATE_STATUS_CREATED) { |
1129 for (it = callbacks.begin(); it != callbacks.end(); ++it) { | 1179 UMA_HISTOGRAM_ENUMERATION("Profile.CreateResult", |
1130 it->Run(profile, status); | 1180 status, |
| 1181 Profile::MAX_CREATE_STATUS); |
1131 } | 1182 } |
1132 | 1183 |
1133 switch (status) { | 1184 switch (status) { |
1134 case Profile::CREATE_STATUS_FAIL: { | 1185 case Profile::CREATE_STATUS_LOCAL_FAIL: { |
1135 web_ui()->CallJavascriptFunction( | 1186 web_ui()->CallJavascriptFunction( |
1136 "BrowserOptions.showCreateProfileLocalError"); | 1187 "BrowserOptions.showCreateProfileLocalError"); |
| 1188 DeleteProfileAtPath(profile->GetPath()); |
| 1189 break; |
| 1190 } |
| 1191 case Profile::CREATE_STATUS_REMOTE_FAIL: { |
| 1192 web_ui()->CallJavascriptFunction( |
| 1193 "BrowserOptions.showCreateProfileRemoteError"); |
| 1194 DeleteProfileAtPath(profile->GetPath()); |
1137 break; | 1195 break; |
1138 } | 1196 } |
1139 case Profile::CREATE_STATUS_CREATED: { | 1197 case Profile::CREATE_STATUS_CREATED: { |
1140 // Do nothing for an intermediate status. | 1198 // Do nothing for an intermediate status. |
1141 break; | 1199 break; |
1142 } | 1200 } |
1143 case Profile::CREATE_STATUS_INITIALIZED: { | 1201 case Profile::CREATE_STATUS_INITIALIZED: { |
1144 DictionaryValue dict; | 1202 DictionaryValue dict; |
1145 dict.SetString("name", | 1203 dict.SetString("name", |
1146 profile->GetPrefs()->GetString(prefs::kProfileName)); | 1204 profile->GetPrefs()->GetString(prefs::kProfileName)); |
1147 dict.Set("filePath", base::CreateFilePathValue(profile->GetPath())); | 1205 dict.Set("filePath", base::CreateFilePathValue(profile->GetPath())); |
1148 dict.SetBoolean("isManaged", is_managed); | 1206 dict.SetBoolean("isManaged", is_managed); |
1149 web_ui()->CallJavascriptFunction( | 1207 web_ui()->CallJavascriptFunction( |
1150 "BrowserOptions.showCreateProfileSuccess", dict); | 1208 "BrowserOptions.showCreateProfileSuccess", dict); |
1151 | 1209 |
1152 // If the new profile is a managed user, instead of opening a new window | 1210 // If the new profile is a managed user, instead of opening a new window |
1153 // right away, a confirmation overlay will be shown from the creation | 1211 // right away, a confirmation overlay will be shown from the creation |
1154 // dialog. | 1212 // dialog. |
1155 if (!is_managed) { | 1213 if (!is_managed) { |
1156 // Opening the new window must be the last action, after all callbacks | 1214 // Opening the new window must be the last action, after all callbacks |
1157 // have been run, to give them a chance to initialize the profile. | 1215 // have been run, to give them a chance to initialize the profile. |
1158 ProfileManager::FindOrCreateNewWindowForProfile( | 1216 OpenNewWindowForProfile(desktop_type, |
1159 profile, | 1217 profile, |
1160 chrome::startup::IS_PROCESS_STARTUP, | 1218 Profile::CREATE_STATUS_INITIALIZED); |
1161 chrome::startup::IS_FIRST_RUN, | |
1162 desktop_type, | |
1163 false); | |
1164 } | 1219 } |
1165 break; | 1220 break; |
1166 } | 1221 } |
| 1222 case Profile::MAX_CREATE_STATUS: { |
| 1223 NOTREACHED(); |
| 1224 break; |
| 1225 } |
1167 } | 1226 } |
1168 } | 1227 } |
1169 | 1228 |
| 1229 void BrowserOptionsHandler::DeleteProfile(const ListValue* args) { |
| 1230 DCHECK(args); |
| 1231 const Value* file_path_value; |
| 1232 if (!args->Get(0, &file_path_value)) |
| 1233 return; |
| 1234 |
| 1235 base::FilePath file_path; |
| 1236 if (!base::GetValueAsFilePath(*file_path_value, &file_path)) |
| 1237 return; |
| 1238 DeleteProfileAtPath(file_path); |
| 1239 } |
| 1240 |
| 1241 void BrowserOptionsHandler::DeleteProfileAtPath(base::FilePath file_path) { |
| 1242 #if defined(ENABLE_MANAGED_USERS) |
| 1243 // This handler could have been called in managed mode, for example because |
| 1244 // the user fiddled with the web inspector. Silently return in this case. |
| 1245 if (ManagedUserService::ProfileIsManaged(Profile::FromWebUI(web_ui()))) |
| 1246 return; |
| 1247 #endif |
| 1248 |
| 1249 if (!ProfileManager::IsMultipleProfilesEnabled()) |
| 1250 return; |
| 1251 |
| 1252 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); |
| 1253 |
| 1254 Browser* browser = |
| 1255 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
| 1256 chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; |
| 1257 if (browser) |
| 1258 desktop_type = browser->host_desktop_type(); |
| 1259 |
| 1260 g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
| 1261 file_path, |
| 1262 base::Bind(&OpenNewWindowForProfile, desktop_type)); |
| 1263 } |
| 1264 |
1170 void BrowserOptionsHandler::ObserveThemeChanged() { | 1265 void BrowserOptionsHandler::ObserveThemeChanged() { |
1171 Profile* profile = Profile::FromWebUI(web_ui()); | 1266 Profile* profile = Profile::FromWebUI(web_ui()); |
1172 #if defined(TOOLKIT_GTK) | 1267 #if defined(TOOLKIT_GTK) |
1173 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); | 1268 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); |
1174 bool is_gtk_theme = theme_service->UsingNativeTheme(); | 1269 bool is_gtk_theme = theme_service->UsingNativeTheme(); |
1175 base::FundamentalValue gtk_enabled(!is_gtk_theme); | 1270 base::FundamentalValue gtk_enabled(!is_gtk_theme); |
1176 web_ui()->CallJavascriptFunction("BrowserOptions.setGtkThemeButtonEnabled", | 1271 web_ui()->CallJavascriptFunction("BrowserOptions.setGtkThemeButtonEnabled", |
1177 gtk_enabled); | 1272 gtk_enabled); |
1178 #else | 1273 #else |
1179 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); | 1274 ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || | 1710 base::FundamentalValue disabled(profile_pref_registrar_.IsManaged() || |
1616 is_extension_controlled); | 1711 is_extension_controlled); |
1617 base::FundamentalValue extension_controlled(is_extension_controlled); | 1712 base::FundamentalValue extension_controlled(is_extension_controlled); |
1618 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", | 1713 web_ui()->CallJavascriptFunction("BrowserOptions.setupProxySettingsSection", |
1619 disabled, extension_controlled); | 1714 disabled, extension_controlled); |
1620 | 1715 |
1621 #endif // !defined(OS_CHROMEOS) | 1716 #endif // !defined(OS_CHROMEOS) |
1622 } | 1717 } |
1623 | 1718 |
1624 } // namespace options | 1719 } // namespace options |
OLD | NEW |