OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Given |args| from the WebUI, parses value 0 as a FilePath |profile_file_path| | 57 // Given |args| from the WebUI, parses value 0 as a FilePath |profile_file_path| |
58 // and returns true on success. | 58 // and returns true on success. |
59 bool GetProfilePathFromArgs(const base::ListValue* args, | 59 bool GetProfilePathFromArgs(const base::ListValue* args, |
60 base::FilePath* profile_file_path) { | 60 base::FilePath* profile_file_path) { |
61 const base::Value* file_path_value; | 61 const base::Value* file_path_value; |
62 if (!args->Get(0, &file_path_value)) | 62 if (!args->Get(0, &file_path_value)) |
63 return false; | 63 return false; |
64 return base::GetValueAsFilePath(*file_path_value, profile_file_path); | 64 return base::GetValueAsFilePath(*file_path_value, profile_file_path); |
65 } | 65 } |
66 | 66 |
| 67 void HandleLogDeleteUserDialogShown(const base::ListValue* args) { |
| 68 ProfileMetrics::LogProfileDeleteUser( |
| 69 ProfileMetrics::DELETE_PROFILE_SETTINGS_SHOW_WARNING); |
| 70 } |
| 71 |
67 } // namespace | 72 } // namespace |
68 | 73 |
69 ManageProfileHandler::ManageProfileHandler() | 74 ManageProfileHandler::ManageProfileHandler() |
70 : weak_factory_(this) { | 75 : weak_factory_(this) { |
71 } | 76 } |
72 | 77 |
73 ManageProfileHandler::~ManageProfileHandler() { | 78 ManageProfileHandler::~ManageProfileHandler() { |
74 ProfileSyncService* service = | 79 ProfileSyncService* service = |
75 ProfileSyncServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); | 80 ProfileSyncServiceFactory::GetForProfile(Profile::FromWebUI(web_ui())); |
76 // Sync may be disabled in tests. | 81 // Sync may be disabled in tests. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 web_ui()->RegisterMessageCallback("removeProfileShortcut", | 183 web_ui()->RegisterMessageCallback("removeProfileShortcut", |
179 base::Bind(&ManageProfileHandler::RemoveProfileShortcut, | 184 base::Bind(&ManageProfileHandler::RemoveProfileShortcut, |
180 base::Unretained(this))); | 185 base::Unretained(this))); |
181 web_ui()->RegisterMessageCallback("refreshGaiaPicture", | 186 web_ui()->RegisterMessageCallback("refreshGaiaPicture", |
182 base::Bind(&ManageProfileHandler::RefreshGaiaPicture, | 187 base::Bind(&ManageProfileHandler::RefreshGaiaPicture, |
183 base::Unretained(this))); | 188 base::Unretained(this))); |
184 web_ui()->RegisterMessageCallback( | 189 web_ui()->RegisterMessageCallback( |
185 "showDisconnectManagedProfileDialog", | 190 "showDisconnectManagedProfileDialog", |
186 base::Bind(&ManageProfileHandler::ShowDisconnectManagedProfileDialog, | 191 base::Bind(&ManageProfileHandler::ShowDisconnectManagedProfileDialog, |
187 base::Unretained(this))); | 192 base::Unretained(this))); |
| 193 web_ui()->RegisterMessageCallback("logDeleteUserDialogShown", |
| 194 base::Bind(&HandleLogDeleteUserDialogShown)); |
188 } | 195 } |
189 | 196 |
190 void ManageProfileHandler::Uninitialize() { | 197 void ManageProfileHandler::Uninitialize() { |
191 g_browser_process->profile_manager()-> | 198 g_browser_process->profile_manager()-> |
192 GetProfileInfoCache().RemoveObserver(this); | 199 GetProfileInfoCache().RemoveObserver(this); |
193 } | 200 } |
194 | 201 |
195 void ManageProfileHandler::OnProfileAdded(const base::FilePath& profile_path) { | 202 void ManageProfileHandler::OnProfileAdded(const base::FilePath& profile_path) { |
196 SendExistingProfileNames(); | 203 SendExistingProfileNames(); |
197 } | 204 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 | 556 |
550 // Update the UI buttons. | 557 // Update the UI buttons. |
551 OnHasProfileShortcuts(false); | 558 OnHasProfileShortcuts(false); |
552 } | 559 } |
553 | 560 |
554 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { | 561 void ManageProfileHandler::RefreshGaiaPicture(const base::ListValue* args) { |
555 profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui())); | 562 profiles::UpdateGaiaProfileInfoIfNeeded(Profile::FromWebUI(web_ui())); |
556 } | 563 } |
557 | 564 |
558 } // namespace options | 565 } // namespace options |
OLD | NEW |