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

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h

Issue 24625003: Delay wallpaper load by 2 * average wallpaper load time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Catch WallpaperAnimationFinished event and inform JS. Created 7 years, 2 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
OLDNEW
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 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "chrome/browser/chromeos/login/help_app_launcher.h" 16 #include "chrome/browser/chromeos/login/help_app_launcher.h"
17 #include "chrome/browser/chromeos/login/login_display.h" 17 #include "chrome/browser/chromeos/login/login_display.h"
18 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" 18 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h"
19 #include "chrome/browser/chromeos/login/user_manager.h" 19 #include "chrome/browser/chromeos/login/user_manager.h"
20 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
20 #include "chrome/browser/chromeos/net/network_portal_detector.h" 21 #include "chrome/browser/chromeos/net/network_portal_detector.h"
21 #include "chrome/browser/chromeos/settings/cros_settings.h" 22 #include "chrome/browser/chromeos/settings/cros_settings.h"
22 #include "chrome/browser/chromeos/system_key_event_listener.h" 23 #include "chrome/browser/chromeos/system_key_event_listener.h"
23 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" 24 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
24 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" 25 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
25 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 26 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
26 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
27 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
28 #include "content/public/browser/web_ui.h" 29 #include "content/public/browser/web_ui.h"
29 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 virtual ~SigninScreenHandlerDelegate() {} 167 virtual ~SigninScreenHandlerDelegate() {}
167 }; 168 };
168 169
169 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay 170 // A class that handles the WebUI hooks in sign-in screen in OobeDisplay
170 // and LoginDisplay. 171 // and LoginDisplay.
171 class SigninScreenHandler 172 class SigninScreenHandler
172 : public BaseScreenHandler, 173 : public BaseScreenHandler,
173 public LoginDisplayWebUIHandler, 174 public LoginDisplayWebUIHandler,
174 public SystemKeyEventListener::CapsLockObserver, 175 public SystemKeyEventListener::CapsLockObserver,
175 public content::NotificationObserver, 176 public content::NotificationObserver,
176 public NetworkStateInformer::NetworkStateInformerObserver { 177 public NetworkStateInformer::NetworkStateInformerObserver,
178 public WallpaperManager::Observer {
177 public: 179 public:
178 SigninScreenHandler( 180 SigninScreenHandler(
179 const scoped_refptr<NetworkStateInformer>& network_state_informer, 181 const scoped_refptr<NetworkStateInformer>& network_state_informer,
180 ErrorScreenActor* error_screen_actor, 182 ErrorScreenActor* error_screen_actor,
181 CoreOobeActor* core_oobe_actor); 183 CoreOobeActor* core_oobe_actor);
182 virtual ~SigninScreenHandler(); 184 virtual ~SigninScreenHandler();
183 185
184 // Shows the sign in screen. |oobe_ui| indicates whether the signin 186 // Shows the sign in screen. |oobe_ui| indicates whether the signin
185 // screen is for OOBE or usual sign-in flow. 187 // screen is for OOBE or usual sign-in flow.
186 void Show(bool oobe_ui); 188 void Show(bool oobe_ui);
187 189
188 // Shows the login spinner UI for retail mode logins. 190 // Shows the login spinner UI for retail mode logins.
189 void ShowRetailModeLoginSpinner(); 191 void ShowRetailModeLoginSpinner();
190 192
191 // Sets delegate to be used by the handler. It is guaranteed that valid 193 // Sets delegate to be used by the handler. It is guaranteed that valid
192 // delegate is set before Show() method will be called. 194 // delegate is set before Show() method will be called.
193 void SetDelegate(SigninScreenHandlerDelegate* delegate); 195 void SetDelegate(SigninScreenHandlerDelegate* delegate);
194 196
195 void SetNativeWindowDelegate(NativeWindowDelegate* native_window_delegate); 197 void SetNativeWindowDelegate(NativeWindowDelegate* native_window_delegate);
196 198
197 // NetworkStateInformer::NetworkStateInformerObserver implementation: 199 // NetworkStateInformer::NetworkStateInformerObserver implementation:
198 virtual void OnNetworkReady() OVERRIDE; 200 virtual void OnNetworkReady() OVERRIDE;
199 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) OVERRIDE; 201 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) OVERRIDE;
200 202
201 // Required Local State preferences. 203 // Required Local State preferences.
202 static void RegisterPrefs(PrefRegistrySimple* registry); 204 static void RegisterPrefs(PrefRegistrySimple* registry);
203 205
206 // From WallpaperManager::Observer
207 void OnWallpaperAnimationFinished(const std::string& email) OVERRIDE;
208
204 private: 209 private:
205 enum UIState { 210 enum UIState {
206 UI_STATE_UNKNOWN = 0, 211 UI_STATE_UNKNOWN = 0,
207 UI_STATE_GAIA_SIGNIN, 212 UI_STATE_GAIA_SIGNIN,
208 UI_STATE_ACCOUNT_PICKER, 213 UI_STATE_ACCOUNT_PICKER,
209 }; 214 };
210 215
211 enum FrameState { 216 enum FrameState {
212 FRAME_STATE_UNKNOWN = 0, 217 FRAME_STATE_UNKNOWN = 0,
213 FRAME_STATE_LOADING, 218 FRAME_STATE_LOADING,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // Emails of the users, whose passwords have recently been changed. 448 // Emails of the users, whose passwords have recently been changed.
444 std::set<std::string> password_changed_for_; 449 std::set<std::string> password_changed_for_;
445 450
446 // Test credentials. 451 // Test credentials.
447 std::string test_user_; 452 std::string test_user_;
448 std::string test_pass_; 453 std::string test_pass_;
449 bool test_expects_complete_login_; 454 bool test_expects_complete_login_;
450 455
451 base::WeakPtrFactory<SigninScreenHandler> weak_factory_; 456 base::WeakPtrFactory<SigninScreenHandler> weak_factory_;
452 457
458 base::WeakPtrFactory<WallpaperManager::Observer> weak_factory_as_observer_;
459
453 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed. 460 // Set to true once |LOGIN_WEBUI_VISIBLE| notification is observed.
454 bool webui_visible_; 461 bool webui_visible_;
455 bool preferences_changed_delayed_; 462 bool preferences_changed_delayed_;
456 463
457 ErrorScreenActor* error_screen_actor_; 464 ErrorScreenActor* error_screen_actor_;
458 CoreOobeActor* core_oobe_actor_; 465 CoreOobeActor* core_oobe_actor_;
459 466
460 bool is_first_update_state_call_; 467 bool is_first_update_state_call_;
461 bool offline_login_active_; 468 bool offline_login_active_;
462 NetworkStateInformer::State last_network_state_; 469 NetworkStateInformer::State last_network_state_;
(...skipping 10 matching lines...) Expand all
473 480
474 scoped_ptr<CrosSettings::ObserverSubscription> allow_new_user_subscription_; 481 scoped_ptr<CrosSettings::ObserverSubscription> allow_new_user_subscription_;
475 scoped_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_; 482 scoped_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_;
476 483
477 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler); 484 DISALLOW_COPY_AND_ASSIGN(SigninScreenHandler);
478 }; 485 };
479 486
480 } // namespace chromeos 487 } // namespace chromeos
481 488
482 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_ 489 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_SIGNIN_SCREEN_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698