OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_IMPL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "chrome/browser/chromeos/login/app_launch_controller.h" | 14 #include "chrome/browser/chromeos/login/app_launch_controller.h" |
15 #include "chrome/browser/chromeos/login/auth_prewarmer.h" | 15 #include "chrome/browser/chromeos/login/auth_prewarmer.h" |
16 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 16 #include "chrome/browser/chromeos/login/existing_user_controller.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/login_display_host.h" | 18 #include "chrome/browser/chromeos/login/login_display_host.h" |
19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
20 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 20 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 21 #include "chromeos/audio/cras_audio_handler.h" |
21 #include "chromeos/dbus/session_manager_client.h" | 22 #include "chromeos/dbus/session_manager_client.h" |
22 #include "content/public/browser/notification_observer.h" | 23 #include "content/public/browser/notification_observer.h" |
23 #include "content/public/browser/notification_registrar.h" | 24 #include "content/public/browser/notification_registrar.h" |
24 #include "content/public/browser/web_contents_observer.h" | 25 #include "content/public/browser/web_contents_observer.h" |
25 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
26 | 27 |
27 class PrefService; | 28 class PrefService; |
28 | 29 |
29 namespace policy { | 30 namespace policy { |
30 class AutoEnrollmentClient; | 31 class AutoEnrollmentClient; |
31 } // namespace policy | 32 } // namespace policy |
32 | 33 |
33 namespace chromeos { | 34 namespace chromeos { |
34 | 35 |
35 class FocusRingController; | 36 class FocusRingController; |
36 class KeyboardDrivenOobeKeyHandler; | 37 class KeyboardDrivenOobeKeyHandler; |
37 class OobeUI; | 38 class OobeUI; |
38 class WebUILoginDisplay; | 39 class WebUILoginDisplay; |
39 class WebUILoginView; | 40 class WebUILoginView; |
40 | 41 |
41 // An implementation class for OOBE/login WebUI screen host. | 42 // An implementation class for OOBE/login WebUI screen host. |
42 // It encapsulates controllers, background integration and flow. | 43 // It encapsulates controllers, background integration and flow. |
43 class LoginDisplayHostImpl : public LoginDisplayHost, | 44 class LoginDisplayHostImpl : public LoginDisplayHost, |
44 public content::NotificationObserver, | 45 public content::NotificationObserver, |
45 public content::WebContentsObserver, | 46 public content::WebContentsObserver, |
46 public chromeos::SessionManagerClient::Observer { | 47 public chromeos::SessionManagerClient::Observer, |
| 48 public chromeos::CrasAudioHandler::AudioObserver { |
47 public: | 49 public: |
48 explicit LoginDisplayHostImpl(const gfx::Rect& background_bounds); | 50 explicit LoginDisplayHostImpl(const gfx::Rect& background_bounds); |
49 virtual ~LoginDisplayHostImpl(); | 51 virtual ~LoginDisplayHostImpl(); |
50 | 52 |
51 // Returns the default LoginDispalyHost instance if it has been created. | 53 // Returns the default LoginDispalyHost instance if it has been created. |
52 static LoginDisplayHost* default_host() { | 54 static LoginDisplayHost* default_host() { |
53 return default_host_; | 55 return default_host_; |
54 } | 56 } |
55 | 57 |
56 // LoginDisplayHost implementation: | 58 // LoginDisplayHost implementation: |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 virtual void Observe(int type, | 103 virtual void Observe(int type, |
102 const content::NotificationSource& source, | 104 const content::NotificationSource& source, |
103 const content::NotificationDetails& details) OVERRIDE; | 105 const content::NotificationDetails& details) OVERRIDE; |
104 | 106 |
105 // Overridden from content::WebContentsObserver: | 107 // Overridden from content::WebContentsObserver: |
106 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 108 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
107 | 109 |
108 // Overridden from chromeos::SessionManagerClient::Observer: | 110 // Overridden from chromeos::SessionManagerClient::Observer: |
109 virtual void EmitLoginPromptVisibleCalled() OVERRIDE; | 111 virtual void EmitLoginPromptVisibleCalled() OVERRIDE; |
110 | 112 |
| 113 // Overridden from chromeos::CrasAudioHandler::AudioObserver: |
| 114 virtual void OnActiveOutputNodeChanged() OVERRIDE; |
| 115 |
111 private: | 116 private: |
112 // Way to restore if renderer have crashed. | 117 // Way to restore if renderer have crashed. |
113 enum RestorePath { | 118 enum RestorePath { |
114 RESTORE_UNKNOWN, | 119 RESTORE_UNKNOWN, |
115 RESTORE_WIZARD, | 120 RESTORE_WIZARD, |
116 RESTORE_SIGN_IN, | 121 RESTORE_SIGN_IN, |
117 RESTORE_ADD_USER_INTO_SESSION, | 122 RESTORE_ADD_USER_INTO_SESSION, |
118 }; | 123 }; |
119 | 124 |
120 // Type of animations to run after the login screen. | 125 // Type of animations to run after the login screen. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 void OnAuthPrewarmDone(); | 170 void OnAuthPrewarmDone(); |
166 | 171 |
167 // Toggles OOBE progress bar visibility, the bar is hidden by default. | 172 // Toggles OOBE progress bar visibility, the bar is hidden by default. |
168 void SetOobeProgressBarVisible(bool visible); | 173 void SetOobeProgressBarVisible(bool visible); |
169 | 174 |
170 // Notifies the interested parties of the auto enrollment check result. | 175 // Notifies the interested parties of the auto enrollment check result. |
171 void NotifyAutoEnrollmentCheckResult(bool should_auto_enroll); | 176 void NotifyAutoEnrollmentCheckResult(bool should_auto_enroll); |
172 | 177 |
173 // Tries to play startup sound. If sound can't be played right now, | 178 // Tries to play startup sound. If sound can't be played right now, |
174 // for instance, because cras server is not initialized, playback | 179 // for instance, because cras server is not initialized, playback |
175 // will be delayed. When |honor_spoken_feedback| is true, sound will | 180 // will be delayed. |
176 // be reproduced iff spoken feedback is enabled. | 181 void TryToPlayStartupSound(); |
177 void TryToPlayStartupSound(bool honor_spoken_feedback); | |
178 | 182 |
179 // Called when login-prompt-visible signal is caught. | 183 // Called when login-prompt-visible signal is caught. |
180 void OnLoginPromptVisible(); | 184 void OnLoginPromptVisible(); |
181 | 185 |
182 // Asks ChromeOSSoundsManager to play startup sound. If | |
183 // |startup_sound_at_signin_| is true, sound will be played iff | |
184 // spoken feedback is enabled. | |
185 void PlayStartupSound(); | |
186 | |
187 // Used to calculate position of the screens and background. | 186 // Used to calculate position of the screens and background. |
188 gfx::Rect background_bounds_; | 187 gfx::Rect background_bounds_; |
189 | 188 |
190 content::NotificationRegistrar registrar_; | 189 content::NotificationRegistrar registrar_; |
191 | 190 |
192 base::WeakPtrFactory<LoginDisplayHostImpl> pointer_factory_; | 191 base::WeakPtrFactory<LoginDisplayHostImpl> pointer_factory_; |
193 | 192 |
194 // Default LoginDisplayHost. | 193 // Default LoginDisplayHost. |
195 static LoginDisplayHost* default_host_; | 194 static LoginDisplayHost* default_host_; |
196 | 195 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 get_auto_enrollment_result_callbacks_; | 285 get_auto_enrollment_result_callbacks_; |
287 | 286 |
288 FinalizeAnimationType finalize_animation_type_; | 287 FinalizeAnimationType finalize_animation_type_; |
289 | 288 |
290 base::WeakPtrFactory<LoginDisplayHostImpl> animation_weak_ptr_factory_; | 289 base::WeakPtrFactory<LoginDisplayHostImpl> animation_weak_ptr_factory_; |
291 | 290 |
292 // Time when login prompt visible signal is received. Used for | 291 // Time when login prompt visible signal is received. Used for |
293 // calculations of delay before startup sound. | 292 // calculations of delay before startup sound. |
294 base::TimeTicks login_prompt_visible_time_; | 293 base::TimeTicks login_prompt_visible_time_; |
295 | 294 |
296 // True when startup sound is requested. | |
297 bool startup_sound_requested_; | |
298 | |
299 // True when request to play startup sound was sent to | 295 // True when request to play startup sound was sent to |
300 // SoundsManager. | 296 // SoundsManager. |
301 bool startup_sound_played_; | 297 bool startup_sound_played_; |
302 | 298 |
303 // When true, startup sound should be played only when spoken | 299 // When true, startup sound should be played only when spoken |
304 // feedback is enabled. Otherwise, startup sound should be played | 300 // feedback is enabled. Otherwise, startup sound should be played |
305 // in any case. | 301 // in any case. |
306 bool startup_sound_honors_spoken_feedback_; | 302 bool startup_sound_honors_spoken_feedback_; |
307 | 303 |
308 DISALLOW_COPY_AND_ASSIGN(LoginDisplayHostImpl); | 304 DISALLOW_COPY_AND_ASSIGN(LoginDisplayHostImpl); |
309 }; | 305 }; |
310 | 306 |
311 } // namespace chromeos | 307 } // namespace chromeos |
312 | 308 |
313 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_IMPL_H_ | 309 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_DISPLAY_HOST_IMPL_H_ |
OLD | NEW |