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 "ash/shell/shell_delegate_impl.h" | 5 #include "ash/shell/shell_delegate_impl.h" |
6 | 6 |
7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/default_accessibility_delegate.h" | 8 #include "ash/default_accessibility_delegate.h" |
9 #include "ash/default_user_wallpaper_delegate.h" | 9 #include "ash/default_user_wallpaper_delegate.h" |
10 #include "ash/gpu_support_stub.h" | 10 #include "ash/gpu_support_stub.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
27 #include "ui/wm/core/input_method_event_filter.h" | 27 #include "ui/wm/core/input_method_event_filter.h" |
28 | 28 |
29 namespace ash { | 29 namespace ash { |
30 namespace shell { | 30 namespace shell { |
31 namespace { | 31 namespace { |
32 | 32 |
33 class NewWindowDelegateImpl : public NewWindowDelegate { | 33 class NewWindowDelegateImpl : public NewWindowDelegate { |
34 public: | 34 public: |
35 NewWindowDelegateImpl() {} | 35 NewWindowDelegateImpl() {} |
36 virtual ~NewWindowDelegateImpl() {} | 36 ~NewWindowDelegateImpl() override {} |
37 | 37 |
38 // NewWindowDelegate: | 38 // NewWindowDelegate: |
39 virtual void NewTab() override {} | 39 void NewTab() override {} |
40 virtual void NewWindow(bool incognito) override { | 40 void NewWindow(bool incognito) override { |
41 ash::shell::ToplevelWindow::CreateParams create_params; | 41 ash::shell::ToplevelWindow::CreateParams create_params; |
42 create_params.can_resize = true; | 42 create_params.can_resize = true; |
43 create_params.can_maximize = true; | 43 create_params.can_maximize = true; |
44 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); | 44 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); |
45 } | 45 } |
46 virtual void OpenFileManager() override {} | 46 void OpenFileManager() override {} |
47 virtual void OpenCrosh() override {} | 47 void OpenCrosh() override {} |
48 virtual void RestoreTab() override {} | 48 void RestoreTab() override {} |
49 virtual void ShowKeyboardOverlay() override {} | 49 void ShowKeyboardOverlay() override {} |
50 virtual void ShowTaskManager() override {} | 50 void ShowTaskManager() override {} |
51 virtual void OpenFeedbackPage() override {} | 51 void OpenFeedbackPage() override {} |
52 | 52 |
53 private: | 53 private: |
54 DISALLOW_COPY_AND_ASSIGN(NewWindowDelegateImpl); | 54 DISALLOW_COPY_AND_ASSIGN(NewWindowDelegateImpl); |
55 }; | 55 }; |
56 | 56 |
57 class MediaDelegateImpl : public MediaDelegate { | 57 class MediaDelegateImpl : public MediaDelegate { |
58 public: | 58 public: |
59 MediaDelegateImpl() {} | 59 MediaDelegateImpl() {} |
60 virtual ~MediaDelegateImpl() {} | 60 ~MediaDelegateImpl() override {} |
61 | 61 |
62 // MediaDelegate: | 62 // MediaDelegate: |
63 virtual void HandleMediaNextTrack() override {} | 63 void HandleMediaNextTrack() override {} |
64 virtual void HandleMediaPlayPause() override {} | 64 void HandleMediaPlayPause() override {} |
65 virtual void HandleMediaPrevTrack() override {} | 65 void HandleMediaPrevTrack() override {} |
66 virtual MediaCaptureState GetMediaCaptureState( | 66 MediaCaptureState GetMediaCaptureState( |
67 content::BrowserContext* context) override { | 67 content::BrowserContext* context) override { |
68 return MEDIA_CAPTURE_VIDEO; | 68 return MEDIA_CAPTURE_VIDEO; |
69 } | 69 } |
70 | 70 |
71 private: | 71 private: |
72 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); | 72 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); |
73 }; | 73 }; |
74 | 74 |
75 class SessionStateDelegateImpl : public SessionStateDelegate { | 75 class SessionStateDelegateImpl : public SessionStateDelegate { |
76 public: | 76 public: |
77 SessionStateDelegateImpl() | 77 SessionStateDelegateImpl() |
78 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} | 78 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} |
79 | 79 |
80 virtual ~SessionStateDelegateImpl() {} | 80 ~SessionStateDelegateImpl() override {} |
81 | 81 |
82 // SessionStateDelegate: | 82 // SessionStateDelegate: |
83 virtual content::BrowserContext* GetBrowserContextByIndex( | 83 content::BrowserContext* GetBrowserContextByIndex( |
84 MultiProfileIndex index) override { | 84 MultiProfileIndex index) override { |
85 return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); | 85 return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); |
86 } | 86 } |
87 virtual content::BrowserContext* GetBrowserContextForWindow( | 87 content::BrowserContext* GetBrowserContextForWindow( |
88 aura::Window* window) override { | 88 aura::Window* window) override { |
89 return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); | 89 return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); |
90 } | 90 } |
91 virtual int GetMaximumNumberOfLoggedInUsers() const override { return 3; } | 91 int GetMaximumNumberOfLoggedInUsers() const override { return 3; } |
92 virtual int NumberOfLoggedInUsers() const override { | 92 int NumberOfLoggedInUsers() const override { |
93 // ash_shell has 2 users. | 93 // ash_shell has 2 users. |
94 return 2; | 94 return 2; |
95 } | 95 } |
96 virtual bool IsActiveUserSessionStarted() const override { return true; } | 96 bool IsActiveUserSessionStarted() const override { return true; } |
97 virtual bool CanLockScreen() const override { return true; } | 97 bool CanLockScreen() const override { return true; } |
98 virtual bool IsScreenLocked() const override { return screen_locked_; } | 98 bool IsScreenLocked() const override { return screen_locked_; } |
99 virtual bool ShouldLockScreenBeforeSuspending() const override { | 99 bool ShouldLockScreenBeforeSuspending() const override { return false; } |
100 return false; | 100 void LockScreen() override { |
101 } | |
102 virtual void LockScreen() override { | |
103 shell::CreateLockScreen(); | 101 shell::CreateLockScreen(); |
104 screen_locked_ = true; | 102 screen_locked_ = true; |
105 Shell::GetInstance()->UpdateShelfVisibility(); | 103 Shell::GetInstance()->UpdateShelfVisibility(); |
106 } | 104 } |
107 virtual void UnlockScreen() override { | 105 void UnlockScreen() override { |
108 screen_locked_ = false; | 106 screen_locked_ = false; |
109 Shell::GetInstance()->UpdateShelfVisibility(); | 107 Shell::GetInstance()->UpdateShelfVisibility(); |
110 } | 108 } |
111 virtual bool IsUserSessionBlocked() const override { | 109 bool IsUserSessionBlocked() const override { |
112 return !IsActiveUserSessionStarted() || IsScreenLocked(); | 110 return !IsActiveUserSessionStarted() || IsScreenLocked(); |
113 } | 111 } |
114 virtual SessionState GetSessionState() const override { | 112 SessionState GetSessionState() const override { |
115 // Assume that if session is not active we're at login. | 113 // Assume that if session is not active we're at login. |
116 return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE | 114 return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE |
117 : SESSION_STATE_LOGIN_PRIMARY; | 115 : SESSION_STATE_LOGIN_PRIMARY; |
118 } | 116 } |
119 virtual const user_manager::UserInfo* GetUserInfo( | 117 const user_manager::UserInfo* GetUserInfo( |
120 MultiProfileIndex index) const override { | 118 MultiProfileIndex index) const override { |
121 return user_info_.get(); | 119 return user_info_.get(); |
122 } | 120 } |
123 virtual const user_manager::UserInfo* GetUserInfo( | 121 const user_manager::UserInfo* GetUserInfo( |
124 content::BrowserContext* context) const override { | 122 content::BrowserContext* context) const override { |
125 return user_info_.get(); | 123 return user_info_.get(); |
126 } | 124 } |
127 virtual bool ShouldShowAvatar(aura::Window* window) const override { | 125 bool ShouldShowAvatar(aura::Window* window) const override { |
128 return !user_info_->GetImage().isNull(); | 126 return !user_info_->GetImage().isNull(); |
129 } | 127 } |
130 virtual void SwitchActiveUser(const std::string& user_id) override {} | 128 void SwitchActiveUser(const std::string& user_id) override {} |
131 virtual void CycleActiveUser(CycleUser cycle_user) override {} | 129 void CycleActiveUser(CycleUser cycle_user) override {} |
132 virtual bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { | 130 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { |
133 return true; | 131 return true; |
134 } | 132 } |
135 virtual void AddSessionStateObserver( | 133 void AddSessionStateObserver(ash::SessionStateObserver* observer) override {} |
136 ash::SessionStateObserver* observer) override {} | 134 void RemoveSessionStateObserver( |
137 virtual void RemoveSessionStateObserver( | |
138 ash::SessionStateObserver* observer) override {} | 135 ash::SessionStateObserver* observer) override {} |
139 | 136 |
140 private: | 137 private: |
141 bool screen_locked_; | 138 bool screen_locked_; |
142 | 139 |
143 // A pseudo user info. | 140 // A pseudo user info. |
144 scoped_ptr<user_manager::UserInfo> user_info_; | 141 scoped_ptr<user_manager::UserInfo> user_info_; |
145 | 142 |
146 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); | 143 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); |
147 }; | 144 }; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Real GPU support depends on src/content, so just use a stub. | 256 // Real GPU support depends on src/content, so just use a stub. |
260 return new GPUSupportStub; | 257 return new GPUSupportStub; |
261 } | 258 } |
262 | 259 |
263 base::string16 ShellDelegateImpl::GetProductName() const { | 260 base::string16 ShellDelegateImpl::GetProductName() const { |
264 return base::string16(); | 261 return base::string16(); |
265 } | 262 } |
266 | 263 |
267 } // namespace shell | 264 } // namespace shell |
268 } // namespace ash | 265 } // namespace ash |
OLD | NEW |