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

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

Issue 14827004: cros: Arrow key traversal in views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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
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/login_display_host_impl.h" 5 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
6 6
7 #include <vector>
8
7 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
8 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
9 #include "ash/desktop_background/user_wallpaper_delegate.h" 11 #include "ash/desktop_background/user_wallpaper_delegate.h"
10 #include "ash/shell.h" 12 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
12 #include "ash/wm/window_properties.h" 14 #include "ash/wm/window_properties.h"
13 #include "base/bind.h" 15 #include "base/bind.h"
14 #include "base/command_line.h" 16 #include "base/command_line.h"
15 #include "base/debug/trace_event.h" 17 #include "base/debug/trace_event.h"
16 #include "base/file_util.h" 18 #include "base/file_util.h"
(...skipping 18 matching lines...) Expand all
35 #include "chrome/browser/chromeos/login/login_wizard.h" 37 #include "chrome/browser/chromeos/login/login_wizard.h"
36 #include "chrome/browser/chromeos/login/oobe_display.h" 38 #include "chrome/browser/chromeos/login/oobe_display.h"
37 #include "chrome/browser/chromeos/login/startup_utils.h" 39 #include "chrome/browser/chromeos/login/startup_utils.h"
38 #include "chrome/browser/chromeos/login/user_manager.h" 40 #include "chrome/browser/chromeos/login/user_manager.h"
39 #include "chrome/browser/chromeos/login/webui_login_display.h" 41 #include "chrome/browser/chromeos/login/webui_login_display.h"
40 #include "chrome/browser/chromeos/login/webui_login_view.h" 42 #include "chrome/browser/chromeos/login/webui_login_view.h"
41 #include "chrome/browser/chromeos/login/wizard_controller.h" 43 #include "chrome/browser/chromeos/login/wizard_controller.h"
42 #include "chrome/browser/chromeos/mobile_config.h" 44 #include "chrome/browser/chromeos/mobile_config.h"
43 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" 45 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h"
44 #include "chrome/browser/chromeos/system/input_device_settings.h" 46 #include "chrome/browser/chromeos/system/input_device_settings.h"
47 #include "chrome/browser/chromeos/system/statistics_provider.h"
45 #include "chrome/browser/chromeos/system/timezone_settings.h" 48 #include "chrome/browser/chromeos/system/timezone_settings.h"
46 #include "chrome/browser/lifetime/application_lifetime.h" 49 #include "chrome/browser/lifetime/application_lifetime.h"
47 #include "chrome/browser/managed_mode/managed_mode.h" 50 #include "chrome/browser/managed_mode/managed_mode.h"
48 #include "chrome/browser/policy/browser_policy_connector.h" 51 #include "chrome/browser/policy/browser_policy_connector.h"
49 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 52 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
53 #include "chrome/common/chrome_constants.h"
50 #include "chrome/common/chrome_notification_types.h" 54 #include "chrome/common/chrome_notification_types.h"
51 #include "chrome/common/chrome_switches.h" 55 #include "chrome/common/chrome_switches.h"
52 #include "chrome/common/pref_names.h" 56 #include "chrome/common/pref_names.h"
53 #include "chromeos/dbus/dbus_thread_manager.h" 57 #include "chromeos/dbus/dbus_thread_manager.h"
54 #include "chromeos/dbus/session_manager_client.h" 58 #include "chromeos/dbus/session_manager_client.h"
55 #include "chromeos/ime/input_method_manager.h" 59 #include "chromeos/ime/input_method_manager.h"
56 #include "chromeos/login/login_state.h" 60 #include "chromeos/login/login_state.h"
57 #include "content/public/browser/notification_service.h" 61 #include "content/public/browser/notification_service.h"
58 #include "content/public/browser/notification_types.h" 62 #include "content/public/browser/notification_types.h"
59 #include "content/public/browser/web_contents.h" 63 #include "content/public/browser/web_contents.h"
60 #include "content/public/browser/web_contents_view.h" 64 #include "content/public/browser/web_contents_view.h"
61 #include "content/public/browser/web_ui.h" 65 #include "content/public/browser/web_ui.h"
62 #include "googleurl/src/gurl.h" 66 #include "googleurl/src/gurl.h"
63 #include "ui/aura/env.h" 67 #include "ui/aura/env.h"
64 #include "ui/aura/root_window.h" 68 #include "ui/aura/root_window.h"
65 #include "ui/aura/window.h" 69 #include "ui/aura/window.h"
66 #include "ui/base/events/event_utils.h" 70 #include "ui/base/events/event_utils.h"
67 #include "ui/base/resource/resource_bundle.h" 71 #include "ui/base/resource/resource_bundle.h"
68 #include "ui/compositor/layer.h" 72 #include "ui/compositor/layer.h"
69 #include "ui/compositor/layer_animation_element.h" 73 #include "ui/compositor/layer_animation_element.h"
70 #include "ui/compositor/layer_animation_sequence.h" 74 #include "ui/compositor/layer_animation_sequence.h"
71 #include "ui/compositor/layer_animator.h" 75 #include "ui/compositor/layer_animator.h"
72 #include "ui/compositor/scoped_layer_animation_settings.h" 76 #include "ui/compositor/scoped_layer_animation_settings.h"
73 #include "ui/gfx/rect.h" 77 #include "ui/gfx/rect.h"
74 #include "ui/gfx/transform.h" 78 #include "ui/gfx/transform.h"
79 #include "ui/views/focus/focus_manager.h"
75 #include "ui/views/widget/widget.h" 80 #include "ui/views/widget/widget.h"
76 81
77 namespace { 82 namespace {
78 83
79 // URL which corresponds to the login WebUI. 84 // URL which corresponds to the login WebUI.
80 const char kLoginURL[] = "chrome://oobe/login"; 85 const char kLoginURL[] = "chrome://oobe/login";
81 86
82 // URL which corresponds to the OOBE WebUI. 87 // URL which corresponds to the OOBE WebUI.
83 const char kOobeURL[] = "chrome://oobe"; 88 const char kOobeURL[] = "chrome://oobe";
84 89
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, 254 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE,
250 content::NotificationService::AllSources()); 255 content::NotificationService::AllSources());
251 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, 256 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN,
252 content::NotificationService::AllSources()); 257 content::NotificationService::AllSources());
253 } 258 }
254 LOG(INFO) << "Login WebUI >> " 259 LOG(INFO) << "Login WebUI >> "
255 << "zero_delay: " << zero_delay_enabled 260 << "zero_delay: " << zero_delay_enabled
256 << " wait_for_wp_load_: " << waiting_for_wallpaper_load_ 261 << " wait_for_wp_load_: " << waiting_for_wallpaper_load_
257 << " wait_for_pods_: " << waiting_for_user_pods_ 262 << " wait_for_pods_: " << waiting_for_user_pods_
258 << " init_webui_hidden_: " << initialize_webui_hidden_; 263 << " init_webui_hidden_: " << initialize_webui_hidden_;
264
265 bool keyboard_driven_oobe = false;
266 system::StatisticsProvider::GetInstance()->GetMachineFlag(
267 chrome::kOemKeyboardDrivenOobeKey, &keyboard_driven_oobe);
268 if (keyboard_driven_oobe)
269 views::FocusManager::set_arrow_key_traversal_enabled(true);
259 } 270 }
260 271
261 LoginDisplayHostImpl::~LoginDisplayHostImpl() { 272 LoginDisplayHostImpl::~LoginDisplayHostImpl() {
273 views::FocusManager::set_arrow_key_traversal_enabled(false);
262 ResetLoginWindowAndView(); 274 ResetLoginWindowAndView();
263 275
264 // Let chrome process exit after login/oobe screen if needed. 276 // Let chrome process exit after login/oobe screen if needed.
265 chrome::EndKeepAlive(); 277 chrome::EndKeepAlive();
266 278
267 default_host_ = NULL; 279 default_host_ = NULL;
268 } 280 }
269 281
270 //////////////////////////////////////////////////////////////////////////////// 282 ////////////////////////////////////////////////////////////////////////////////
271 // LoginDisplayHostImpl, LoginDisplayHost implementation: 283 // LoginDisplayHostImpl, LoginDisplayHost implementation:
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 } 491 }
480 492
481 //////////////////////////////////////////////////////////////////////////////// 493 ////////////////////////////////////////////////////////////////////////////////
482 // LoginDisplayHostImpl, content:NotificationObserver implementation: 494 // LoginDisplayHostImpl, content:NotificationObserver implementation:
483 495
484 void LoginDisplayHostImpl::Observe( 496 void LoginDisplayHostImpl::Observe(
485 int type, 497 int type,
486 const content::NotificationSource& source, 498 const content::NotificationSource& source,
487 const content::NotificationDetails& details) { 499 const content::NotificationDetails& details) {
488 if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) { 500 if (chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED == type) {
489 LOG(INFO) << "Login WebUI >> wp animation done"; 501 LOG(INFO) << "Login WebUI >> wp animation done";
490 is_wallpaper_loaded_ = true; 502 is_wallpaper_loaded_ = true;
491 ash::Shell::GetInstance()->user_wallpaper_delegate()-> 503 ash::Shell::GetInstance()->user_wallpaper_delegate()
492 OnWallpaperBootAnimationFinished(); 504 ->OnWallpaperBootAnimationFinished();
493 if (waiting_for_wallpaper_load_) { 505 if (waiting_for_wallpaper_load_) {
494 // StartWizard / StartSignInScreen could be called multiple times through 506 // StartWizard / StartSignInScreen could be called multiple times through
495 // the lifetime of host. 507 // the lifetime of host.
496 // Make sure that subsequent calls are not postponed. 508 // Make sure that subsequent calls are not postponed.
497 waiting_for_wallpaper_load_ = false; 509 waiting_for_wallpaper_load_ = false;
498 if (initialize_webui_hidden_) 510 if (initialize_webui_hidden_)
499 ShowWebUI(); 511 ShowWebUI();
500 else 512 else
501 StartPostponedWebUI(); 513 StartPostponedWebUI();
502 } 514 }
503 registrar_.Remove(this, 515 registrar_.Remove(this,
504 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, 516 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED,
505 content::NotificationService::AllSources()); 517 content::NotificationService::AllSources());
506 } else if (chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE == type || 518 } else if (chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE == type ||
507 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN == type) { 519 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN == type) {
508 LOG(INFO) << "Login WebUI >> WEBUI_VISIBLE"; 520 LOG(INFO) << "Login WebUI >> WEBUI_VISIBLE";
509 if (waiting_for_user_pods_ && initialize_webui_hidden_) { 521 if (waiting_for_user_pods_ && initialize_webui_hidden_) {
510 waiting_for_user_pods_ = false; 522 waiting_for_user_pods_ = false;
511 ShowWebUI(); 523 ShowWebUI();
512 } else if (waiting_for_wallpaper_load_ && initialize_webui_hidden_) { 524 } else if (waiting_for_wallpaper_load_ && initialize_webui_hidden_) {
513 // Reduce time till login UI is shown - show it as soon as possible. 525 // Reduce time till login UI is shown - show it as soon as possible.
514 waiting_for_wallpaper_load_ = false; 526 waiting_for_wallpaper_load_ = false;
515 ShowWebUI(); 527 ShowWebUI();
516 } 528 }
517 registrar_.Remove(this, 529 registrar_.Remove(this,
518 chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE, 530 chrome::NOTIFICATION_LOGIN_WEBUI_VISIBLE,
519 content::NotificationService::AllSources()); 531 content::NotificationService::AllSources());
520 registrar_.Remove(this, 532 registrar_.Remove(this,
521 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN, 533 chrome::NOTIFICATION_LOGIN_NETWORK_ERROR_SHOWN,
522 content::NotificationService::AllSources()); 534 content::NotificationService::AllSources());
523 } else if (type == chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST) { 535 } else if (type == chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST) {
524 ShutdownDisplayHost(true); 536 ShutdownDisplayHost(true);
525 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED && session_starting_) { 537 } else if (type == chrome::NOTIFICATION_BROWSER_OPENED && session_starting_) {
526 // Browsers created before session start (windows opened by extensions, for 538 // Browsers created before session start (windows opened by extensions, for
527 // example) are ignored. 539 // example) are ignored.
528 OnBrowserCreated(); 540 OnBrowserCreated();
529 registrar_.Remove(this, 541 registrar_.Remove(this,
530 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, 542 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
531 content::NotificationService::AllSources()); 543 content::NotificationService::AllSources());
532 registrar_.Remove(this, 544 registrar_.Remove(this,
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 VLOG(1) << "Initial time zone: " << timezone_name; 916 VLOG(1) << "Initial time zone: " << timezone_name;
905 // Apply locale customizations only once to preserve whatever locale 917 // Apply locale customizations only once to preserve whatever locale
906 // user has changed to during OOBE. 918 // user has changed to during OOBE.
907 if (!timezone_name.empty()) { 919 if (!timezone_name.empty()) {
908 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( 920 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID(
909 UTF8ToUTF16(timezone_name)); 921 UTF8ToUTF16(timezone_name));
910 } 922 }
911 } 923 }
912 924
913 } // namespace chromeos 925 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698