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

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: rebase 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
« no previous file with comments | « ash/session/user_info.h ('k') | ash/system/user/accounts_detailed_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_impl.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 {
75 public:
76 UserInfoImpl() {}
77 virtual ~UserInfoImpl() {}
78
79 // UserInfo:
80 virtual base::string16 GetDisplayName() const OVERRIDE {
81 return base::UTF8ToUTF16("stub-user");
82 }
83 virtual base::string16 GetGivenName() const OVERRIDE {
84 return base::UTF8ToUTF16("Stub");
85 }
86 virtual std::string GetEmail() const OVERRIDE {
87 return "stub-user@domain.com";
88 }
89 virtual std::string GetUserID() const OVERRIDE { return GetEmail(); }
90 virtual const gfx::ImageSkia& GetImage() const OVERRIDE {
91 return user_image_;
92 }
93
94 private:
95 gfx::ImageSkia user_image_;
96
97 DISALLOW_COPY_AND_ASSIGN(UserInfoImpl);
98 };
99
100 class SessionStateDelegateImpl : public SessionStateDelegate { 74 class SessionStateDelegateImpl : public SessionStateDelegate {
101 public: 75 public:
102 SessionStateDelegateImpl() 76 SessionStateDelegateImpl()
103 : screen_locked_(false), user_info_(new UserInfoImpl()) {} 77 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {}
104 78
105 virtual ~SessionStateDelegateImpl() {} 79 virtual ~SessionStateDelegateImpl() {}
106 80
107 // SessionStateDelegate: 81 // SessionStateDelegate:
108 virtual content::BrowserContext* GetBrowserContextByIndex( 82 virtual content::BrowserContext* GetBrowserContextByIndex(
109 MultiProfileIndex index) OVERRIDE { 83 MultiProfileIndex index) OVERRIDE {
110 return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); 84 return Shell::GetInstance()->delegate()->GetActiveBrowserContext();
111 } 85 }
112 virtual content::BrowserContext* GetBrowserContextForWindow( 86 virtual content::BrowserContext* GetBrowserContextForWindow(
113 aura::Window* window) OVERRIDE { 87 aura::Window* window) OVERRIDE {
(...skipping 20 matching lines...) Expand all
134 Shell::GetInstance()->UpdateShelfVisibility(); 108 Shell::GetInstance()->UpdateShelfVisibility();
135 } 109 }
136 virtual bool IsUserSessionBlocked() const OVERRIDE { 110 virtual bool IsUserSessionBlocked() const OVERRIDE {
137 return !IsActiveUserSessionStarted() || IsScreenLocked(); 111 return !IsActiveUserSessionStarted() || IsScreenLocked();
138 } 112 }
139 virtual SessionState GetSessionState() const OVERRIDE { 113 virtual SessionState GetSessionState() const OVERRIDE {
140 // Assume that if session is not active we're at login. 114 // Assume that if session is not active we're at login.
141 return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE 115 return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE
142 : SESSION_STATE_LOGIN_PRIMARY; 116 : SESSION_STATE_LOGIN_PRIMARY;
143 } 117 }
144 virtual const UserInfo* GetUserInfo(MultiProfileIndex index) const OVERRIDE { 118 virtual const user_manager::UserInfo* GetUserInfo(
119 MultiProfileIndex index) const OVERRIDE {
145 return user_info_.get(); 120 return user_info_.get();
146 } 121 }
147 virtual const UserInfo* GetUserInfo( 122 virtual const user_manager::UserInfo* GetUserInfo(
148 content::BrowserContext* context) const OVERRIDE { 123 content::BrowserContext* context) const OVERRIDE {
149 return user_info_.get(); 124 return user_info_.get();
150 } 125 }
151 virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE { 126 virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE {
152 return !user_info_->GetImage().isNull(); 127 return !user_info_->GetImage().isNull();
153 } 128 }
154 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE {} 129 virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE {}
155 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE {} 130 virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE {}
156 virtual void AddSessionStateObserver( 131 virtual void AddSessionStateObserver(
157 ash::SessionStateObserver* observer) OVERRIDE {} 132 ash::SessionStateObserver* observer) OVERRIDE {}
158 virtual void RemoveSessionStateObserver( 133 virtual void RemoveSessionStateObserver(
159 ash::SessionStateObserver* observer) OVERRIDE {} 134 ash::SessionStateObserver* observer) OVERRIDE {}
160 135
161 private: 136 private:
162 bool screen_locked_; 137 bool screen_locked_;
163 138
164 // A pseudo user info. 139 // A pseudo user info.
165 scoped_ptr<UserInfo> user_info_; 140 scoped_ptr<user_manager::UserInfo> user_info_;
166 141
167 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); 142 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl);
168 }; 143 };
169 144
170 } // namespace 145 } // namespace
171 146
172 ShellDelegateImpl::ShellDelegateImpl() 147 ShellDelegateImpl::ShellDelegateImpl()
173 : watcher_(NULL), 148 : watcher_(NULL),
174 shelf_delegate_(NULL), 149 shelf_delegate_(NULL),
175 browser_context_(NULL) { 150 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. 253 // Real GPU support depends on src/content, so just use a stub.
279 return new GPUSupportStub; 254 return new GPUSupportStub;
280 } 255 }
281 256
282 base::string16 ShellDelegateImpl::GetProductName() const { 257 base::string16 ShellDelegateImpl::GetProductName() const {
283 return base::string16(); 258 return base::string16();
284 } 259 }
285 260
286 } // namespace shell 261 } // namespace shell
287 } // namespace ash 262 } // namespace ash
OLDNEW
« no previous file with comments | « ash/session/user_info.h ('k') | ash/system/user/accounts_detailed_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698