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 #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> | 7 #include <vector> |
8 | 8 |
9 #include "ash/desktop_background/desktop_background_controller.h" | 9 #include "ash/desktop_background/desktop_background_controller.h" |
10 #include "ash/desktop_background/user_wallpaper_delegate.h" | 10 #include "ash/desktop_background/user_wallpaper_delegate.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
13 #include "ash/wm/window_properties.h" | 13 #include "ash/wm/frame_painter.h" |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/debug/trace_event.h" | 16 #include "base/debug/trace_event.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
20 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
(...skipping 29 matching lines...) Expand all Loading... |
53 #include "chromeos/chromeos_switches.h" | 53 #include "chromeos/chromeos_switches.h" |
54 #include "chromeos/dbus/dbus_thread_manager.h" | 54 #include "chromeos/dbus/dbus_thread_manager.h" |
55 #include "chromeos/dbus/session_manager_client.h" | 55 #include "chromeos/dbus/session_manager_client.h" |
56 #include "chromeos/ime/input_method_manager.h" | 56 #include "chromeos/ime/input_method_manager.h" |
57 #include "chromeos/login/login_state.h" | 57 #include "chromeos/login/login_state.h" |
58 #include "content/public/browser/notification_service.h" | 58 #include "content/public/browser/notification_service.h" |
59 #include "content/public/browser/notification_types.h" | 59 #include "content/public/browser/notification_types.h" |
60 #include "content/public/browser/web_contents.h" | 60 #include "content/public/browser/web_contents.h" |
61 #include "content/public/browser/web_contents_view.h" | 61 #include "content/public/browser/web_contents_view.h" |
62 #include "content/public/browser/web_ui.h" | 62 #include "content/public/browser/web_ui.h" |
63 #include "ui/aura/root_window.h" | |
64 #include "ui/aura/window.h" | 63 #include "ui/aura/window.h" |
65 #include "ui/base/events/event_utils.h" | 64 #include "ui/base/events/event_utils.h" |
66 #include "ui/base/resource/resource_bundle.h" | 65 #include "ui/base/resource/resource_bundle.h" |
67 #include "ui/compositor/layer.h" | 66 #include "ui/compositor/layer.h" |
68 #include "ui/compositor/layer_animation_element.h" | 67 #include "ui/compositor/layer_animation_element.h" |
69 #include "ui/compositor/layer_animation_sequence.h" | 68 #include "ui/compositor/layer_animation_sequence.h" |
70 #include "ui/compositor/layer_animator.h" | 69 #include "ui/compositor/layer_animator.h" |
71 #include "ui/compositor/scoped_layer_animation_settings.h" | 70 #include "ui/compositor/scoped_layer_animation_settings.h" |
72 #include "ui/gfx/rect.h" | 71 #include "ui/gfx/rect.h" |
73 #include "ui/gfx/transform.h" | 72 #include "ui/gfx/transform.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 shutting_down_(false), | 166 shutting_down_(false), |
168 oobe_progress_bar_visible_(false), | 167 oobe_progress_bar_visible_(false), |
169 session_starting_(false), | 168 session_starting_(false), |
170 login_window_(NULL), | 169 login_window_(NULL), |
171 login_view_(NULL), | 170 login_view_(NULL), |
172 webui_login_display_(NULL), | 171 webui_login_display_(NULL), |
173 is_showing_login_(false), | 172 is_showing_login_(false), |
174 is_wallpaper_loaded_(false), | 173 is_wallpaper_loaded_(false), |
175 status_area_saved_visibility_(false), | 174 status_area_saved_visibility_(false), |
176 crash_count_(0), | 175 crash_count_(0), |
177 restore_path_(RESTORE_UNKNOWN), | 176 restore_path_(RESTORE_UNKNOWN) { |
178 old_ignore_solo_window_frame_painter_policy_value_(false) { | |
179 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING | 177 // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING |
180 // because/ APP_TERMINATING will never be fired as long as this keeps | 178 // because/ APP_TERMINATING will never be fired as long as this keeps |
181 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no | 179 // ref-count. CLOSE_ALL_BROWSERS_REQUEST is safe here because there will be no |
182 // browser instance that will block the shutdown. | 180 // browser instance that will block the shutdown. |
183 registrar_.Add(this, | 181 registrar_.Add(this, |
184 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, | 182 chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST, |
185 content::NotificationService::AllSources()); | 183 content::NotificationService::AllSources()); |
186 | 184 |
187 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but | 185 // NOTIFICATION_BROWSER_OPENED is issued after browser is created, but |
188 // not shown yet. Lock window has to be closed at this point so that | 186 // not shown yet. Lock window has to be closed at this point so that |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 break; | 762 break; |
765 default: | 763 default: |
766 NOTREACHED(); | 764 NOTREACHED(); |
767 break; | 765 break; |
768 } | 766 } |
769 } | 767 } |
770 | 768 |
771 void LoginDisplayHostImpl::InitLoginWindowAndView() { | 769 void LoginDisplayHostImpl::InitLoginWindowAndView() { |
772 if (login_window_) | 770 if (login_window_) |
773 return; | 771 return; |
| 772 ash::FramePainter::SetSoloWindowHeadersEnabled(false); |
774 | 773 |
775 views::Widget::InitParams params( | 774 views::Widget::InitParams params( |
776 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 775 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
777 params.bounds = background_bounds(); | 776 params.bounds = background_bounds(); |
778 params.show_state = ui::SHOW_STATE_FULLSCREEN; | 777 params.show_state = ui::SHOW_STATE_FULLSCREEN; |
779 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 778 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
780 params.parent = | 779 params.parent = |
781 ash::Shell::GetContainer( | 780 ash::Shell::GetContainer( |
782 ash::Shell::GetPrimaryRootWindow(), | 781 ash::Shell::GetPrimaryRootWindow(), |
783 ash::internal::kShellWindowId_LockScreenContainer); | 782 ash::internal::kShellWindowId_LockScreenContainer); |
784 | 783 |
785 login_window_ = new views::Widget; | 784 login_window_ = new views::Widget; |
786 login_window_->Init(params); | 785 login_window_->Init(params); |
787 if (login_window_->GetNativeWindow()) { | |
788 aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow(); | |
789 if (root) { | |
790 old_ignore_solo_window_frame_painter_policy_value_ = | |
791 root->GetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy); | |
792 root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy, | |
793 true); | |
794 } | |
795 } | |
796 login_view_ = new WebUILoginView(); | 786 login_view_ = new WebUILoginView(); |
797 | |
798 login_view_->Init(); | 787 login_view_->Init(); |
799 | 788 |
800 views::corewm::SetWindowVisibilityAnimationDuration( | 789 views::corewm::SetWindowVisibilityAnimationDuration( |
801 login_window_->GetNativeView(), | 790 login_window_->GetNativeView(), |
802 base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs)); | 791 base::TimeDelta::FromMilliseconds(kLoginFadeoutTransitionDurationMs)); |
803 views::corewm::SetWindowVisibilityAnimationTransition( | 792 views::corewm::SetWindowVisibilityAnimationTransition( |
804 login_window_->GetNativeView(), | 793 login_window_->GetNativeView(), |
805 views::corewm::ANIMATE_HIDE); | 794 views::corewm::ANIMATE_HIDE); |
806 | 795 |
807 login_window_->SetContentsView(login_view_); | 796 login_window_->SetContentsView(login_view_); |
808 | 797 |
809 // If WebUI is initialized in hidden state, show it only if we're no | 798 // If WebUI is initialized in hidden state, show it only if we're no |
810 // longer waiting for wallpaper animation/user images loading. Otherwise, | 799 // longer waiting for wallpaper animation/user images loading. Otherwise, |
811 // always show it. | 800 // always show it. |
812 if (!initialize_webui_hidden_ || | 801 if (!initialize_webui_hidden_ || |
813 (!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) { | 802 (!waiting_for_wallpaper_load_ && !waiting_for_user_pods_)) { |
814 LOG(WARNING) << "Login WebUI >> show login wnd on create"; | 803 LOG(WARNING) << "Login WebUI >> show login wnd on create"; |
815 login_window_->Show(); | 804 login_window_->Show(); |
816 } else { | 805 } else { |
817 LOG(WARNING) << "Login WebUI >> login wnd is hidden on create"; | 806 LOG(WARNING) << "Login WebUI >> login wnd is hidden on create"; |
818 login_view_->set_is_hidden(true); | 807 login_view_->set_is_hidden(true); |
819 } | 808 } |
820 login_window_->GetNativeView()->SetName("WebUILoginView"); | 809 login_window_->GetNativeView()->SetName("WebUILoginView"); |
821 } | 810 } |
822 | 811 |
823 void LoginDisplayHostImpl::ResetLoginWindowAndView() { | 812 void LoginDisplayHostImpl::ResetLoginWindowAndView() { |
824 if (!login_window_) | 813 if (!login_window_) |
825 return; | 814 return; |
826 | 815 ash::FramePainter::SetSoloWindowHeadersEnabled(true); |
827 if (login_window_->GetNativeWindow()) { | |
828 aura::RootWindow* root = login_window_->GetNativeWindow()->GetRootWindow(); | |
829 if (root) { | |
830 root->SetProperty(ash::internal::kIgnoreSoloWindowFramePainterPolicy, | |
831 old_ignore_solo_window_frame_painter_policy_value_); | |
832 } | |
833 } | |
834 login_window_->Close(); | 816 login_window_->Close(); |
835 login_window_ = NULL; | 817 login_window_ = NULL; |
836 login_view_ = NULL; | 818 login_view_ = NULL; |
837 } | 819 } |
838 | 820 |
839 bool LoginDisplayHostImpl::IsRunningUserAdding() { | 821 bool LoginDisplayHostImpl::IsRunningUserAdding() { |
840 return restore_path_ == RESTORE_ADD_USER_INTO_SESSION; | 822 return restore_path_ == RESTORE_ADD_USER_INTO_SESSION; |
841 } | 823 } |
842 | 824 |
843 void LoginDisplayHostImpl::OnAuthPrewarmDone() { | 825 void LoginDisplayHostImpl::OnAuthPrewarmDone() { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 VLOG(1) << "Initial time zone: " << timezone_name; | 966 VLOG(1) << "Initial time zone: " << timezone_name; |
985 // Apply locale customizations only once to preserve whatever locale | 967 // Apply locale customizations only once to preserve whatever locale |
986 // user has changed to during OOBE. | 968 // user has changed to during OOBE. |
987 if (!timezone_name.empty()) { | 969 if (!timezone_name.empty()) { |
988 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 970 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
989 UTF8ToUTF16(timezone_name)); | 971 UTF8ToUTF16(timezone_name)); |
990 } | 972 } |
991 } | 973 } |
992 | 974 |
993 } // namespace chromeos | 975 } // namespace chromeos |
OLD | NEW |