Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/ui/webui/options2/manage_profile_handler2.cc

Issue 9432003: Disable multi-profile UI in managed mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/options2/browser_options_handler2.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/options2/manage_profile_handler2.h" 5 #include "chrome/browser/ui/webui/options2/manage_profile_handler2.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/profiles/gaia_info_update_service.h" 15 #include "chrome/browser/profiles/gaia_info_update_service.h"
15 #include "chrome/browser/profiles/profile_info_cache.h" 16 #include "chrome/browser/profiles/profile_info_cache.h"
16 #include "chrome/browser/profiles/profile_info_util.h" 17 #include "chrome/browser/profiles/profile_info_util.h"
17 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/profiles/profile_metrics.h" 19 #include "chrome/browser/profiles/profile_metrics.h"
19 #include "chrome/browser/ui/webui/web_ui_util.h" 20 #include "chrome/browser/ui/webui/web_ui_util.h"
20 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/pref_names.h"
21 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/web_ui.h" 24 #include "content/public/browser/web_ui.h"
23 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
24 26
25 namespace options2 { 27 namespace options2 {
26 28
27 ManageProfileHandler::ManageProfileHandler() { 29 ManageProfileHandler::ManageProfileHandler() {
28 } 30 }
29 31
30 ManageProfileHandler::~ManageProfileHandler() { 32 ManageProfileHandler::~ManageProfileHandler() {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 ProfileMetrics::LogProfileAvatarSelection(new_icon_index); 196 ProfileMetrics::LogProfileAvatarSelection(new_icon_index);
195 cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index); 197 cache.SetAvatarIconOfProfileAtIndex(profile_index, new_icon_index);
196 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false); 198 cache.SetIsUsingGAIAPictureOfProfileAtIndex(profile_index, false);
197 } 199 }
198 200
199 ProfileMetrics::LogProfileUpdate(profile_file_path); 201 ProfileMetrics::LogProfileUpdate(profile_file_path);
200 } 202 }
201 203
202 void ManageProfileHandler::DeleteProfile(const ListValue* args) { 204 void ManageProfileHandler::DeleteProfile(const ListValue* args) {
203 DCHECK(args); 205 DCHECK(args);
206 // This handler could have been called in managed mode, for example because
207 // the user fiddled with the web inspector. Silently return in this case.
208 if (!ProfileManager::IsMultipleProfilesEnabled())
209 return;
204 210
205 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED); 211 ProfileMetrics::LogProfileDeleteUser(ProfileMetrics::PROFILE_DELETED);
206 212
207 Value* file_path_value; 213 Value* file_path_value;
208 FilePath profile_file_path; 214 FilePath profile_file_path;
209 if (!args->Get(0, &file_path_value) || 215 if (!args->Get(0, &file_path_value) ||
210 !base::GetValueAsFilePath(*file_path_value, &profile_file_path)) 216 !base::GetValueAsFilePath(*file_path_value, &profile_file_path))
211 return; 217 return;
212 218
213 g_browser_process->profile_manager()->ScheduleProfileForDeletion( 219 g_browser_process->profile_manager()->ScheduleProfileForDeletion(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i); 302 string16 gaia_name = cache.GetGAIANameOfProfileAtIndex(i);
297 if (gaia_name.empty()) 303 if (gaia_name.empty())
298 return; 304 return;
299 305
300 StringValue gaia_name_value(gaia_name); 306 StringValue gaia_name_value(gaia_name);
301 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName", 307 web_ui()->CallJavascriptFunction("ManageProfileOverlay.setProfileName",
302 gaia_name_value); 308 gaia_name_value);
303 } 309 }
304 310
305 } // namespace options2 311 } // namespace options2
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/browser_options_handler2.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698