| OLD | NEW |
| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/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/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 15 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 15 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 17 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 18 #include "chrome/browser/profiles/profile_info_cache.h" | 18 #include "chrome/browser/profiles/profile_info_cache.h" |
| 19 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 19 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/profiles/profile_metrics.h" | 21 #include "chrome/browser/profiles/profile_metrics.h" |
| 22 #include "chrome/browser/profiles/profile_window.h" | 22 #include "chrome/browser/profiles/profile_window.h" |
| 23 #include "chrome/browser/profiles/profiles_state.h" | 23 #include "chrome/browser/profiles/profiles_state.h" |
| 24 #include "chrome/browser/signin/easy_unlock_util.h" |
| 24 #include "chrome/browser/signin/local_auth.h" | 25 #include "chrome/browser/signin/local_auth.h" |
| 25 #include "chrome/browser/ui/app_list/app_list_service.h" | 26 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 26 #include "chrome/browser/ui/browser_commands.h" | 27 #include "chrome/browser/ui/browser_commands.h" |
| 27 #include "chrome/browser/ui/browser_dialogs.h" | 28 #include "chrome/browser/ui/browser_dialogs.h" |
| 28 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
| 29 #include "chrome/browser/ui/browser_list.h" | 30 #include "chrome/browser/ui/browser_list.h" |
| 30 #include "chrome/browser/ui/browser_list_observer.h" | 31 #include "chrome/browser/ui/browser_list_observer.h" |
| 31 #include "chrome/browser/ui/chrome_pages.h" | 32 #include "chrome/browser/ui/chrome_pages.h" |
| 32 #include "chrome/browser/ui/singleton_tabs.h" | 33 #include "chrome/browser/ui/singleton_tabs.h" |
| 33 #include "chrome/browser/ui/user_manager.h" | 34 #include "chrome/browser/ui/user_manager.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 291 |
| 291 UserManagerScreenHandler::UserManagerScreenHandler() | 292 UserManagerScreenHandler::UserManagerScreenHandler() |
| 292 : desktop_type_(chrome::GetActiveDesktop()), | 293 : desktop_type_(chrome::GetActiveDesktop()), |
| 293 weak_ptr_factory_(this) { | 294 weak_ptr_factory_(this) { |
| 294 profileInfoCacheObserver_.reset( | 295 profileInfoCacheObserver_.reset( |
| 295 new UserManagerScreenHandler::ProfileUpdateObserver( | 296 new UserManagerScreenHandler::ProfileUpdateObserver( |
| 296 g_browser_process->profile_manager(), this)); | 297 g_browser_process->profile_manager(), this)); |
| 297 } | 298 } |
| 298 | 299 |
| 299 UserManagerScreenHandler::~UserManagerScreenHandler() { | 300 UserManagerScreenHandler::~UserManagerScreenHandler() { |
| 300 ScreenlockBridge::Get()->SetLockHandler(NULL); | 301 GetScreenlockBridgeInstance()->SetLockHandler(NULL); |
| 301 } | 302 } |
| 302 | 303 |
| 303 void UserManagerScreenHandler::ShowBannerMessage( | 304 void UserManagerScreenHandler::ShowBannerMessage( |
| 304 const base::string16& message) { | 305 const base::string16& message) { |
| 305 web_ui()->CallJavascriptFunction( | 306 web_ui()->CallJavascriptFunction( |
| 306 "login.AccountPickerScreen.showBannerMessage", | 307 "login.AccountPickerScreen.showBannerMessage", |
| 307 base::StringValue(message)); | 308 base::StringValue(message)); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void UserManagerScreenHandler::ShowUserPodCustomIcon( | 311 void UserManagerScreenHandler::ShowUserPodCustomIcon( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // If the URL has a hash parameter, store it for later. | 382 // If the URL has a hash parameter, store it for later. |
| 382 args->GetString(0, &url_hash_); | 383 args->GetString(0, &url_hash_); |
| 383 | 384 |
| 384 SendUserList(); | 385 SendUserList(); |
| 385 web_ui()->CallJavascriptFunction("cr.ui.Oobe.showUserManagerScreen", | 386 web_ui()->CallJavascriptFunction("cr.ui.Oobe.showUserManagerScreen", |
| 386 base::FundamentalValue(IsGuestModeEnabled()), | 387 base::FundamentalValue(IsGuestModeEnabled()), |
| 387 base::FundamentalValue(IsAddPersonEnabled())); | 388 base::FundamentalValue(IsAddPersonEnabled())); |
| 388 desktop_type_ = chrome::GetHostDesktopTypeForNativeView( | 389 desktop_type_ = chrome::GetHostDesktopTypeForNativeView( |
| 389 web_ui()->GetWebContents()->GetNativeView()); | 390 web_ui()->GetWebContents()->GetNativeView()); |
| 390 | 391 |
| 391 ScreenlockBridge::Get()->SetLockHandler(this); | 392 GetScreenlockBridgeInstance()->SetLockHandler(this); |
| 392 } | 393 } |
| 393 | 394 |
| 394 void UserManagerScreenHandler::HandleAddUser(const base::ListValue* args) { | 395 void UserManagerScreenHandler::HandleAddUser(const base::ListValue* args) { |
| 395 if (!IsAddPersonEnabled()) { | 396 if (!IsAddPersonEnabled()) { |
| 396 // The 'Add User' UI should not be showing. | 397 // The 'Add User' UI should not be showing. |
| 397 NOTREACHED(); | 398 NOTREACHED(); |
| 398 return; | 399 return; |
| 399 } | 400 } |
| 400 profiles::CreateAndSwitchToNewProfile( | 401 profiles::CreateAndSwitchToNewProfile( |
| 401 desktop_type_, | 402 desktop_type_, |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 Profile* profile, Profile::CreateStatus profile_create_status) { | 856 Profile* profile, Profile::CreateStatus profile_create_status) { |
| 856 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); | 857 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); |
| 857 if (browser && browser->window()) { | 858 if (browser && browser->window()) { |
| 858 OnBrowserWindowReady(browser); | 859 OnBrowserWindowReady(browser); |
| 859 } else { | 860 } else { |
| 860 registrar_.Add(this, | 861 registrar_.Add(this, |
| 861 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 862 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 862 content::NotificationService::AllSources()); | 863 content::NotificationService::AllSources()); |
| 863 } | 864 } |
| 864 } | 865 } |
| OLD | NEW |