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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 2218173002: Revert of Clears GuestModeEnabled and AddPersonEnabled user prefs if MD settings is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | tools/metrics/actions/actions.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/signin/user_manager_screen_handler.h" 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/feature_list.h"
14 #include "base/location.h" 13 #include "base/location.h"
15 #include "base/macros.h" 14 #include "base/macros.h"
16 #include "base/profiler/scoped_tracker.h" 15 #include "base/profiler/scoped_tracker.h"
17 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
18 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
19 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
20 #include "base/value_conversions.h" 19 #include "base/value_conversions.h"
21 #include "base/values.h" 20 #include "base/values.h"
22 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/chrome_notification_types.h" 22 #include "chrome/browser/chrome_notification_types.h"
(...skipping 12 matching lines...) Expand all
36 #include "chrome/browser/ui/app_list/app_list_service.h" 35 #include "chrome/browser/ui/app_list/app_list_service.h"
37 #include "chrome/browser/ui/browser_commands.h" 36 #include "chrome/browser/ui/browser_commands.h"
38 #include "chrome/browser/ui/browser_dialogs.h" 37 #include "chrome/browser/ui/browser_dialogs.h"
39 #include "chrome/browser/ui/browser_finder.h" 38 #include "chrome/browser/ui/browser_finder.h"
40 #include "chrome/browser/ui/browser_list.h" 39 #include "chrome/browser/ui/browser_list.h"
41 #include "chrome/browser/ui/browser_list_observer.h" 40 #include "chrome/browser/ui/browser_list_observer.h"
42 #include "chrome/browser/ui/chrome_pages.h" 41 #include "chrome/browser/ui/chrome_pages.h"
43 #include "chrome/browser/ui/singleton_tabs.h" 42 #include "chrome/browser/ui/singleton_tabs.h"
44 #include "chrome/browser/ui/user_manager.h" 43 #include "chrome/browser/ui/user_manager.h"
45 #include "chrome/browser/ui/webui/profile_helper.h" 44 #include "chrome/browser/ui/webui/profile_helper.h"
46 #include "chrome/common/chrome_features.h"
47 #include "chrome/common/pref_names.h" 45 #include "chrome/common/pref_names.h"
48 #include "chrome/common/url_constants.h" 46 #include "chrome/common/url_constants.h"
49 #include "chrome/grit/chromium_strings.h" 47 #include "chrome/grit/chromium_strings.h"
50 #include "chrome/grit/generated_resources.h" 48 #include "chrome/grit/generated_resources.h"
51 #include "components/prefs/pref_service.h" 49 #include "components/prefs/pref_service.h"
52 #include "components/proximity_auth/screenlock_bridge.h" 50 #include "components/proximity_auth/screenlock_bridge.h"
53 #include "components/signin/core/account_id/account_id.h" 51 #include "components/signin/core/account_id/account_id.h"
54 #include "components/signin/core/common/profile_management_switches.h" 52 #include "components/signin/core/common/profile_management_switches.h"
55 #include "content/public/browser/notification_service.h" 53 #include "content/public/browser/notification_service.h"
56 #include "content/public/browser/storage_partition.h" 54 #include "content/public/browser/storage_partition.h"
57 #include "content/public/browser/user_metrics.h"
58 #include "content/public/browser/web_contents.h" 55 #include "content/public/browser/web_contents.h"
59 #include "content/public/browser/web_ui.h" 56 #include "content/public/browser/web_ui.h"
60 #include "google_apis/gaia/gaia_auth_fetcher.h" 57 #include "google_apis/gaia/gaia_auth_fetcher.h"
61 #include "google_apis/gaia/gaia_constants.h" 58 #include "google_apis/gaia/gaia_constants.h"
62 #include "grit/components_strings.h" 59 #include "grit/components_strings.h"
63 #include "third_party/skia/include/core/SkBitmap.h" 60 #include "third_party/skia/include/core/SkBitmap.h"
64 #include "ui/base/l10n/l10n_util.h" 61 #include "ui/base/l10n/l10n_util.h"
65 #include "ui/base/resource/resource_bundle.h" 62 #include "ui/base/resource/resource_bundle.h"
66 #include "ui/base/webui/web_ui_util.h" 63 #include "ui/base/webui/web_ui_util.h"
67 #include "ui/gfx/image/image.h" 64 #include "ui/gfx/image/image.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 284
288 DISALLOW_COPY_AND_ASSIGN(ProfileUpdateObserver); 285 DISALLOW_COPY_AND_ASSIGN(ProfileUpdateObserver);
289 }; 286 };
290 287
291 // UserManagerScreenHandler --------------------------------------------------- 288 // UserManagerScreenHandler ---------------------------------------------------
292 289
293 UserManagerScreenHandler::UserManagerScreenHandler() : weak_ptr_factory_(this) { 290 UserManagerScreenHandler::UserManagerScreenHandler() : weak_ptr_factory_(this) {
294 profile_attributes_storage_observer_.reset( 291 profile_attributes_storage_observer_.reset(
295 new UserManagerScreenHandler::ProfileUpdateObserver( 292 new UserManagerScreenHandler::ProfileUpdateObserver(
296 g_browser_process->profile_manager(), this)); 293 g_browser_process->profile_manager(), this));
297
298 // TODO(mahmadi): Remove the following once prefs are cleared for everyone.
299 PrefService* service = g_browser_process->local_state();
300 DCHECK(service);
301
302 const PrefService::Preference* guest_mode_enabled_pref =
303 service->FindPreference(prefs::kBrowserGuestModeEnabled);
304 const PrefService::Preference* add_person_enabled_pref =
305 service->FindPreference(prefs::kBrowserAddPersonEnabled);
306
307 if (base::FeatureList::IsEnabled(features::kMaterialDesignSettingsFeature) &&
308 (guest_mode_enabled_pref->HasUserSetting() ||
309 add_person_enabled_pref->HasUserSetting())) {
310 service->ClearPref(guest_mode_enabled_pref->name());
311 service->ClearPref(add_person_enabled_pref->name());
312 content::RecordAction(
313 base::UserMetricsAction("UserManager_Cleared_Legacy_User_Prefs"));
314 }
315 } 294 }
316 295
317 UserManagerScreenHandler::~UserManagerScreenHandler() { 296 UserManagerScreenHandler::~UserManagerScreenHandler() {
318 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); 297 proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL);
319 } 298 }
320 299
321 void UserManagerScreenHandler::ShowBannerMessage( 300 void UserManagerScreenHandler::ShowBannerMessage(
322 const base::string16& message) { 301 const base::string16& message) {
323 web_ui()->CallJavascriptFunctionUnsafe( 302 web_ui()->CallJavascriptFunctionUnsafe(
324 "login.AccountPickerScreen.showBannerMessage", 303 "login.AccountPickerScreen.showBannerMessage",
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 Profile* profile, Profile::CreateStatus profile_create_status) { 1017 Profile* profile, Profile::CreateStatus profile_create_status) {
1039 Browser* browser = chrome::FindAnyBrowser(profile, false); 1018 Browser* browser = chrome::FindAnyBrowser(profile, false);
1040 if (browser && browser->window()) { 1019 if (browser && browser->window()) {
1041 OnBrowserWindowReady(browser); 1020 OnBrowserWindowReady(browser);
1042 } else { 1021 } else {
1043 registrar_.Add(this, 1022 registrar_.Add(this,
1044 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 1023 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
1045 content::NotificationService::AllSources()); 1024 content::NotificationService::AllSources());
1046 } 1025 }
1047 } 1026 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698