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

Side by Side Diff: chrome/browser/chromeos/login/webui_login_display_host.cc

Issue 9264059: Enable hide animation for login screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 10 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/chromeos/login/webui_login_display_host.h ('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/chromeos/login/webui_login_display_host.h" 5 #include "chrome/browser/chromeos/login/webui_login_display_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/time.h"
9 #include "chrome/browser/chromeos/login/oobe_display.h" 10 #include "chrome/browser/chromeos/login/oobe_display.h"
10 #include "chrome/browser/chromeos/login/webui_login_display.h" 11 #include "chrome/browser/chromeos/login/webui_login_display.h"
11 #include "chrome/browser/chromeos/login/webui_login_view.h" 12 #include "chrome/browser/chromeos/login/webui_login_view.h"
12 #include "chrome/browser/chromeos/login/wizard_controller.h" 13 #include "chrome/browser/chromeos/login/wizard_controller.h"
13 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 14 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
14 #include "content/public/browser/web_ui.h" 15 #include "content/public/browser/web_ui.h"
15 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
16 17
17 #if defined(USE_AURA) 18 #if defined(USE_AURA)
18 #include "ash/shell.h" 19 #include "ash/shell.h"
19 #include "ash/shell_window_ids.h" 20 #include "ash/shell_window_ids.h"
21 #include "ash/wm/window_animations.h"
20 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
21 #endif 23 #endif
22 24
23 namespace chromeos { 25 namespace chromeos {
24 26
25 namespace { 27 namespace {
26 28
27 // URL which corresponds to the login WebUI. 29 // URL which corresponds to the login WebUI.
28 const char kLoginURL[] = "chrome://oobe/login"; 30 const char kLoginURL[] = "chrome://oobe/login";
29 // URL which corresponds to the OOBE WebUI. 31 // URL which corresponds to the OOBE WebUI.
30 const char kOobeURL[] = "chrome://oobe"; 32 const char kOobeURL[] = "chrome://oobe";
31 33
34 // Duration of sign-in transition animation.
35 const int kLoginFadeoutTransitionDurationMs = 700;
36
32 } // namespace 37 } // namespace
33 38
34 // WebUILoginDisplayHost ------------------------------------------------------- 39 // WebUILoginDisplayHost -------------------------------------------------------
35 40
36 WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds) 41 WebUILoginDisplayHost::WebUILoginDisplayHost(const gfx::Rect& background_bounds)
37 : BaseLoginDisplayHost(background_bounds), 42 : BaseLoginDisplayHost(background_bounds),
38 login_window_(NULL), 43 login_window_(NULL),
39 login_view_(NULL), 44 login_view_(NULL),
40 webui_login_display_(NULL) { 45 webui_login_display_(NULL) {
41 } 46 }
42 47
43 WebUILoginDisplayHost::~WebUILoginDisplayHost() { 48 WebUILoginDisplayHost::~WebUILoginDisplayHost() {
44 CloseWindow(); 49 if (login_window_)
50 login_window_->Close();
45 } 51 }
46 52
47 // LoginDisplayHost implementation --------------------------------------------- 53 // LoginDisplayHost implementation ---------------------------------------------
48 54
49 LoginDisplay* WebUILoginDisplayHost::CreateLoginDisplay( 55 LoginDisplay* WebUILoginDisplayHost::CreateLoginDisplay(
50 LoginDisplay::Delegate* delegate) { 56 LoginDisplay::Delegate* delegate) {
51 webui_login_display_ = new WebUILoginDisplay(delegate); 57 webui_login_display_ = new WebUILoginDisplay(delegate);
52 webui_login_display_->set_background_bounds(background_bounds()); 58 webui_login_display_->set_background_bounds(background_bounds());
53 return webui_login_display_; 59 return webui_login_display_;
54 } 60 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 117
112 void WebUILoginDisplayHost::StartSignInScreen() { 118 void WebUILoginDisplayHost::StartSignInScreen() {
113 if (!login_window_) 119 if (!login_window_)
114 LoadURL(GURL(kLoginURL)); 120 LoadURL(GURL(kLoginURL));
115 121
116 BaseLoginDisplayHost::StartSignInScreen(); 122 BaseLoginDisplayHost::StartSignInScreen();
117 CHECK(webui_login_display_); 123 CHECK(webui_login_display_);
118 GetOobeUI()->ShowSigninScreen(webui_login_display_); 124 GetOobeUI()->ShowSigninScreen(webui_login_display_);
119 } 125 }
120 126
121 void WebUILoginDisplayHost::CloseWindow() { 127 void WebUILoginDisplayHost::OnBrowserCreated() {
128 #if defined(USE_AURA)
129 // Close lock window now so that the launched browser can receive focus.
122 if (login_window_) { 130 if (login_window_) {
123 login_window_->Close(); 131 login_window_->Close();
124 login_window_ = NULL; 132 login_window_ = NULL;
125 login_view_ = NULL; 133 login_view_ = NULL;
126 } 134 }
135 #endif
127 } 136 }
128 137
129 void WebUILoginDisplayHost::LoadURL(const GURL& url) { 138 void WebUILoginDisplayHost::LoadURL(const GURL& url) {
130 if (!login_window_) { 139 if (!login_window_) {
131 views::Widget::InitParams params( 140 views::Widget::InitParams params(
132 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 141 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
133 params.bounds = background_bounds(); 142 params.bounds = background_bounds();
134 #if defined(USE_AURA) 143 #if defined(USE_AURA)
135 params.show_state = ui::SHOW_STATE_FULLSCREEN; 144 params.show_state = ui::SHOW_STATE_FULLSCREEN;
136 #endif 145 #endif
137 146
138 login_window_ = new views::Widget; 147 login_window_ = new views::Widget;
139 login_window_->Init(params); 148 login_window_->Init(params);
140 login_view_ = new WebUILoginView(); 149 login_view_ = new WebUILoginView();
141 150
142 login_view_->Init(login_window_); 151 login_view_->Init(login_window_);
143 152
144 #if defined(USE_AURA) 153 #if defined(USE_AURA)
145 ash::Shell::GetInstance()->GetContainer( 154 ash::Shell::GetInstance()->GetContainer(
146 ash::internal::kShellWindowId_LockScreenContainer)-> 155 ash::internal::kShellWindowId_LockScreenContainer)->
147 AddChild(login_window_->GetNativeView()); 156 AddChild(login_window_->GetNativeView());
157 ash::SetWindowVisibilityAnimationDuration(
158 login_window_->GetNativeView(),
159 base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
160 ash::SetWindowVisibilityAnimationTransition(
161 login_window_->GetNativeView(),
162 ash::ANIMATE_HIDE);
148 #endif 163 #endif
149 164
150 login_window_->SetContentsView(login_view_); 165 login_window_->SetContentsView(login_view_);
151 login_view_->UpdateWindowType(); 166 login_view_->UpdateWindowType();
152 167
153 login_window_->Show(); 168 login_window_->Show();
154 #if defined(USE_AURA) 169 #if defined(USE_AURA)
155 login_window_->GetNativeView()->SetName("WebUILoginView"); 170 login_window_->GetNativeView()->SetName("WebUILoginView");
156 #endif 171 #endif
157 login_view_->OnWindowCreated(); 172 login_view_->OnWindowCreated();
158 } 173 }
159 login_view_->LoadURL(url); 174 login_view_->LoadURL(url);
160 } 175 }
161 176
162 OobeUI* WebUILoginDisplayHost::GetOobeUI() const { 177 OobeUI* WebUILoginDisplayHost::GetOobeUI() const {
163 return static_cast<OobeUI*>(login_view_->GetWebUI()->GetController()); 178 return static_cast<OobeUI*>(login_view_->GetWebUI()->GetController());
164 } 179 }
165 180
166 WizardController* WebUILoginDisplayHost::CreateWizardController() { 181 WizardController* WebUILoginDisplayHost::CreateWizardController() {
167 // TODO(altimofeev): ensure that WebUI is ready. 182 // TODO(altimofeev): ensure that WebUI is ready.
168 OobeDisplay* oobe_display = GetOobeUI(); 183 OobeDisplay* oobe_display = GetOobeUI();
169 return new WizardController(this, oobe_display); 184 return new WizardController(this, oobe_display);
170 } 185 }
171 186
172 } // namespace chromeos 187 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/webui_login_display_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698