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/manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/options/manage_profile_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "base/value_conversions.h" | 11 #include "base/value_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/prefs/pref_service.h" | 14 #include "chrome/browser/prefs/pref_service.h" |
15 #include "chrome/browser/profiles/gaia_info_update_service.h" | 15 #include "chrome/browser/profiles/gaia_info_update_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/profiles/profile_info_cache.h" | 17 #include "chrome/browser/profiles/profile_info_cache.h" |
18 #include "chrome/browser/profiles/profile_info_util.h" | 18 #include "chrome/browser/profiles/profile_info_util.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/profiles/profile_metrics.h" | 20 #include "chrome/browser/profiles/profile_metrics.h" |
21 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 21 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
22 #include "chrome/browser/ui/browser_finder.h" | |
22 #include "chrome/browser/ui/webui/web_ui_util.h" | 23 #include "chrome/browser/ui/webui/web_ui_util.h" |
23 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/web_ui.h" | 27 #include "content/public/browser/web_ui.h" |
27 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
28 | 29 |
29 namespace options { | 30 namespace options { |
30 | 31 |
31 namespace { | 32 namespace { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 return; | 250 return; |
250 | 251 |
251 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); | 252 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); |
252 | 253 |
253 const Value* file_path_value; | 254 const Value* file_path_value; |
254 FilePath profile_file_path; | 255 FilePath profile_file_path; |
255 if (!args->Get(0, &file_path_value) || | 256 if (!args->Get(0, &file_path_value) || |
256 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) | 257 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) |
257 return; | 258 return; |
258 | 259 |
260 Browser* browser = | |
261 browser::FindBrowserWithWebContents(web_ui()->GetWebContents()); | |
262 chrome::HostDesktopType desktop_type = chrome::HOST_DESKTOP_TYPE_NATIVE; | |
263 if (browser) { | |
Ben Goodger (Google)
2012/10/03 19:16:56
nit: no braces
robertshield
2012/10/03 19:58:17
Done.
| |
264 desktop_type = browser->host_desktop_type(); | |
265 } | |
266 | |
259 g_browser_process->profile_manager()->ScheduleProfileForDeletion( | 267 g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
260 profile_file_path); | 268 profile_file_path, desktop_type); |
261 } | 269 } |
262 | 270 |
263 void ManageProfileHandler::ProfileIconSelectionChanged( | 271 void ManageProfileHandler::ProfileIconSelectionChanged( |
264 const base::ListValue* args) { | 272 const base::ListValue* args) { |
265 DCHECK(args); | 273 DCHECK(args); |
266 | 274 |
267 const Value* file_path_value; | 275 const Value* file_path_value; |
268 FilePath file_path; | 276 FilePath file_path; |
269 if (!args->Get(0, &file_path_value) || | 277 if (!args->Get(0, &file_path_value) || |
270 !base::GetValueAsFilePath(*file_path_value, &file_path)) { | 278 !base::GetValueAsFilePath(*file_path_value, &file_path)) { |
(...skipping 21 matching lines...) Expand all Loading... | |
292 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); | 300 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); |
293 if (gaia_name.empty()) | 301 if (gaia_name.empty()) |
294 return; | 302 return; |
295 | 303 |
296 StringValue gaia_name_value(gaia_name); | 304 StringValue gaia_name_value(gaia_name); |
297 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", | 305 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", |
298 gaia_name_value); | 306 gaia_name_value); |
299 } | 307 } |
300 | 308 |
301 } // namespace options | 309 } // namespace options |
OLD | NEW |