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

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

Issue 11673006: Disabled transparency for header bars on the signin screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style fix. Created 7 years, 12 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 "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/desktop_background/user_wallpaper_delegate.h" 8 #include "ash/desktop_background/user_wallpaper_delegate.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ash/wm/window_animations.h" 11 #include "ash/wm/window_animations.h"
12 #include "ash/wm/window_properties.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/logging.h" 14 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
15 #include "base/time.h" 16 #include "base/time.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/browser/browser_shutdown.h" 18 #include "chrome/browser/browser_shutdown.h"
18 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" 19 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h"
19 #include "chrome/browser/chromeos/login/oobe_display.h" 20 #include "chrome/browser/chromeos/login/oobe_display.h"
20 #include "chrome/browser/chromeos/login/webui_login_display.h" 21 #include "chrome/browser/chromeos/login/webui_login_display.h"
21 #include "chrome/browser/chromeos/login/webui_login_view.h" 22 #include "chrome/browser/chromeos/login/webui_login_view.h"
22 #include "chrome/browser/chromeos/login/wizard_controller.h" 23 #include "chrome/browser/chromeos/login/wizard_controller.h"
23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 24 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
24 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
25 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
26 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
27 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
28 #include "content/public/browser/web_ui.h" 29 #include "content/public/browser/web_ui.h"
29 #include "ui/aura/env.h" 30 #include "ui/aura/env.h"
31 #include "ui/aura/root_window.h"
30 #include "ui/aura/window.h" 32 #include "ui/aura/window.h"
31 #include "ui/views/widget/widget.h" 33 #include "ui/views/widget/widget.h"
32 34
33 namespace chromeos { 35 namespace chromeos {
34 36
35 namespace { 37 namespace {
36 38
37 // URL which corresponds to the login WebUI. 39 // URL which corresponds to the login WebUI.
38 const char kLoginURL[] = "chrome://oobe/login"; 40 const char kLoginURL[] = "chrome://oobe/login";
39 // URL which corresponds to the OOBE WebUI. 41 // URL which corresponds to the OOBE WebUI.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 content::NotificationService::AllSources()); 131 content::NotificationService::AllSources());
130 } 132 }
131 LOG(INFO) << "Login WebUI >> " 133 LOG(INFO) << "Login WebUI >> "
132 << "zero_delay: " << zero_delay_enabled 134 << "zero_delay: " << zero_delay_enabled
133 << " wait_for_wp_load_: " << waiting_for_wallpaper_load_ 135 << " wait_for_wp_load_: " << waiting_for_wallpaper_load_
134 << " wait_for_pods_: " << waiting_for_user_pods_ 136 << " wait_for_pods_: " << waiting_for_user_pods_
135 << " init_webui_hidden_: " << initialize_webui_hidden_; 137 << " init_webui_hidden_: " << initialize_webui_hidden_;
136 } 138 }
137 139
138 WebUILoginDisplayHost::~WebUILoginDisplayHost() { 140 WebUILoginDisplayHost::~WebUILoginDisplayHost() {
139 if (login_window_) 141 ResetLoginWindowAndView();
140 login_window_->Close();
141 } 142 }
142 143
143 // LoginDisplayHost implementation --------------------------------------------- 144 // LoginDisplayHost implementation ---------------------------------------------
144 145
145 LoginDisplay* WebUILoginDisplayHost::CreateLoginDisplay( 146 LoginDisplay* WebUILoginDisplayHost::CreateLoginDisplay(
146 LoginDisplay::Delegate* delegate) { 147 LoginDisplay::Delegate* delegate) {
147 webui_login_display_ = new WebUILoginDisplay(delegate); 148 webui_login_display_ = new WebUILoginDisplay(delegate);
148 webui_login_display_->set_background_bounds(background_bounds()); 149 webui_login_display_->set_background_bounds(background_bounds());
149 return webui_login_display_; 150 return webui_login_display_;
150 } 151 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 SetStatusAreaVisible(false); 222 SetStatusAreaVisible(false);
222 } 223 }
223 224
224 void WebUILoginDisplayHost::OnPreferencesChanged() { 225 void WebUILoginDisplayHost::OnPreferencesChanged() {
225 if (is_showing_login_) 226 if (is_showing_login_)
226 webui_login_display_->OnPreferencesChanged(); 227 webui_login_display_->OnPreferencesChanged();
227 } 228 }
228 229
229 void WebUILoginDisplayHost::OnBrowserCreated() { 230 void WebUILoginDisplayHost::OnBrowserCreated() {
230 // Close lock window now so that the launched browser can receive focus. 231 // Close lock window now so that the launched browser can receive focus.
231 if (login_window_) { 232 ResetLoginWindowAndView();
232 login_window_->Close();
233 login_window_ = NULL;
234 login_view_ = NULL;
235 }
236 } 233 }
237 234
238 void WebUILoginDisplayHost::Observe( 235 void WebUILoginDisplayHost::Observe(
239 int type, 236 int type,
240 const content::NotificationSource& source, 237 const content::NotificationSource& source,
241 const content::NotificationDetails& details) { 238 const content::NotificationDetails& details) {
242 if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { 239 if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) {
243 LOG(INFO) << "Login WebUI >> wp animation done"; 240 LOG(INFO) << "Login WebUI >> wp animation done";
244 is_wallpaper_loaded_ = true; 241 is_wallpaper_loaded_ = true;
245 ash::Shell::GetInstance()->user_wallpaper_delegate()-> 242 ash::Shell::GetInstance()->user_wallpaper_delegate()->
(...skipping 23 matching lines...) Expand all
269 } 266 }
270 registrar_.Remove(this, 267 registrar_.Remove(this,
271 chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, 268 chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE,
272 content::NotificationService::AllSources()); 269 content::NotificationService::AllSources());
273 } else { 270 } else {
274 BaseLoginDisplayHost::Observe(type, source, details); 271 BaseLoginDisplayHost::Observe(type, source, details);
275 } 272 }
276 } 273 }
277 274
278 void WebUILoginDisplayHost::LoadURL(const GURL& url) { 275 void WebUILoginDisplayHost::LoadURL(const GURL& url) {
279 if (!login_window_) { 276 InitLoginWindowAndView();
280 views::Widget::InitParams params(
281 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
282 params.bounds = background_bounds();
283 params.show_state = ui::SHOW_STATE_FULLSCREEN;
284 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe))
285 params.transparent = true;
286 params.parent =
287 ash::Shell::GetContainer(
288 ash::Shell::GetPrimaryRootWindow(),
289 ash::internal::kShellWindowId_LockScreenContainer);
290
291 login_window_ = new views::Widget;
292 login_window_->Init(params);
293 login_view_ = new WebUILoginView();
294
295 login_view_->Init(login_window_);
296
297 views::corewm::SetWindowVisibilityAnimationDuration(
298 login_window_->GetNativeView(),
299 base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
300 views::corewm::SetWindowVisibilityAnimationTransition(
301 login_window_->GetNativeView(),
302 views::corewm::ANIMATE_HIDE);
303
304 login_window_->SetContentsView(login_view_);
305 login_view_->UpdateWindowType();
306
307 // If WebUI is initialized in hidden state, show it only if we're no
308 // longer waiting for wallpaper animation/user images loading. Otherwise,
309 // always show it.
310 if (!initialize_webui_hidden_ ||
311 (!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) {
312 LOG(INFO) << "Login WebUI >> show login wnd on create";
313 login_window_->Show();
314 } else {
315 LOG(INFO) << "Login WebUI >> login wnd is hidden on create";
316 login_view_->set_is_hidden(true);
317 }
318 login_window_->GetNativeView()->SetName("WebUILoginView");
319 login_view_->OnWindowCreated();
320 }
321 // Subscribe to crash events. 277 // Subscribe to crash events.
322 content::WebContentsObserver::Observe(login_view_->GetWebContents()); 278 content::WebContentsObserver::Observe(login_view_->GetWebContents());
323 login_view_->LoadURL(url); 279 login_view_->LoadURL(url);
324 } 280 }
325 281
326 void WebUILoginDisplayHost::RenderViewGone(base::TerminationStatus status) { 282 void WebUILoginDisplayHost::RenderViewGone(base::TerminationStatus status) {
327 // Do not try to restore on shutdown 283 // Do not try to restore on shutdown
328 if (browser_shutdown::GetShutdownType() != browser_shutdown::NOT_VALID) 284 if (browser_shutdown::GetShutdownType() != browser_shutdown::NOT_VALID)
329 return; 285 return;
330 286
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 break; 352 break;
397 case RESTORE_SIGN_IN: 353 case RESTORE_SIGN_IN:
398 StartSignInScreen(); 354 StartSignInScreen();
399 break; 355 break;
400 default: 356 default:
401 NOTREACHED(); 357 NOTREACHED();
402 break; 358 break;
403 } 359 }
404 } 360 }
405 361
362 void WebUILoginDisplayHost::InitLoginWindowAndView() {
363 if (login_window_)
364 return;
365
366 views::Widget::InitParams params(
367 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
368 params.bounds = background_bounds();
369 params.show_state = ui::SHOW_STATE_FULLSCREEN;
370 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe))
371 params.transparent = true;
372 params.parent =
373 ash::Shell::GetContainer(
374 ash::Shell::GetPrimaryRootWindow(),
375 ash::internal::kShellWindowId_LockScreenContainer);
376
377 login_window_ = new views::Widget;
378 login_window_->Init(params);
379 if (login_window_->GetNativeWindow()) {
380 aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow();
381 if (root)
382 root->SetProperty(ash::internal::kIgnoreSoloWindowPolicy, true);
Nikita (slow) 2012/12/27 15:22:19 nit: Save previous value and then restore it?
ygorshenin1 2012/12/27 15:37:35 Done.
383 }
384 login_view_ = new WebUILoginView();
385
386 login_view_->Init(login_window_);
387
388 views::corewm::SetWindowVisibilityAnimationDuration(
389 login_window_->GetNativeView(),
390 base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs));
391 views::corewm::SetWindowVisibilityAnimationTransition(
392 login_window_->GetNativeView(),
393 views::corewm::ANIMATE_HIDE);
394
395 login_window_->SetContentsView(login_view_);
396 login_view_->UpdateWindowType();
397
398 // If WebUI is initialized in hidden state, show it only if we're no
399 // longer waiting for wallpaper animation/user images loading. Otherwise,
400 // always show it.
401 if (!initialize_webui_hidden_ ||
402 (!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) {
403 LOG(INFO) << "Login WebUI >> show login wnd on create";
404 login_window_->Show();
405 } else {
406 LOG(INFO) << "Login WebUI >> login wnd is hidden on create";
407 login_view_->set_is_hidden(true);
408 }
409 login_window_->GetNativeView()->SetName("WebUILoginView");
410 login_view_->OnWindowCreated();
411 }
412
413 void WebUILoginDisplayHost::ResetLoginWindowAndView() {
414 if (!login_window_)
415 return;
416
417 if (login_window_->GetNativeWindow()) {
418 aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow();
419 if (root)
420 root->SetProperty(ash::internal::kIgnoreSoloWindowPolicy, false);
421 }
422 login_window_->Close();
423 login_window_ = NULL;
424 login_view_ = NULL;
425 }
426
406 } // namespace chromeos 427 } // 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