OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/user_adding_screen.h" | 5 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
6 | 6 |
7 #include "ash/common/system/tray/system_tray.h" | 7 #include "ash/common/system/tray/system_tray.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "chrome/browser/browser_process.h" | |
13 #include "chrome/browser/chromeos/login/helper.h" | 12 #include "chrome/browser/chromeos/login/helper.h" |
14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
15 #include "chrome/browser/chromeos/login/ui/user_adding_screen_input_methods_cont
roller.h" | 14 #include "chrome/browser/chromeos/login/ui/user_adding_screen_input_methods_cont
roller.h" |
16 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 15 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
17 #include "components/session_manager/core/session_manager.h" | 16 #include "components/session_manager/core/session_manager.h" |
18 #include "components/user_manager/user_manager.h" | 17 #include "components/user_manager/user_manager.h" |
19 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
20 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
21 | 20 |
22 namespace chromeos { | 21 namespace chromeos { |
(...skipping 25 matching lines...) Expand all Loading... |
48 }; | 47 }; |
49 | 48 |
50 void UserAddingScreenImpl::Start() { | 49 void UserAddingScreenImpl::Start() { |
51 CHECK(!IsRunning()); | 50 CHECK(!IsRunning()); |
52 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); | 51 gfx::Rect screen_bounds(chromeos::CalculateScreenBounds(gfx::Size())); |
53 display_host_ = new chromeos::LoginDisplayHostImpl(screen_bounds); | 52 display_host_ = new chromeos::LoginDisplayHostImpl(screen_bounds); |
54 display_host_->StartUserAdding( | 53 display_host_->StartUserAdding( |
55 base::Bind(&UserAddingScreenImpl::OnDisplayHostCompletion, | 54 base::Bind(&UserAddingScreenImpl::OnDisplayHostCompletion, |
56 base::Unretained(this))); | 55 base::Unretained(this))); |
57 | 56 |
58 g_browser_process->platform_part()->SessionManager()->SetSessionState( | 57 session_manager::SessionManager::Get()->SetSessionState( |
59 session_manager::SessionState::LOGIN_SECONDARY); | 58 session_manager::SessionState::LOGIN_SECONDARY); |
60 for (auto& observer : observers_) | 59 for (auto& observer : observers_) |
61 observer.OnUserAddingStarted(); | 60 observer.OnUserAddingStarted(); |
62 } | 61 } |
63 | 62 |
64 void UserAddingScreenImpl::Cancel() { | 63 void UserAddingScreenImpl::Cancel() { |
65 CHECK(IsRunning()); | 64 CHECK(IsRunning()); |
66 | 65 |
67 // Make sure that system tray is enabled after this flow. | 66 // Make sure that system tray is enabled after this flow. |
68 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(true); | 67 ash::Shell::GetInstance()->GetPrimarySystemTray()->SetEnabled(true); |
(...skipping 15 matching lines...) Expand all Loading... |
84 } | 83 } |
85 | 84 |
86 void UserAddingScreenImpl::RemoveObserver(Observer* observer) { | 85 void UserAddingScreenImpl::RemoveObserver(Observer* observer) { |
87 observers_.RemoveObserver(observer); | 86 observers_.RemoveObserver(observer); |
88 } | 87 } |
89 | 88 |
90 void UserAddingScreenImpl::OnDisplayHostCompletion() { | 89 void UserAddingScreenImpl::OnDisplayHostCompletion() { |
91 CHECK(IsRunning()); | 90 CHECK(IsRunning()); |
92 display_host_ = NULL; | 91 display_host_ = NULL; |
93 | 92 |
94 g_browser_process->platform_part()->SessionManager()->SetSessionState( | 93 session_manager::SessionManager::Get()->SetSessionState( |
95 session_manager::SessionState::ACTIVE); | 94 session_manager::SessionState::ACTIVE); |
96 for (auto& observer : observers_) | 95 for (auto& observer : observers_) |
97 observer.OnUserAddingFinished(); | 96 observer.OnUserAddingFinished(); |
98 } | 97 } |
99 | 98 |
100 // static | 99 // static |
101 UserAddingScreenImpl* UserAddingScreenImpl::GetInstance() { | 100 UserAddingScreenImpl* UserAddingScreenImpl::GetInstance() { |
102 return base::Singleton<UserAddingScreenImpl>::get(); | 101 return base::Singleton<UserAddingScreenImpl>::get(); |
103 } | 102 } |
104 | 103 |
105 UserAddingScreenImpl::UserAddingScreenImpl() | 104 UserAddingScreenImpl::UserAddingScreenImpl() |
106 : display_host_(NULL), im_controller_(this) { | 105 : display_host_(NULL), im_controller_(this) { |
107 } | 106 } |
108 | 107 |
109 UserAddingScreenImpl::~UserAddingScreenImpl() { | 108 UserAddingScreenImpl::~UserAddingScreenImpl() { |
110 } | 109 } |
111 | 110 |
112 } // anonymous namespace | 111 } // anonymous namespace |
113 | 112 |
114 UserAddingScreen::UserAddingScreen() {} | 113 UserAddingScreen::UserAddingScreen() {} |
115 UserAddingScreen::~UserAddingScreen() {} | 114 UserAddingScreen::~UserAddingScreen() {} |
116 | 115 |
117 UserAddingScreen* UserAddingScreen::Get() { | 116 UserAddingScreen* UserAddingScreen::Get() { |
118 return UserAddingScreenImpl::GetInstance(); | 117 return UserAddingScreenImpl::GetInstance(); |
119 } | 118 } |
120 | 119 |
121 } // namespace chromeos | 120 } // namespace chromeos |
OLD | NEW |