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

Side by Side Diff: ash/shell/shell_delegate_impl.cc

Issue 379803004: Move UserInfo to user_manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 "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"
11 #include "ash/media_delegate.h" 11 #include "ash/media_delegate.h"
12 #include "ash/new_window_delegate.h" 12 #include "ash/new_window_delegate.h"
13 #include "ash/session/session_state_delegate.h" 13 #include "ash/session/session_state_delegate.h"
14 #include "ash/session/user_info.h"
15 #include "ash/shell/context_menu.h" 14 #include "ash/shell/context_menu.h"
16 #include "ash/shell/example_factory.h" 15 #include "ash/shell/example_factory.h"
17 #include "ash/shell/keyboard_controller_proxy_stub.h" 16 #include "ash/shell/keyboard_controller_proxy_stub.h"
18 #include "ash/shell/shelf_delegate_impl.h" 17 #include "ash/shell/shelf_delegate_impl.h"
19 #include "ash/shell/toplevel_window.h" 18 #include "ash/shell/toplevel_window.h"
20 #include "ash/shell_window_ids.h" 19 #include "ash/shell_window_ids.h"
21 #include "ash/system/tray/default_system_tray_delegate.h" 20 #include "ash/system/tray/default_system_tray_delegate.h"
22 #include "ash/wm/window_state.h" 21 #include "ash/wm/window_state.h"
23 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
24 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
24 #include "components/user_manager/user_info.h"
25 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
26 #include "ui/wm/core/input_method_event_filter.h" 26 #include "ui/wm/core/input_method_event_filter.h"
27 27
28 namespace ash { 28 namespace ash {
29 namespace shell { 29 namespace shell {
30 namespace { 30 namespace {
31 31
32 class NewWindowDelegateImpl : public NewWindowDelegate { 32 class NewWindowDelegateImpl : public NewWindowDelegate {
33 public: 33 public:
34 NewWindowDelegateImpl() {} 34 NewWindowDelegateImpl() {}
(...skipping 29 matching lines...) Expand all
64 virtual void HandleMediaPrevTrack() OVERRIDE {} 64 virtual void HandleMediaPrevTrack() OVERRIDE {}
65 virtual MediaCaptureState GetMediaCaptureState( 65 virtual MediaCaptureState GetMediaCaptureState(
66 content::BrowserContext* context) OVERRIDE { 66 content::BrowserContext* context) OVERRIDE {
67 return MEDIA_CAPTURE_VIDEO; 67 return MEDIA_CAPTURE_VIDEO;
68 } 68 }
69 69
70 private: 70 private:
71 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); 71 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
72 }; 72 };
73 73
74 class UserInfoImpl : public UserInfo { 74 class UserInfoImpl : public user_manager::UserInfo {
75 public: 75 public:
76 UserInfoImpl() {} 76 UserInfoImpl() {}
77 virtual ~UserInfoImpl() {} 77 virtual ~UserInfoImpl() {}
78 78
79 // UserInfo: 79 // user_manager::UserInfo:
80 virtual base::string16 GetDisplayName() const OVERRIDE { 80 virtual base::string16 GetDisplayName() const OVERRIDE {
81 return base::UTF8ToUTF16("stub-user"); 81 return base::UTF8ToUTF16("stub-user");
82 } 82 }
83 virtual base::string16 GetGivenName() const OVERRIDE { 83 virtual base::string16 GetGivenName() const OVERRIDE {
84 return base::UTF8ToUTF16("Stub"); 84 return base::UTF8ToUTF16("Stub");
85 } 85 }
86 virtual std::string GetEmail() const OVERRIDE { 86 virtual std::string GetEmail() const OVERRIDE {
87 return "stub-user@domain.com"; 87 return "stub-user@domain.com";
88 } 88 }
89 virtual std::string GetUserID() const OVERRIDE { return GetEmail(); } 89 virtual std::string GetUserID() const OVERRIDE { return GetEmail(); }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 Shell::GetInstance()->UpdateShelfVisibility(); 134 Shell::GetInstance()->UpdateShelfVisibility();
135 } 135 }
136 virtual bool IsUserSessionBlocked() const OVERRIDE { 136 virtual bool IsUserSessionBlocked() const OVERRIDE {
137 return !IsActiveUserSessionStarted() || IsScreenLocked(); 137 return !IsActiveUserSessionStarted() || IsScreenLocked();
138 } 138 }
139 virtual SessionState GetSessionState() const OVERRIDE { 139 virtual SessionState GetSessionState() const OVERRIDE {
140 // Assume that if session is not active we're at login. 140 // Assume that if session is not active we're at login.
141 return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE 141 return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE
142 : SESSION_STATE_LOGIN_PRIMARY; 142 : SESSION_STATE_LOGIN_PRIMARY;
143 } 143 }
144 virtual const UserInfo* GetUserInfo(MultiProfileIndex index) const OVERRIDE { 144 virtual const user_manager::UserInfo* GetUserInfo(
145 MultiProfileIndex index) const OVERRIDE {
145 return user_info_.get(); 146 return user_info_.get();
146 } 147 }
147 virtual const UserInfo* GetUserInfo( 148 virtual const user_manager::UserInfo* GetUserInfo(
148 content::BrowserContext* context) const OVERRIDE { 149 content::BrowserContext* context) const OVERRIDE {
149 return user_info_.get(); 150 return user_info_.get();
150 } 151 }
151 virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE { 152 virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE {
152 return !user_info_->GetImage().isNull(); 153 return !user_info_->GetImage().isNull();
153 } 154 }
154 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE {} 155 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE {}
155 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE {} 156 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE {}
156 virtual void AddSessionStateObserver( 157 virtual void AddSessionStateObserver(
157 ash::SessionStateObserver* observer) OVERRIDE {} 158 ash::SessionStateObserver* observer) OVERRIDE {}
158 virtual void RemoveSessionStateObserver( 159 virtual void RemoveSessionStateObserver(
159 ash::SessionStateObserver* observer) OVERRIDE {} 160 ash::SessionStateObserver* observer) OVERRIDE {}
160 161
161 private: 162 private:
162 bool screen_locked_; 163 bool screen_locked_;
163 164
164 // A pseudo user info. 165 // A pseudo user info.
165 scoped_ptr<UserInfo> user_info_; 166 scoped_ptr<user_manager::UserInfo> user_info_;
166 167
167 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); 168 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl);
168 }; 169 };
169 170
170 } // namespace 171 } // namespace
171 172
172 ShellDelegateImpl::ShellDelegateImpl() 173 ShellDelegateImpl::ShellDelegateImpl()
173 : watcher_(NULL), 174 : watcher_(NULL),
174 shelf_delegate_(NULL), 175 shelf_delegate_(NULL),
175 browser_context_(NULL) { 176 browser_context_(NULL) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // Real GPU support depends on src/content, so just use a stub. 279 // Real GPU support depends on src/content, so just use a stub.
279 return new GPUSupportStub; 280 return new GPUSupportStub;
280 } 281 }
281 282
282 base::string16 ShellDelegateImpl::GetProductName() const { 283 base::string16 ShellDelegateImpl::GetProductName() const {
283 return base::string16(); 284 return base::string16();
284 } 285 }
285 286
286 } // namespace shell 287 } // namespace shell
287 } // namespace ash 288 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698