From 6e50d42bdd5307d76a90fb398774d140f796eace Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Wed, 30 Apr 2014 17:15:12 +0000 Subject: Revert 267158 "CleanUp: Introduce UserInfo. Move session_state s..." > CleanUp: Introduce UserInfo. Move session_state stuff to ash/session. > > BUG=None > R=nkostylev@chromium.org > TBR=sky@chromium.org > > Review URL: https://codereview.chromium.org/253063002 TBR=oshima@chromium.org Review URL: https://codereview.chromium.org/260783002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267250 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/accelerators/accelerator_controller.cc | 4 +- .../nested_dispatcher_controller_unittest.cc | 2 +- ash/ash.gyp | 15 +- ash/desktop_background/desktop_background_view.cc | 2 +- ash/frame/custom_frame_view_ash.cc | 2 +- ash/frame/frame_util.cc | 9 +- ash/root_window_controller.cc | 2 +- ash/root_window_controller_unittest.cc | 2 +- ash/session/session_state_delegate.h | 140 ------------------- ash/session/session_state_delegate_stub.cc | 137 ------------------ ash/session/session_state_delegate_stub.h | 58 -------- ash/session/session_state_observer.cc | 25 ---- ash/session/session_state_observer.h | 46 ------ ash/session/user_info.h | 45 ------ ash/session_state_delegate.h | 155 +++++++++++++++++++++ ash/session_state_delegate_stub.cc | 122 ++++++++++++++++ ash/session_state_delegate_stub.h | 65 +++++++++ ash/session_state_observer.cc | 24 ++++ ash/session_state_observer.h | 46 ++++++ ash/shelf/shelf_layout_manager.cc | 2 +- ash/shelf/shelf_layout_manager.h | 2 +- ash/shelf/shelf_layout_manager_unittest.cc | 2 +- ash/shelf/shelf_widget.cc | 2 +- ash/shell.cc | 2 +- ash/shell/app_list.cc | 2 +- ash/shell/lock_view.cc | 2 +- ash/shell/shell_delegate_impl.cc | 4 +- ash/shell/window_type_launcher.cc | 2 +- ash/shell_unittest.cc | 2 +- ash/system/chromeos/network/network_connect.cc | 2 +- ash/system/chromeos/power/power_event_observer.cc | 2 +- .../session/logout_confirmation_controller.cc | 2 +- ash/system/date/date_default_view.cc | 2 +- ash/system/tray/default_system_tray_delegate.cc | 2 +- ash/system/user/accounts_detailed_view.cc | 14 +- ash/system/user/config.cc | 2 +- ash/system/user/login_status.cc | 2 +- ash/system/user/tray_user.cc | 5 +- ash/system/user/tray_user.h | 2 +- ash/system/user/tray_user_separator.cc | 2 +- ash/system/user/tray_user_unittest.cc | 7 +- ash/system/user/user_card_view.cc | 20 ++- ash/system/user/user_view.cc | 5 +- ash/system/user/user_view.h | 2 +- ash/test/test_session_state_delegate.cc | 107 +++++--------- ash/test/test_session_state_delegate.h | 28 ++-- ash/test/test_shell_delegate.cc | 2 +- ash/test/test_system_tray_delegate.cc | 2 +- ash/wm/event_client_impl.cc | 2 +- ash/wm/gestures/shelf_gesture_handler.cc | 2 +- ash/wm/lock_state_controller_unittest.cc | 2 +- ash/wm/mru_window_tracker.cc | 2 +- ash/wm/overview/window_selector_controller.cc | 2 +- ash/wm/power_button_controller.cc | 2 +- ash/wm/stacking_controller.cc | 2 +- ash/wm/system_modal_container_layout_manager.cc | 2 +- ...stem_modal_container_layout_manager_unittest.cc | 2 +- ash/wm/workspace/workspace_layout_manager.cc | 2 +- .../workspace/workspace_layout_manager_unittest.cc | 2 +- .../accessibility/accessibility_manager.cc | 2 +- .../chromeos/accessibility/accessibility_manager.h | 2 +- .../accessibility/magnification_manager.cc | 2 +- .../chromeos/dbus/printer_service_provider.cc | 2 +- .../chromeos/extensions/first_run_private_api.cc | 4 +- .../file_manager/file_manager_browsertest.cc | 2 +- .../chromeos/login/session_login_browsertest.cc | 2 +- chrome/browser/chromeos/login/user.cc | 18 --- chrome/browser/chromeos/login/user.h | 21 +-- .../login/user_adding_screen_browsertest.cc | 2 +- .../login/user_image_manager_browsertest.cc | 32 ++--- .../chromeos/login/user_image_manager_impl.cc | 2 +- .../chromeos/memory/oom_priority_manager.cc | 2 +- .../policy/device_local_account_browsertest.cc | 2 +- .../chromeos/profiles/profile_list_chromeos.cc | 2 +- chrome/browser/idle_chromeos.cc | 2 +- .../message_center_settings_controller.cc | 12 +- .../multi_user/multi_user_context_menu_chromeos.cc | 23 ++- ..._user_notification_blocker_chromeos_unittest.cc | 8 +- .../ui/ash/multi_user/multi_user_window_manager.cc | 10 +- .../multi_user_window_manager_chromeos.cc | 2 +- .../multi_user_window_manager_chromeos.h | 2 +- .../multi_user_window_manager_chromeos_unittest.cc | 19 +-- .../ui/ash/session_state_delegate_chromeos.cc | 37 ++++- .../ui/ash/session_state_delegate_chromeos.h | 14 +- .../browser/ui/ash/session_state_delegate_views.cc | 73 ++++------ .../browser/ui/ash/session_state_delegate_views.h | 14 +- .../ui/ash/system_tray_delegate_chromeos.cc | 4 +- .../browser/ui/ash/system_tray_delegate_chromeos.h | 2 +- chrome/browser/ui/browser_command_controller.cc | 2 +- .../ash/chrome_browser_main_extra_parts_ash.cc | 2 +- chrome/browser/ui/views/frame/browser_frame.cc | 2 +- .../ui/views/frame/system_menu_model_builder.cc | 15 +- .../chromeos/change_picture_options_handler.cc | 4 +- .../chromeos/core_chromeos_options_handler.cc | 2 +- 94 files changed, 695 insertions(+), 806 deletions(-) delete mode 100644 ash/session/session_state_delegate.h delete mode 100644 ash/session/session_state_delegate_stub.cc delete mode 100644 ash/session/session_state_delegate_stub.h delete mode 100644 ash/session/session_state_observer.cc delete mode 100644 ash/session/session_state_observer.h delete mode 100644 ash/session/user_info.h create mode 100644 ash/session_state_delegate.h create mode 100644 ash/session_state_delegate_stub.cc create mode 100644 ash/session_state_delegate_stub.h create mode 100644 ash/session_state_observer.cc create mode 100644 ash/session_state_observer.h diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 51f780c..7d70bc7 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -28,7 +28,7 @@ #include "ash/root_window_controller.h" #include "ash/rotator/screen_rotation.h" #include "ash/screenshot_delegate.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_delegate.h" #include "ash/shelf/shelf_model.h" @@ -71,7 +71,7 @@ #include "ui/views/widget/widget.h" #if defined(OS_CHROMEOS) -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/system/chromeos/keyboard_brightness_controller.h" #include "base/sys_info.h" #include "chromeos/ime/ime_keyboard.h" diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc index e5aef88..20e399c 100644 --- a/ash/accelerators/nested_dispatcher_controller_unittest.cc +++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "ash/accelerators/accelerator_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" diff --git a/ash/ash.gyp b/ash/ash.gyp index f6555c3..4934087 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -240,10 +240,9 @@ 'screen_util.cc', 'screen_util.h', 'screenshot_delegate.h', - 'session/session_state_delegate.h', - 'session/session_state_observer.cc', - 'session/session_state_observer.h', - 'session/user_info.h', + 'session_state_delegate.h', + 'session_state_observer.cc', + 'session_state_observer.h', 'shelf/app_list_button.cc', 'shelf/app_list_button.h', 'shelf/app_list_shelf_item_delegate.cc', @@ -941,8 +940,8 @@ 'root_window_controller_unittest.cc', 'screen_util_unittest.cc', 'screensaver/screensaver_view_unittest.cc', - 'session/session_state_delegate_stub.cc', - 'session/session_state_delegate_stub.h', + 'session_state_delegate_stub.cc', + 'session_state_delegate_stub.h', 'shelf/scoped_observer_with_duplicated_sources_unittest.cc', 'shelf/shelf_layout_manager_unittest.cc', 'shelf/shelf_model_unittest.cc', @@ -1137,8 +1136,8 @@ 'ash_with_content', ], 'sources': [ - 'session/session_state_delegate_stub.cc', - 'session/session_state_delegate_stub.h', + 'session_state_delegate_stub.cc', + 'session_state_delegate_stub.h', 'shell/app_list.cc', 'shell/bubble.cc', 'shell/content_client/shell_browser_main_parts.cc', diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc index d0e850c..1250279 100644 --- a/ash/desktop_background/desktop_background_view.cc +++ b/ash/desktop_background/desktop_background_view.cc @@ -12,7 +12,7 @@ #include "ash/desktop_background/user_wallpaper_delegate.h" #include "ash/display/display_manager.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/wm/window_animations.h" diff --git a/ash/frame/custom_frame_view_ash.cc b/ash/frame/custom_frame_view_ash.cc index 8ab7e23..c9029ec 100644 --- a/ash/frame/custom_frame_view_ash.cc +++ b/ash/frame/custom_frame_view_ash.cc @@ -12,7 +12,7 @@ #include "ash/frame/frame_border_hit_test_controller.h" #include "ash/frame/frame_util.h" #include "ash/frame/header_painter.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_observer.h" #include "ash/wm/immersive_fullscreen_controller.h" diff --git a/ash/frame/frame_util.cc b/ash/frame/frame_util.cc index fd26783..bfa8c33 100644 --- a/ash/frame/frame_util.cc +++ b/ash/frame/frame_util.cc @@ -4,8 +4,7 @@ #include "ash/frame/frame_util.h" -#include "ash/session/session_state_delegate.h" -#include "ash/session/user_info.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "grit/ash_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -21,10 +20,8 @@ gfx::Image GetAvatarImageForContext(content::BrowserContext* context) { static const gfx::ImageSkia* holder_mask = ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( IDR_AVATAR_HOLDER_MASK); - gfx::ImageSkia user_image = Shell::GetInstance() - ->session_state_delegate() - ->GetUserInfo(context) - ->GetImage(); + gfx::ImageSkia user_image = + Shell::GetInstance()->session_state_delegate()->GetUserImage(context); gfx::ImageSkia resized = gfx::ImageSkiaOperations::CreateResizedImage( user_image, skia::ImageOperations::RESIZE_BEST, holder->size()); gfx::ImageSkia masked = diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 010ef0e..ba38e14 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -17,7 +17,7 @@ #include "ash/high_contrast/high_contrast_controller.h" #include "ash/host/ash_window_tree_host.h" #include "ash/root_window_settings.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index 803e078..99c340d 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -4,7 +4,7 @@ #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" diff --git a/ash/session/session_state_delegate.h b/ash/session/session_state_delegate.h deleted file mode 100644 index 78777a0..0000000 --- a/ash/session/session_state_delegate.h +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_SESSION_SESSION_STATE_DELEGATE_H_ -#define ASH_SESSION_SESSION_STATE_DELEGATE_H_ - -#include -#include - -#include "ash/ash_export.h" -#include "base/strings/string16.h" - -namespace aura { -class Window; -} // namespace aura - -namespace content { -class BrowserContext; -} - -namespace gfx { -class ImageSkia; -} // namespace gfx - -namespace ash { - -class SessionStateObserver; -class UserInfo; - -// The index for the multi-profile item to use. The list is always LRU sorted -// So that the index #0 is the currently active user. -typedef int MultiProfileIndex; - -// A list of user_id. -typedef std::vector UserIdList; - -// Delegate for checking and modifying the session state. -// TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause -// GetUserXXX are useful for non multi profile scenario in ash_shell. -class ASH_EXPORT SessionStateDelegate { - public: - // Defines the cycle direction for |CycleActiveUser|. - enum CycleUser { - CYCLE_TO_NEXT_USER = 0, // Cycle to the next user. - CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user. - }; - - // Defines session state i.e. whether session is running or not and - // whether user session is blocked by things like multi-profile login. - enum SessionState { - // When primary user login UI is shown i.e. after boot or sign out, - // no active user session exists yet. - SESSION_STATE_LOGIN_PRIMARY = 0, - - // Inside user session (including lock screen), - // no login UI (primary or multi-profiles) is shown. - SESSION_STATE_ACTIVE, - - // When secondary user login UI is shown i.e. other users are - // already logged in and is currently adding another user to the session. - SESSION_STATE_LOGIN_SECONDARY, - }; - - virtual ~SessionStateDelegate() {}; - - // Returns the browser context for the user given by |index|. - virtual content::BrowserContext* GetBrowserContextByIndex( - MultiProfileIndex index) = 0; - - // Returns the browser context associated with the window. - virtual content::BrowserContext* GetBrowserContextForWindow( - aura::Window* window) = 0; - - // Returns the maximum possible number of logged in users. - virtual int GetMaximumNumberOfLoggedInUsers() const = 0; - - // Returns the number of signed in users. If 0 is returned, there is either - // no session in progress or no active user. - virtual int NumberOfLoggedInUsers() const = 0; - - // Returns |true| if the session has been fully started for the active user. - // When a user becomes active, the profile and browser UI are not immediately - // available. Only once this method starts returning |true| is the browser - // startup complete and both profile and UI are fully available. - virtual bool IsActiveUserSessionStarted() const = 0; - - // Returns true if the screen can be locked. - virtual bool CanLockScreen() const = 0; - - // Returns true if the screen is currently locked. - virtual bool IsScreenLocked() const = 0; - - // Returns true if the screen should be locked when the system is about to - // suspend. - virtual bool ShouldLockScreenBeforeSuspending() const = 0; - - // Locks the screen. The locking happens asynchronously. - virtual void LockScreen() = 0; - - // Unlocks the screen. - virtual void UnlockScreen() = 0; - - // Returns |true| if user session blocked by some overlying UI. It can be - // login screen, lock screen or screen for adding users into multi-profile - // session. - virtual bool IsUserSessionBlocked() const = 0; - - // Returns current session state. - virtual SessionState GetSessionState() const = 0; - - // TODO(oshima): consolidate these two GetUserInfo. - - // Gets the user info for the user with the given |index|. - // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. - virtual const UserInfo* GetUserInfo(MultiProfileIndex index) const = 0; - - // Gets the avatar image for the user associated with the |context|. - virtual const UserInfo* GetUserInfo( - content::BrowserContext* context) const = 0; - - // Whether or not the window's title should show the avatar. - virtual bool ShouldShowAvatar(aura::Window* window) const = 0; - - // Switches to another active user with |user_id| - // (if that user has already signed in). - virtual void SwitchActiveUser(const std::string& user_id) = 0; - - // Switches the active user to the next or previous user, with the same - // ordering as GetLoggedInUsers. - virtual void CycleActiveUser(CycleUser cycle_user) = 0; - - // Adds or removes sessions state observer. - virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; - virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; -}; - -} // namespace ash - -#endif // ASH_SESSION_SESSION_STATE_DELEGATE_H_ diff --git a/ash/session/session_state_delegate_stub.cc b/ash/session/session_state_delegate_stub.cc deleted file mode 100644 index 05bca13..0000000 --- a/ash/session/session_state_delegate_stub.cc +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/session/session_state_delegate_stub.h" - -#include "ash/session/user_info.h" -#include "ash/shell.h" -#include "ash/shell/example_factory.h" -#include "ash/shell_delegate.h" -#include "base/strings/string16.h" -#include "base/strings/utf_string_conversions.h" -#include "ui/gfx/image/image_skia.h" - -namespace ash { -namespace { - -class UserInfoStub : public UserInfo { - public: - UserInfoStub() {} - virtual ~UserInfoStub() {} - - // UserInfo: - virtual base::string16 GetDisplayName() const OVERRIDE { - return base::UTF8ToUTF16("stub-user"); - } - virtual base::string16 GetGivenName() const OVERRIDE { - return base::UTF8ToUTF16("Stub"); - } - virtual std::string GetEmail() const OVERRIDE { - return "stub-user@domain.com"; - } - virtual std::string GetUserID() const OVERRIDE { return GetEmail(); } - virtual const gfx::ImageSkia& GetImage() const OVERRIDE { - return user_image_; - } - - private: - gfx::ImageSkia user_image_; - - DISALLOW_COPY_AND_ASSIGN(UserInfoStub); -}; - -} // namespace - -SessionStateDelegateStub::SessionStateDelegateStub() - : screen_locked_(false), user_info_(new UserInfoStub()) { -} - -SessionStateDelegateStub::~SessionStateDelegateStub() { -} - -content::BrowserContext* SessionStateDelegateStub::GetBrowserContextByIndex( - MultiProfileIndex index) { - return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); -} - -content::BrowserContext* SessionStateDelegateStub::GetBrowserContextForWindow( - aura::Window* window) { - return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); -} - -int SessionStateDelegateStub::GetMaximumNumberOfLoggedInUsers() const { - return 3; -} - -int SessionStateDelegateStub::NumberOfLoggedInUsers() const { - return 1; -} - -bool SessionStateDelegateStub::IsActiveUserSessionStarted() const { - return true; -} - -bool SessionStateDelegateStub::CanLockScreen() const { - return true; -} - -bool SessionStateDelegateStub::IsScreenLocked() const { - return screen_locked_; -} - -bool SessionStateDelegateStub::ShouldLockScreenBeforeSuspending() const { - return false; -} - -void SessionStateDelegateStub::LockScreen() { - shell::CreateLockScreen(); - screen_locked_ = true; - Shell::GetInstance()->UpdateShelfVisibility(); -} - -void SessionStateDelegateStub::UnlockScreen() { - screen_locked_ = false; - Shell::GetInstance()->UpdateShelfVisibility(); -} - -bool SessionStateDelegateStub::IsUserSessionBlocked() const { - return !IsActiveUserSessionStarted() || IsScreenLocked(); -} - -SessionStateDelegate::SessionState SessionStateDelegateStub::GetSessionState() - const { - // Assume that if session is not active we're at login. - return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE - : SESSION_STATE_LOGIN_PRIMARY; -} - -const UserInfo* SessionStateDelegateStub::GetUserInfo( - MultiProfileIndex index) const { - return user_info_.get(); -} - -const UserInfo* SessionStateDelegateStub::GetUserInfo( - content::BrowserContext* context) const { - return user_info_.get(); -} - -bool SessionStateDelegateStub::ShouldShowAvatar(aura::Window* window) const { - return !user_info_->GetImage().isNull(); -} - -void SessionStateDelegateStub::SwitchActiveUser(const std::string& user_id) { -} - -void SessionStateDelegateStub::CycleActiveUser(CycleUser cycle_user) { -} - -void SessionStateDelegateStub::AddSessionStateObserver( - ash::SessionStateObserver* observer) { -} - -void SessionStateDelegateStub::RemoveSessionStateObserver( - ash::SessionStateObserver* observer) { -} - -} // namespace ash diff --git a/ash/session/session_state_delegate_stub.h b/ash/session/session_state_delegate_stub.h deleted file mode 100644 index 5ce9cf3..0000000 --- a/ash/session/session_state_delegate_stub.h +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_SESSION_SESSION_STATE_DELEGATE_STUB_H_ -#define ASH_SESSION_SESSION_STATE_DELEGATE_STUB_H_ - -#include "ash/session/session_state_delegate.h" -#include "base/basictypes.h" -#include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" - -namespace ash { - -// Stub implementation of SessionStateDelegate for testing. -class SessionStateDelegateStub : public SessionStateDelegate { - public: - SessionStateDelegateStub(); - virtual ~SessionStateDelegateStub(); - - // SessionStateDelegate: - virtual content::BrowserContext* GetBrowserContextByIndex( - MultiProfileIndex index) OVERRIDE; - virtual content::BrowserContext* GetBrowserContextForWindow( - aura::Window* window) OVERRIDE; - virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; - virtual int NumberOfLoggedInUsers() const OVERRIDE; - virtual bool IsActiveUserSessionStarted() const OVERRIDE; - virtual bool CanLockScreen() const OVERRIDE; - virtual bool IsScreenLocked() const OVERRIDE; - virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; - virtual void LockScreen() OVERRIDE; - virtual void UnlockScreen() OVERRIDE; - virtual bool IsUserSessionBlocked() const OVERRIDE; - virtual SessionState GetSessionState() const OVERRIDE; - virtual const UserInfo* GetUserInfo(MultiProfileIndex index) const OVERRIDE; - virtual const UserInfo* GetUserInfo( - content::BrowserContext* context) const OVERRIDE; - virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE; - virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; - virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; - virtual void AddSessionStateObserver( - ash::SessionStateObserver* observer) OVERRIDE; - virtual void RemoveSessionStateObserver( - ash::SessionStateObserver* observer) OVERRIDE; - - private: - bool screen_locked_; - - // A pseudo user info. - scoped_ptr user_info_; - - DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); -}; - -} // namespace ash - -#endif // ASH_SESSION_SESSION_STATE_DELEGATE_STUB_H_ diff --git a/ash/session/session_state_observer.cc b/ash/session/session_state_observer.cc deleted file mode 100644 index 48c994e..0000000 --- a/ash/session/session_state_observer.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/session/session_state_observer.h" - -#include "ash/session/session_state_delegate.h" -#include "ash/shell.h" - -namespace ash { - -ScopedSessionStateObserver::ScopedSessionStateObserver( - ash::SessionStateObserver* observer) - : observer_(observer) { - ash::Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver( - observer_); -} - -ScopedSessionStateObserver::~ScopedSessionStateObserver() { - ash::Shell::GetInstance() - ->session_state_delegate() - ->RemoveSessionStateObserver(observer_); -} - -} // namespace ash diff --git a/ash/session/session_state_observer.h b/ash/session/session_state_observer.h deleted file mode 100644 index 36fad83..0000000 --- a/ash/session/session_state_observer.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_SESSION_SESSION_STATE_OBSERVER_H_ -#define ASH_SESSION_SESSION_STATE_OBSERVER_H_ - -#include - -#include "ash/ash_export.h" -#include "ash/session/session_state_delegate.h" -#include "base/basictypes.h" - -namespace ash { - -class ASH_EXPORT SessionStateObserver { - public: - // Called when active user has changed. - virtual void ActiveUserChanged(const std::string& user_id) {} - - // Called when another user gets added to the existing session. - virtual void UserAddedToSession(const std::string& user_id) {} - - // Called when session state is changed. - virtual void SessionStateChanged(SessionStateDelegate::SessionState state) {} - - protected: - virtual ~SessionStateObserver() {} -}; - -// A class to attach / detach an object as a session state observer with a -// scoped pointer. -class ASH_EXPORT ScopedSessionStateObserver { - public: - explicit ScopedSessionStateObserver(ash::SessionStateObserver* observer); - virtual ~ScopedSessionStateObserver(); - - private: - ash::SessionStateObserver* observer_; - - DISALLOW_COPY_AND_ASSIGN(ScopedSessionStateObserver); -}; - -} // namespace ash - -#endif // ASH_SESSION_SESSION_STATE_OBSERVER_H_ diff --git a/ash/session/user_info.h b/ash/session/user_info.h deleted file mode 100644 index 59a4cf4..0000000 --- a/ash/session/user_info.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_SESSION_USER_INFO_H_ -#define ASH_SESSION_USER_INFO_H_ - -#include - -#include "ash/ash_export.h" -#include "base/strings/string16.h" - -namespace gfx { -class ImageSkia; -} - -namespace ash { - -// A class that represents user related info. -class ASH_EXPORT UserInfo { - public: - virtual ~UserInfo() {} - - // Gets the display name for the user. - virtual base::string16 GetDisplayName() const = 0; - - // Gets the given name of the user. - virtual base::string16 GetGivenName() const = 0; - - // Gets the display email address for the user. - // The display email address might contains some periods in the email name - // as well as capitalized letters. For example: "Foo.Bar@mock.com". - virtual std::string GetEmail() const = 0; - - // Gets the user id (sanitized email address) for the user. - // The function would return something like "foobar@mock.com". - virtual std::string GetUserID() const = 0; - - // Gets the avatar image for the user. - virtual const gfx::ImageSkia& GetImage() const = 0; -}; - -} // namespace ash - -#endif // ASH_SESSION_USER_INFO_H_ diff --git a/ash/session_state_delegate.h b/ash/session_state_delegate.h new file mode 100644 index 0000000..dcbd7f9 --- /dev/null +++ b/ash/session_state_delegate.h @@ -0,0 +1,155 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SESSION_STATE_DELEGATE_H_ +#define ASH_SESSION_STATE_DELEGATE_H_ + +#include +#include + +#include "ash/ash_export.h" +#include "base/strings/string16.h" + +namespace aura { +class Window; +} // namespace aura + +namespace content { +class BrowserContext; +} + +namespace gfx { +class ImageSkia; +} // namespace gfx + +namespace ash { + +class SessionStateObserver; + +// The index for the multi-profile item to use. The list is always LRU sorted +// So that the index #0 is the currently active user. +typedef int MultiProfileIndex; + +// A list of user_id. +typedef std::vector UserIdList; + +// Delegate for checking and modifying the session state. +// TODO(oshima): Replace MultiProfileIndex with BrowsreContext, bacause +// GetUserXXX are useful for non multi profile scenario in ash_shell. +class ASH_EXPORT SessionStateDelegate { + public: + // Defines the cycle direction for |CycleActiveUser|. + enum CycleUser { + CYCLE_TO_NEXT_USER = 0, // Cycle to the next user. + CYCLE_TO_PREVIOUS_USER, // Cycle to the previous user. + }; + + // Defines session state i.e. whether session is running or not and + // whether user session is blocked by things like multi-profile login. + enum SessionState { + // When primary user login UI is shown i.e. after boot or sign out, + // no active user session exists yet. + SESSION_STATE_LOGIN_PRIMARY = 0, + + // Inside user session (including lock screen), + // no login UI (primary or multi-profiles) is shown. + SESSION_STATE_ACTIVE, + + // When secondary user login UI is shown i.e. other users are + // already logged in and is currently adding another user to the session. + SESSION_STATE_LOGIN_SECONDARY, + }; + + virtual ~SessionStateDelegate() {}; + + // Returns the browser context for the user given by |index|. + virtual content::BrowserContext* GetBrowserContextByIndex( + MultiProfileIndex index) = 0; + + // Returns the browser context associated with the window. + virtual content::BrowserContext* GetBrowserContextForWindow( + aura::Window* window) = 0; + + // Returns the maximum possible number of logged in users. + virtual int GetMaximumNumberOfLoggedInUsers() const = 0; + + // Returns the number of signed in users. If 0 is returned, there is either + // no session in progress or no active user. + virtual int NumberOfLoggedInUsers() const = 0; + + // Returns |true| if the session has been fully started for the active user. + // When a user becomes active, the profile and browser UI are not immediately + // available. Only once this method starts returning |true| is the browser + // startup complete and both profile and UI are fully available. + virtual bool IsActiveUserSessionStarted() const = 0; + + // Returns true if the screen can be locked. + virtual bool CanLockScreen() const = 0; + + // Returns true if the screen is currently locked. + virtual bool IsScreenLocked() const = 0; + + // Returns true if the screen should be locked when the system is about to + // suspend. + virtual bool ShouldLockScreenBeforeSuspending() const = 0; + + // Locks the screen. The locking happens asynchronously. + virtual void LockScreen() = 0; + + // Unlocks the screen. + virtual void UnlockScreen() = 0; + + // Returns |true| if user session blocked by some overlying UI. It can be + // login screen, lock screen or screen for adding users into multi-profile + // session. + virtual bool IsUserSessionBlocked() const = 0; + + // Returns current session state. + virtual SessionState GetSessionState() const = 0; + + // Gets the displayed name for the user with the given |index|. + // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. + virtual const base::string16 GetUserDisplayName( + MultiProfileIndex index) const = 0; + + // Gets the given name of the user with |index|. An empty string can be + // returned if the given name of the user is unknown. + // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. + virtual const base::string16 GetUserGivenName( + MultiProfileIndex index) const = 0; + + // Gets the display email address for the user with the given |index|. + // The display email address might contains some periods in the email name + // as well as capitalized letters. For example: "Foo.Bar@mock.com". + // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. + virtual const std::string GetUserEmail(MultiProfileIndex index) const = 0; + + // Gets the user id (sanitized email address) for the user with the given + // |index|. The function would return something like "foobar@mock.com". + // Note that |index| can at maximum be |NumberOfLoggedInUsers() - 1|. + virtual const std::string GetUserID(MultiProfileIndex index) const = 0; + + // Gets the avatar image for the user associated with the |context|. + virtual const gfx::ImageSkia& GetUserImage( + content::BrowserContext* context) const = 0; + + // Whether or not the window's title should show the avatar. + virtual bool ShouldShowAvatar(aura::Window* window) = 0; + + // Switches to another active user with |user_id| + // (if that user has already signed in). + virtual void SwitchActiveUser(const std::string& user_id) = 0; + + // Switches the active user to the next or previous user, with the same + // ordering as GetLoggedInUsers. + virtual void CycleActiveUser(CycleUser cycle_user) = 0; + + // Adds or removes sessions state observer. + virtual void AddSessionStateObserver(SessionStateObserver* observer) = 0; + virtual void RemoveSessionStateObserver(SessionStateObserver* observer) = 0; +}; + +} // namespace ash + +#endif // ASH_SESSION_STATE_DELEGATE_H_ diff --git a/ash/session_state_delegate_stub.cc b/ash/session_state_delegate_stub.cc new file mode 100644 index 0000000..ba1058b --- /dev/null +++ b/ash/session_state_delegate_stub.cc @@ -0,0 +1,122 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/session_state_delegate_stub.h" + +#include "ash/shell.h" +#include "ash/shell/example_factory.h" +#include "ash/shell_delegate.h" +#include "base/strings/string16.h" +#include "base/strings/utf_string_conversions.h" + +namespace ash { + +SessionStateDelegateStub::SessionStateDelegateStub() : screen_locked_(false) { +} + +SessionStateDelegateStub::~SessionStateDelegateStub() { +} + +content::BrowserContext* +SessionStateDelegateStub::GetBrowserContextByIndex( + MultiProfileIndex index) { + return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); +} + +content::BrowserContext* +SessionStateDelegateStub::GetBrowserContextForWindow( + aura::Window* window) { + return Shell::GetInstance()->delegate()->GetActiveBrowserContext(); +} + +int SessionStateDelegateStub::GetMaximumNumberOfLoggedInUsers() const { + return 3; +} + +int SessionStateDelegateStub::NumberOfLoggedInUsers() const { + return 1; +} + +bool SessionStateDelegateStub::IsActiveUserSessionStarted() const { + return true; +} + +bool SessionStateDelegateStub::CanLockScreen() const { + return true; +} + +bool SessionStateDelegateStub::IsScreenLocked() const { + return screen_locked_; +} + +bool SessionStateDelegateStub::ShouldLockScreenBeforeSuspending() const { + return false; +} + +void SessionStateDelegateStub::LockScreen() { + shell::CreateLockScreen(); + screen_locked_ = true; + Shell::GetInstance()->UpdateShelfVisibility(); +} + +void SessionStateDelegateStub::UnlockScreen() { + screen_locked_ = false; + Shell::GetInstance()->UpdateShelfVisibility(); +} + +bool SessionStateDelegateStub::IsUserSessionBlocked() const { + return !IsActiveUserSessionStarted() || IsScreenLocked(); +} + +SessionStateDelegate::SessionState SessionStateDelegateStub::GetSessionState() + const { + // Assume that if session is not active we're at login. + return IsActiveUserSessionStarted() ? + SESSION_STATE_ACTIVE : SESSION_STATE_LOGIN_PRIMARY; +} + +const base::string16 SessionStateDelegateStub::GetUserDisplayName( + MultiProfileIndex index) const { + return base::UTF8ToUTF16("stub-user"); +} + +const base::string16 SessionStateDelegateStub::GetUserGivenName( + MultiProfileIndex index) const { + return base::UTF8ToUTF16("Stub"); +} + +const std::string SessionStateDelegateStub::GetUserEmail( + MultiProfileIndex index) const { + return "stub-user@domain.com"; +} + +const std::string SessionStateDelegateStub::GetUserID( + MultiProfileIndex index) const { + return GetUserEmail(index); +} + +const gfx::ImageSkia& SessionStateDelegateStub::GetUserImage( + content::BrowserContext* context) const { + return user_image_; +} + +bool SessionStateDelegateStub::ShouldShowAvatar(aura::Window* window) { + return !user_image_.isNull(); +} + +void SessionStateDelegateStub::SwitchActiveUser(const std::string& user_id) { +} + +void SessionStateDelegateStub::CycleActiveUser(CycleUser cycle_user) { +} + +void SessionStateDelegateStub::AddSessionStateObserver( + ash::SessionStateObserver* observer) { +} + +void SessionStateDelegateStub::RemoveSessionStateObserver( + ash::SessionStateObserver* observer) { +} + +} // namespace ash diff --git a/ash/session_state_delegate_stub.h b/ash/session_state_delegate_stub.h new file mode 100644 index 0000000..5145fb8 --- /dev/null +++ b/ash/session_state_delegate_stub.h @@ -0,0 +1,65 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SESSION_STATE_DELEGATE_STUB_H_ +#define ASH_SESSION_STATE_DELEGATE_STUB_H_ + +#include "ash/session_state_delegate.h" +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "ui/gfx/image/image_skia.h" + +namespace ash { + +// Stub implementation of SessionStateDelegate for testing. +class SessionStateDelegateStub : public SessionStateDelegate { + public: + SessionStateDelegateStub(); + virtual ~SessionStateDelegateStub(); + + // SessionStateDelegate: + virtual content::BrowserContext* GetBrowserContextByIndex( + MultiProfileIndex index) OVERRIDE; + virtual content::BrowserContext* GetBrowserContextForWindow( + aura::Window* window) OVERRIDE; + virtual int GetMaximumNumberOfLoggedInUsers() const OVERRIDE; + virtual int NumberOfLoggedInUsers() const OVERRIDE; + virtual bool IsActiveUserSessionStarted() const OVERRIDE; + virtual bool CanLockScreen() const OVERRIDE; + virtual bool IsScreenLocked() const OVERRIDE; + virtual bool ShouldLockScreenBeforeSuspending() const OVERRIDE; + virtual void LockScreen() OVERRIDE; + virtual void UnlockScreen() OVERRIDE; + virtual bool IsUserSessionBlocked() const OVERRIDE; + virtual SessionState GetSessionState() const OVERRIDE; + virtual const base::string16 GetUserDisplayName( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const base::string16 GetUserGivenName( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserEmail( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserID( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const gfx::ImageSkia& GetUserImage( + content::BrowserContext* context) const OVERRIDE; + virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; + virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; + virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; + virtual void AddSessionStateObserver( + ash::SessionStateObserver* observer) OVERRIDE; + virtual void RemoveSessionStateObserver( + ash::SessionStateObserver* observer) OVERRIDE; + + private: + bool screen_locked_; + + // A pseudo user image. + gfx::ImageSkia user_image_; + + DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); +}; + +} // namespace ash + +#endif // ASH_SESSION_STATE_DELEGATE_STUB_H_ diff --git a/ash/session_state_observer.cc b/ash/session_state_observer.cc new file mode 100644 index 0000000..96b0771 --- /dev/null +++ b/ash/session_state_observer.cc @@ -0,0 +1,24 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/session_state_observer.h" + +#include "ash/session_state_delegate.h" +#include "ash/shell.h" + +namespace ash { + +ScopedSessionStateObserver::ScopedSessionStateObserver( + ash::SessionStateObserver* observer) : observer_(observer) { + ash::Shell::GetInstance()->session_state_delegate()-> + AddSessionStateObserver(observer_); +} + +ScopedSessionStateObserver::~ScopedSessionStateObserver() { + ash::Shell::GetInstance()->session_state_delegate()-> + RemoveSessionStateObserver(observer_); +} + +} // namespace ash + diff --git a/ash/session_state_observer.h b/ash/session_state_observer.h new file mode 100644 index 0000000..59d6f67 --- /dev/null +++ b/ash/session_state_observer.h @@ -0,0 +1,46 @@ +// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SESSION_STATE_OBSERVER_H_ +#define ASH_SESSION_STATE_OBSERVER_H_ + +#include + +#include "ash/ash_export.h" +#include "ash/session_state_delegate.h" +#include "base/basictypes.h" + +namespace ash { + +class ASH_EXPORT SessionStateObserver { + public: + // Called when active user has changed. + virtual void ActiveUserChanged(const std::string& user_id) {} + + // Called when another user gets added to the existing session. + virtual void UserAddedToSession(const std::string& user_id) {} + + // Called when session state is changed. + virtual void SessionStateChanged(SessionStateDelegate::SessionState state) {} + + protected: + virtual ~SessionStateObserver() {} +}; + +// A class to attach / detach an object as a session state observer with a +// scoped pointer. +class ASH_EXPORT ScopedSessionStateObserver { + public: + explicit ScopedSessionStateObserver(ash::SessionStateObserver* observer); + virtual ~ScopedSessionStateObserver(); + + private: + ash::SessionStateObserver* observer_; + + DISALLOW_COPY_AND_ASSIGN(ScopedSessionStateObserver); +}; + +} // namespace ash + +#endif // ASH_SESSION_STATE_OBSERVER_H_ diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 9df4bdc..7a1998d 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -14,7 +14,7 @@ #include "ash/ash_switches.h" #include "ash/root_window_controller.h" #include "ash/screen_util.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_bezel_event_filter.h" #include "ash/shelf/shelf_constants.h" diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index f0acb42..22ebf4a 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -8,7 +8,7 @@ #include #include "ash/ash_export.h" -#include "ash/session/session_state_observer.h" +#include "ash/session_state_observer.h" #include "ash/shelf/background_animator.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_types.h" diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index cc268fa..7c8b9f7 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -10,7 +10,7 @@ #include "ash/display/display_manager.h" #include "ash/focus_cycler.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager_observer.h" #include "ash/shelf/shelf_view.h" diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index cf980d2..8721312 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc @@ -7,7 +7,7 @@ #include "ash/ash_switches.h" #include "ash/focus_cycler.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_constants.h" #include "ash/shelf/shelf_delegate.h" #include "ash/shelf/shelf_layout_manager.h" diff --git a/ash/shell.cc b/ash/shell.cc index 9f19b14..7dbe541 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -36,7 +36,7 @@ #include "ash/media_delegate.h" #include "ash/new_window_delegate.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/app_list_shelf_item_delegate.h" #include "ash/shelf/shelf_delegate.h" #include "ash/shelf/shelf_item_delegate.h" diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index c487ba1..c3ea36b 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc @@ -4,7 +4,7 @@ #include -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell/example_factory.h" #include "ash/shell/toplevel_window.h" diff --git a/ash/shell/lock_view.cc b/ash/shell/lock_view.cc index d14b593..eae9d9c 100644 --- a/ash/shell/lock_view.cc +++ b/ash/shell/lock_view.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell/example_factory.h" #include "ash/shell_window_ids.h" diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 2bf14e8..840c6bb 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -10,8 +10,8 @@ #include "ash/gpu_support_stub.h" #include "ash/media_delegate.h" #include "ash/new_window_delegate.h" -#include "ash/session/session_state_delegate.h" -#include "ash/session/session_state_delegate_stub.h" +#include "ash/session_state_delegate.h" +#include "ash/session_state_delegate_stub.h" #include "ash/shell/context_menu.h" #include "ash/shell/example_factory.h" #include "ash/shell/keyboard_controller_proxy_stub.h" diff --git a/ash/shell/window_type_launcher.cc b/ash/shell/window_type_launcher.cc index e0214d3..9352823 100644 --- a/ash/shell/window_type_launcher.cc +++ b/ash/shell/window_type_launcher.cc @@ -6,7 +6,7 @@ #include "ash/root_window_controller.h" #include "ash/screensaver/screensaver_view.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "ash/shell/example_factory.h" diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 5c206a5..343bd1d 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -12,7 +12,7 @@ #include "ash/display/mouse_cursor_event_filter.h" #include "ash/drag_drop/drag_drop_controller.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" diff --git a/ash/system/chromeos/network/network_connect.cc b/ash/system/chromeos/network/network_connect.cc index d9e9bcf..64a5749 100644 --- a/ash/system/chromeos/network/network_connect.cc +++ b/ash/system/chromeos/network/network_connect.cc @@ -4,7 +4,7 @@ #include "ash/system/chromeos/network/network_connect.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/system/chromeos/network/network_state_notifier.h" #include "ash/system/system_notifier.h" diff --git a/ash/system/chromeos/power/power_event_observer.cc b/ash/system/chromeos/power/power_event_observer.cc index 103d2df..776b004 100644 --- a/ash/system/chromeos/power/power_event_observer.cc +++ b/ash/system/chromeos/power/power_event_observer.cc @@ -4,7 +4,7 @@ #include "ash/system/chromeos/power/power_event_observer.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/wm/power_button_controller.h" diff --git a/ash/system/chromeos/session/logout_confirmation_controller.cc b/ash/system/chromeos/session/logout_confirmation_controller.cc index fdf1cc6..61d8c9b 100644 --- a/ash/system/chromeos/session/logout_confirmation_controller.cc +++ b/ash/system/chromeos/session/logout_confirmation_controller.cc @@ -4,7 +4,7 @@ #include "ash/system/chromeos/session/logout_confirmation_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/system/chromeos/session/logout_confirmation_dialog.h" #include "base/location.h" diff --git a/ash/system/date/date_default_view.cc b/ash/system/date/date_default_view.cc index f9ed123..389485f 100644 --- a/ash/system/date/date_default_view.cc +++ b/ash/system/date/date_default_view.cc @@ -5,7 +5,7 @@ #include "ash/system/date/date_default_view.h" #include "ash/metrics/user_metrics_recorder.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/system/date/date_view.h" #include "ash/system/tray/special_popup_row.h" diff --git a/ash/system/tray/default_system_tray_delegate.cc b/ash/system/tray/default_system_tray_delegate.cc index 1ac2c04..5b254c1 100644 --- a/ash/system/tray/default_system_tray_delegate.cc +++ b/ash/system/tray/default_system_tray_delegate.cc @@ -6,7 +6,7 @@ #include -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/volume_control_delegate.h" #include "base/message_loop/message_loop.h" diff --git a/ash/system/user/accounts_detailed_view.cc b/ash/system/user/accounts_detailed_view.cc index 58956b5..fe5bb68 100644 --- a/ash/system/user/accounts_detailed_view.cc +++ b/ash/system/user/accounts_detailed_view.cc @@ -7,7 +7,6 @@ #include #include "ash/multi_profile_uma.h" -#include "ash/session/user_info.h" #include "ash/shell.h" #include "ash/system/tray/fixed_sized_scroll_view.h" #include "ash/system/tray/hover_highlight_view.h" @@ -44,10 +43,8 @@ AccountsDetailedView::AccountsDetailedView(TrayUser* owner, account_list_(NULL), add_account_button_(NULL), add_user_button_(NULL) { - std::string user_id = Shell::GetInstance() - ->session_state_delegate() - ->GetUserInfo(0) - ->GetUserID(); + std::string user_id = + Shell::GetInstance()->session_state_delegate()->GetUserID(0); delegate_ = Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate( user_id); @@ -120,12 +117,11 @@ void AccountsDetailedView::AddAddAccountButton() { SessionStateDelegate* session_state_delegate = Shell::GetInstance()->session_state_delegate(); HoverHighlightView* add_account_button = new HoverHighlightView(this); - const UserInfo* user_info = session_state_delegate->GetUserInfo(0); - base::string16 user_name = user_info->GetGivenName(); + base::string16 user_name = session_state_delegate->GetUserGivenName(0); if (user_name.empty()) - user_name = user_info->GetDisplayName(); + user_name = session_state_delegate->GetUserDisplayName(0); if (user_name.empty()) - user_name = base::ASCIIToUTF16(user_info->GetEmail()); + user_name = base::ASCIIToUTF16(session_state_delegate->GetUserEmail(0)); add_account_button->AddLabel( l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_ADD_ACCOUNT_LABEL, user_name), diff --git a/ash/system/user/config.cc b/ash/system/user/config.cc index 1ea6d32..d704393 100644 --- a/ash/system/user/config.cc +++ b/ash/system/user/config.cc @@ -4,7 +4,7 @@ #include "ash/system/user/config.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_delegate.h" diff --git a/ash/system/user/login_status.cc b/ash/system/user/login_status.cc index 97c05c15..3172cd7 100644 --- a/ash/system/user/login_status.cc +++ b/ash/system/user/login_status.cc @@ -4,7 +4,7 @@ #include "ash/system/user/login_status.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index cb5676c..2a8dfe1 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -6,8 +6,7 @@ #include "ash/ash_switches.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" -#include "ash/session/user_info.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell_delegate.h" #include "ash/system/tray/system_tray.h" @@ -264,7 +263,7 @@ void TrayUser::UpdateAvatarImage(user::LoginStatus status) { content::BrowserContext* context = session_state_delegate-> GetBrowserContextByIndex(GetTrayIndex()); - avatar_->SetImage(session_state_delegate->GetUserInfo(context)->GetImage(), + avatar_->SetImage(session_state_delegate->GetUserImage(context), gfx::Size(kTrayAvatarSize, kTrayAvatarSize)); // Unit tests might come here with no images for some users. diff --git a/ash/system/user/tray_user.h b/ash/system/user/tray_user.h index 1e0aa281..0b19d47 100644 --- a/ash/system/user/tray_user.h +++ b/ash/system/user/tray_user.h @@ -6,7 +6,7 @@ #define ASH_SYSTEM_USER_TRAY_USER_H_ #include "ash/ash_export.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/system/tray/system_tray_item.h" #include "ash/system/user/user_observer.h" #include "base/compiler_specific.h" diff --git a/ash/system/user/tray_user_separator.cc b/ash/system/user/tray_user_separator.cc index 7058d2f..dd60f6b 100644 --- a/ash/system/user/tray_user_separator.cc +++ b/ash/system/user/tray_user_separator.cc @@ -4,7 +4,7 @@ #include "ash/system/user/tray_user_separator.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ui/views/view.h" diff --git a/ash/system/user/tray_user_unittest.cc b/ash/system/user/tray_user_unittest.cc index 3205666..b0d77c4 100644 --- a/ash/system/user/tray_user_unittest.cc +++ b/ash/system/user/tray_user_unittest.cc @@ -6,7 +6,6 @@ #include "ash/ash_switches.h" #include "ash/root_window_controller.h" -#include "ash/session/user_info.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_delegate.h" @@ -239,12 +238,10 @@ TEST_F(TrayUserTest, MutiUserModeButtonClicks) { // Switch to a new user - which has a capitalized name. ClickUserItem(&generator, 1); - const UserInfo* active_user = delegate()->GetActiveUserInfo(); - const UserInfo* second_user = delegate()->GetUserInfo(1); - EXPECT_EQ(active_user->GetUserID(), second_user->GetUserID()); + EXPECT_EQ(delegate()->get_activated_user(), delegate()->GetUserID(1)); // Since the name is capitalized, the email should be different then the // user_id. - EXPECT_NE(active_user->GetUserID(), second_user->GetEmail()); + EXPECT_NE(delegate()->get_activated_user(), delegate()->GetUserEmail(1)); tray()->CloseSystemBubble(); } diff --git a/ash/system/user/user_card_view.cc b/ash/system/user/user_card_view.cc index af568ae..6d5413e 100644 --- a/ash/system/user/user_card_view.cc +++ b/ash/system/user/user_card_view.cc @@ -7,8 +7,7 @@ #include #include -#include "ash/session/session_state_delegate.h" -#include "ash/session/user_info.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/tray_constants.h" @@ -90,10 +89,8 @@ PublicAccountUserDetails::PublicAccountUserDetails(int max_width) // Retrieve the user's display name and wrap it with markers. // Note that since this is a public account it always has to be the primary // user. - base::string16 display_name = Shell::GetInstance() - ->session_state_delegate() - ->GetUserInfo(0) - ->GetDisplayName(); + base::string16 display_name = + Shell::GetInstance()->session_state_delegate()->GetUserDisplayName(0); base::RemoveChars(display_name, kDisplayNameMark, &display_name); display_name = kDisplayNameMark[0] + display_name + kDisplayNameMark[0]; // Retrieve the domain managing the device and wrap it with markers. @@ -308,10 +305,10 @@ void UserCardView::AddUserContent(user::LoginStatus login_status, base::string16 user_name_string = login_status == user::LOGGED_IN_GUEST ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL) - : delegate->GetUserInfo(multiprofile_index)->GetDisplayName(); + : delegate->GetUserDisplayName(multiprofile_index); if (user_name_string.empty() && IsMultiAccountSupportedAndUserActive()) - user_name_string = base::ASCIIToUTF16( - delegate->GetUserInfo(multiprofile_index)->GetEmail()); + user_name_string = + base::ASCIIToUTF16(delegate->GetUserEmail(multiprofile_index)); if (!user_name_string.empty()) { username = new views::Label(user_name_string); username->SetHorizontalAlignment(gfx::ALIGN_LEFT); @@ -325,8 +322,7 @@ void UserCardView::AddUserContent(user::LoginStatus login_status, login_status == user::LOGGED_IN_LOCALLY_MANAGED ? l10n_util::GetStringUTF16( IDS_ASH_STATUS_TRAY_LOCALLY_MANAGED_LABEL) - : base::UTF8ToUTF16( - delegate->GetUserInfo(multiprofile_index)->GetEmail()); + : base::UTF8ToUTF16(delegate->GetUserEmail(multiprofile_index)); if (!user_email_string.empty()) { additional = new views::Label(user_email_string); additional->SetFontList( @@ -376,7 +372,7 @@ views::View* UserCardView::CreateIcon(user::LoginStatus login_status, Shell::GetInstance()->session_state_delegate(); content::BrowserContext* context = delegate->GetBrowserContextByIndex(multiprofile_index); - icon->SetImage(delegate->GetUserInfo(context)->GetImage(), + icon->SetImage(delegate->GetUserImage(context), gfx::Size(kTrayAvatarSize, kTrayAvatarSize)); } return icon; diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc index f5eb6833..4743163 100644 --- a/ash/system/user/user_view.cc +++ b/ash/system/user/user_view.cc @@ -8,8 +8,7 @@ #include "ash/multi_profile_uma.h" #include "ash/popup_message.h" -#include "ash/session/session_state_delegate.h" -#include "ash/session/user_info.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/system/tray/system_tray.h" @@ -77,7 +76,7 @@ void SwitchUser(ash::MultiProfileIndex user_index) { ash::Shell::GetInstance()->session_state_delegate(); ash::MultiProfileUMA::RecordSwitchActiveUser( ash::MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); - delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetUserID()); + delegate->SwitchActiveUser(delegate->GetUserID(user_index)); } class LogoutButton : public TrayPopupLabelButton { diff --git a/ash/system/user/user_view.h b/ash/system/user/user_view.h index b51b4c7..e6657c6 100644 --- a/ash/system/user/user_view.h +++ b/ash/system/user/user_view.h @@ -5,7 +5,7 @@ #ifndef ASH_SYSTEM_USER_USER_VIEW_H_ #define ASH_SYSTEM_USER_USER_VIEW_H_ -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/user/login_status.h" #include "ash/system/user/tray_user.h" diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc index 8831b58..f7efe1d 100644 --- a/ash/test/test_session_state_delegate.cc +++ b/ash/test/test_session_state_delegate.cc @@ -7,17 +7,12 @@ #include #include -#include "ash/session/user_info.h" #include "ash/shell.h" #include "ash/system/user/login_status.h" -#include "base/stl_util.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -namespace ash { -namespace test { - namespace { // The the "canonicalized" user ID from a given |email| address. @@ -29,40 +24,8 @@ std::string GetUserIDFromEmail(const std::string& email) { } // namespace -class MockUserInfo : public UserInfo { - public: - explicit MockUserInfo(const std::string& id) : email_(id) {} - virtual ~MockUserInfo() {} - - void SetUserImage(const gfx::ImageSkia& user_image) { - user_image_ = user_image; - } - - virtual base::string16 GetDisplayName() const OVERRIDE { - return base::UTF8ToUTF16("Über tray Über tray Über tray Über tray"); - } - - virtual base::string16 GetGivenName() const OVERRIDE { - return base::UTF8ToUTF16("Über Über Über Über"); - } - - virtual std::string GetEmail() const OVERRIDE { return email_; } - - virtual std::string GetUserID() const OVERRIDE { - return GetUserIDFromEmail(GetEmail()); - } - - virtual const gfx::ImageSkia& GetImage() const OVERRIDE { - return user_image_; - } - - // A test user image. - gfx::ImageSkia user_image_; - - std::string email_; - - DISALLOW_COPY_AND_ASSIGN(MockUserInfo); -}; +namespace ash { +namespace test { TestSessionStateDelegate::TestSessionStateDelegate() : has_active_user_(false), @@ -71,26 +34,10 @@ TestSessionStateDelegate::TestSessionStateDelegate() should_lock_screen_before_suspending_(false), screen_locked_(false), user_adding_screen_running_(false), - logged_in_users_(1), - active_user_index_(0) { - user_list_.push_back( - new MockUserInfo("First@tray")); // This is intended to be capitalized. - user_list_.push_back( - new MockUserInfo("Second@tray")); // This is intended to be capitalized. - user_list_.push_back(new MockUserInfo("third@tray")); - user_list_.push_back(new MockUserInfo("someone@tray")); + logged_in_users_(1) { } TestSessionStateDelegate::~TestSessionStateDelegate() { - STLDeleteElements(&user_list_); -} - -void TestSessionStateDelegate::AddUser(const std::string user_id) { - user_list_.push_back(new MockUserInfo(user_id)); -} - -const UserInfo* TestSessionStateDelegate::GetActiveUserInfo() const { - return user_list_[active_user_index_]; } content::BrowserContext* @@ -189,41 +136,51 @@ void TestSessionStateDelegate::SetUserAddingScreenRunning( void TestSessionStateDelegate::SetUserImage( const gfx::ImageSkia& user_image) { - user_list_[active_user_index_]->SetUserImage(user_image); + user_image_ = user_image; +} + +const base::string16 TestSessionStateDelegate::GetUserDisplayName( + MultiProfileIndex index) const { + return base::UTF8ToUTF16("Über tray Über tray Über tray Über tray"); } -const UserInfo* TestSessionStateDelegate::GetUserInfo( +const base::string16 TestSessionStateDelegate::GetUserGivenName( MultiProfileIndex index) const { - int max = static_cast(user_list_.size()); - return user_list_[index < max ? index : max - 1]; + return base::UTF8ToUTF16("Über Über Über Über"); } -const UserInfo* TestSessionStateDelegate::GetUserInfo( +const std::string TestSessionStateDelegate::GetUserEmail( + MultiProfileIndex index) const { + switch (index) { + case 0: return "First@tray"; // This is intended to be capitalized. + case 1: return "Second@tray"; // This is intended to be capitalized. + case 2: return "third@tray"; + default: return "someone@tray"; + } +} + +const std::string TestSessionStateDelegate::GetUserID( + MultiProfileIndex index) const { + return GetUserIDFromEmail(GetUserEmail(index)); +} + +const gfx::ImageSkia& TestSessionStateDelegate::GetUserImage( content::BrowserContext* context) const { - return user_list_[active_user_index_]; + return user_image_; } -bool TestSessionStateDelegate::ShouldShowAvatar(aura::Window* window) const { - return !GetActiveUserInfo()->GetImage().isNull(); +bool TestSessionStateDelegate::ShouldShowAvatar(aura::Window* window) { + return !user_image_.isNull(); } void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) { // Make sure this is a user id and not an email address. EXPECT_EQ(user_id, GetUserIDFromEmail(user_id)); - active_user_index_ = 0; - for (std::vector::iterator iter = user_list_.begin(); - iter != user_list_.end(); - ++iter) { - if ((*iter)->GetUserID() == user_id) { - active_user_index_ = iter - user_list_.begin(); - return; - } - } - NOTREACHED() << "Unknown user:" << user_id; + activated_user_ = user_id; } void TestSessionStateDelegate::CycleActiveUser(CycleUser cycle_user) { - SwitchActiveUser("someone@tray"); + activated_user_ = "someone@tray"; } void TestSessionStateDelegate::AddSessionStateObserver( diff --git a/ash/test/test_session_state_delegate.h b/ash/test/test_session_state_delegate.h index 5616eec..cceefa2 100644 --- a/ash/test/test_session_state_delegate.h +++ b/ash/test/test_session_state_delegate.h @@ -5,9 +5,7 @@ #ifndef ASH_TEST_TEST_SESSION_STATE_DELEGATE_H_ #define ASH_TEST_TEST_SESSION_STATE_DELEGATE_H_ -#include - -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/gfx/image/image_skia.h" @@ -15,16 +13,13 @@ namespace ash { namespace test { -class MockUserInfo; - class TestSessionStateDelegate : public SessionStateDelegate { public: TestSessionStateDelegate(); virtual ~TestSessionStateDelegate(); void set_logged_in_users(int users) { logged_in_users_ = users; } - void AddUser(const std::string user_id); - const UserInfo* GetActiveUserInfo() const; + const std::string& get_activated_user() { return activated_user_; } // SessionStateDelegate: virtual content::BrowserContext* GetBrowserContextByIndex( @@ -41,11 +36,17 @@ class TestSessionStateDelegate : public SessionStateDelegate { virtual void UnlockScreen() OVERRIDE; virtual bool IsUserSessionBlocked() const OVERRIDE; virtual SessionState GetSessionState() const OVERRIDE; - virtual const UserInfo* GetUserInfo( + virtual const base::string16 GetUserDisplayName( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const base::string16 GetUserGivenName( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserEmail( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserID( ash::MultiProfileIndex index) const OVERRIDE; - virtual const UserInfo* GetUserInfo( + virtual const gfx::ImageSkia& GetUserImage( content::BrowserContext* context) const OVERRIDE; - virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE; + virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; virtual void AddSessionStateObserver( @@ -107,10 +108,11 @@ class TestSessionStateDelegate : public SessionStateDelegate { // The number of users logged in. int logged_in_users_; - // The index for the activated user. - int active_user_index_; + // The activated user. + std::string activated_user_; - std::vector user_list_; + // A test user image. + gfx::ImageSkia user_image_; DISALLOW_COPY_AND_ASSIGN(TestSessionStateDelegate); }; diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index 52962ee..8ba5ba0 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -10,7 +10,7 @@ #include "ash/gpu_support_stub.h" #include "ash/media_delegate.h" #include "ash/new_window_delegate.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell/keyboard_controller_proxy_stub.h" #include "ash/shell_window_ids.h" diff --git a/ash/test/test_system_tray_delegate.cc b/ash/test/test_system_tray_delegate.cc index c4a45b9..473802d 100644 --- a/ash/test/test_system_tray_delegate.cc +++ b/ash/test/test_system_tray_delegate.cc @@ -6,7 +6,7 @@ #include -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/message_loop/message_loop.h" #include "base/time/time.h" diff --git a/ash/wm/event_client_impl.cc b/ash/wm/event_client_impl.cc index a12253c..b54e622 100644 --- a/ash/wm/event_client_impl.cc +++ b/ash/wm/event_client_impl.cc @@ -4,7 +4,7 @@ #include "ash/wm/event_client_impl.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ui/aura/window.h" diff --git a/ash/wm/gestures/shelf_gesture_handler.cc b/ash/wm/gestures/shelf_gesture_handler.cc index 6d4a01a..42b12c5 100644 --- a/ash/wm/gestures/shelf_gesture_handler.cc +++ b/ash/wm/gestures/shelf_gesture_handler.cc @@ -5,7 +5,7 @@ #include "ash/wm/gestures/shelf_gesture_handler.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_types.h" #include "ash/shelf/shelf_widget.h" diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc index f9c7dd5..ee686ed 100644 --- a/ash/wm/lock_state_controller_unittest.cc +++ b/ash/wm/lock_state_controller_unittest.cc @@ -5,7 +5,7 @@ #include "ash/wm/lock_state_controller.h" #include "ash/ash_switches.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc index ef00dfc..83a805a 100644 --- a/ash/wm/mru_window_tracker.cc +++ b/ash/wm/mru_window_tracker.cc @@ -6,7 +6,7 @@ #include -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/switchable_windows.h" diff --git a/ash/wm/overview/window_selector_controller.cc b/ash/wm/overview/window_selector_controller.cc index 4553cf3..b750e37 100644 --- a/ash/wm/overview/window_selector_controller.cc +++ b/ash/wm/overview/window_selector_controller.cc @@ -6,7 +6,7 @@ #include "ash/metrics/user_metrics_recorder.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/wm/mru_window_tracker.h" diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc index 6e96c65..f349caf 100644 --- a/ash/wm/power_button_controller.cc +++ b/ash/wm/power_button_controller.cc @@ -5,7 +5,7 @@ #include "ash/wm/power_button_controller.h" #include "ash/ash_switches.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/wm/lock_state_controller.h" diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc index 7566bed..18eccce 100644 --- a/ash/wm/stacking_controller.cc +++ b/ash/wm/stacking_controller.cc @@ -5,7 +5,7 @@ #include "ash/wm/stacking_controller.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/wm/always_on_top_controller.h" diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc index 7ee1ef4..7de5759 100644 --- a/ash/wm/system_modal_container_layout_manager.cc +++ b/ash/wm/system_modal_container_layout_manager.cc @@ -4,7 +4,7 @@ #include "ash/wm/system_modal_container_layout_manager.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/wm/system_modal_container_event_filter.h" diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc index ca79cef..568ea50 100644 --- a/ash/wm/system_modal_container_layout_manager_unittest.cc +++ b/ash/wm/system_modal_container_layout_manager_unittest.cc @@ -5,7 +5,7 @@ #include "ash/wm/system_modal_container_layout_manager.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 668f895..c817141 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -7,7 +7,7 @@ #include "ash/display/display_controller.h" #include "ash/root_window_controller.h" #include "ash/screen_util.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/wm/always_on_top_controller.h" diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc index 6629357..4af3056 100644 --- a/ash/wm/workspace/workspace_layout_manager_unittest.cc +++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc @@ -8,7 +8,7 @@ #include "ash/display/display_manager.h" #include "ash/root_window_controller.h" #include "ash/screen_util.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_observer.h" diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.cc b/chrome/browser/chromeos/accessibility/accessibility_manager.cc index 58a9d6f..b0152ab 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_manager.cc +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.cc @@ -8,7 +8,7 @@ #include "ash/autoclick/autoclick_controller.h" #include "ash/high_contrast/high_contrast_controller.h" #include "ash/metrics/user_metrics_recorder.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/sticky_keys/sticky_keys_controller.h" #include "ash/system/tray/system_tray_notifier.h" diff --git a/chrome/browser/chromeos/accessibility/accessibility_manager.h b/chrome/browser/chromeos/accessibility/accessibility_manager.h index a0aec2c..21584ee 100644 --- a/chrome/browser/chromeos/accessibility/accessibility_manager.h +++ b/chrome/browser/chromeos/accessibility/accessibility_manager.h @@ -8,7 +8,7 @@ #include #include "ash/accessibility_delegate.h" -#include "ash/session/session_state_observer.h" +#include "ash/session_state_observer.h" #include "base/callback_list.h" #include "base/memory/weak_ptr.h" #include "base/prefs/pref_change_registrar.h" diff --git a/chrome/browser/chromeos/accessibility/magnification_manager.cc b/chrome/browser/chromeos/accessibility/magnification_manager.cc index 6d2b358..60ff17b 100644 --- a/chrome/browser/chromeos/accessibility/magnification_manager.cc +++ b/chrome/browser/chromeos/accessibility/magnification_manager.cc @@ -8,7 +8,7 @@ #include "ash/magnifier/magnification_controller.h" #include "ash/magnifier/partial_magnification_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/system/tray/system_tray_notifier.h" diff --git a/chrome/browser/chromeos/dbus/printer_service_provider.cc b/chrome/browser/chromeos/dbus/printer_service_provider.cc index 7813159..0f01405 100644 --- a/chrome/browser/chromeos/dbus/printer_service_provider.cc +++ b/chrome/browser/chromeos/dbus/printer_service_provider.cc @@ -4,7 +4,7 @@ #include "chrome/browser/chromeos/dbus/printer_service_provider.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/wm/window_util.h" #include "base/bind.h" diff --git a/chrome/browser/chromeos/extensions/first_run_private_api.cc b/chrome/browser/chromeos/extensions/first_run_private_api.cc index 2828af6..9f56c96 100644 --- a/chrome/browser/chromeos/extensions/first_run_private_api.cc +++ b/chrome/browser/chromeos/extensions/first_run_private_api.cc @@ -19,11 +19,11 @@ bool FirstRunPrivateGetLocalizedStringsFunction::RunSync() { base::DictionaryValue* localized_strings = new base::DictionaryValue(); chromeos::User* user = chromeos::UserManager::Get()->GetUserByProfile(GetProfile()); - if (!user->GetGivenName().empty()) { + if (!user->given_name().empty()) { localized_strings->SetString( "greetingHeader", l10n_util::GetStringFUTF16(IDS_FIRST_RUN_GREETING_STEP_HEADER, - user->GetGivenName())); + user->given_name())); } else { localized_strings->SetString( "greetingHeader", diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index 04e60ce..a626517c4 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc @@ -13,7 +13,7 @@ #include "apps/app_window.h" #include "apps/app_window_registry.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/bind.h" #include "base/callback.h" diff --git a/chrome/browser/chromeos/login/session_login_browsertest.cc b/chrome/browser/chromeos/login/session_login_browsertest.cc index 941485a..75e5b4928 100644 --- a/chrome/browser/chromeos/login/session_login_browsertest.cc +++ b/chrome/browser/chromeos/login/session_login_browsertest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "chrome/browser/chromeos/login/login_manager_test.h" #include "chrome/browser/chromeos/login/startup_utils.h" diff --git a/chrome/browser/chromeos/login/user.cc b/chrome/browser/chromeos/login/user.cc index b1b35e3..f165e55 100644 --- a/chrome/browser/chromeos/login/user.cc +++ b/chrome/browser/chromeos/login/user.cc @@ -10,7 +10,6 @@ #include "base/threading/thread_restrictions.h" #include "chrome/browser/chromeos/login/default_user_images.h" #include "chrome/browser/chromeos/login/user_manager.h" -#include "google_apis/gaia/gaia_auth_util.h" #include "grit/theme_resources.h" #include "ui/base/resource/resource_bundle.h" @@ -169,10 +168,6 @@ void UserContext::CopyFrom(const UserContext& other) { auth_flow = other.auth_flow; } -std::string User::GetEmail() const { - return display_email(); -} - base::string16 User::GetDisplayName() const { // Fallback to the email account name in case display name haven't been set. return display_name_.empty() ? @@ -180,19 +175,6 @@ base::string16 User::GetDisplayName() const { display_name_; } -base::string16 User::GetGivenName() const { - return given_name_; -} - -const gfx::ImageSkia& User::GetImage() const { - return user_image_.image(); -} - -std::string User::GetUserID() const { - return gaia::CanonicalizeEmail(gaia::SanitizeEmail( - email())); -} - std::string User::GetAccountName(bool use_display_email) const { if (use_display_email && !display_email_.empty()) return GetUserName(display_email_); diff --git a/chrome/browser/chromeos/login/user.h b/chrome/browser/chromeos/login/user.h index 58eb1a3..e80b13b 100644 --- a/chrome/browser/chromeos/login/user.h +++ b/chrome/browser/chromeos/login/user.h @@ -8,7 +8,6 @@ #include #include -#include "ash/session/user_info.h" #include "base/basictypes.h" #include "base/strings/string16.h" #include "chrome/browser/chromeos/login/user_image.h" @@ -70,7 +69,7 @@ struct UserContext { // returned by |displayed_email()|. // Displayed emails are for use in UI only, anywhere else users must be referred // to by |email()|. -class User : public ash::UserInfo { +class User { public: // The user type. Used in a histogram; do not modify existing types. typedef enum { @@ -124,20 +123,19 @@ class User : public ash::UserInfo { // The email the user used to log in. const std::string& email() const { return email_; } - // The displayed user name. - base::string16 display_name() const { return display_name_; } + // Returns the human name to display for this user. + base::string16 GetDisplayName() const; - // ash::UserInfo - virtual std::string GetEmail() const OVERRIDE; - virtual base::string16 GetDisplayName() const OVERRIDE; - virtual base::string16 GetGivenName() const OVERRIDE; - virtual const gfx::ImageSkia& GetImage() const OVERRIDE; - virtual std::string GetUserID() const OVERRIDE; + // Returns given name of user, or empty string if given name is unknown. + const base::string16& given_name() const { return given_name_; } // Returns the account name part of the email. Use the display form of the // email if available and use_display_name == true. Otherwise use canonical. std::string GetAccountName(bool use_display_email) const; + // The image for this user. + const gfx::ImageSkia& image() const { return user_image_.image(); } + // Whether the user has a default image. bool HasDefaultImage() const; @@ -170,6 +168,9 @@ class User : public ash::UserInfo { // True if image is being loaded from file. bool image_is_loading() const { return image_is_loading_; } + // The displayed user name. + base::string16 display_name() const { return display_name_; } + // The displayed (non-canonical) user email. virtual std::string display_email() const; diff --git a/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc b/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc index 5c90708..fb02077 100644 --- a/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/user_adding_screen_browsertest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/prefs/pref_service.h" #include "chrome/browser/chromeos/login/login_display_host_impl.h" diff --git a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc index 796998b..03d3064 100644 --- a/chrome/browser/chromeos/login/user_image_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/user_image_manager_browsertest.cc @@ -362,8 +362,8 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_NonJPEGImageFromFile) { EXPECT_FALSE(user->image_is_safe_format()); // Check image dimensions. const gfx::ImageSkia& saved_image = GetDefaultImage(kFirstDefaultImageIndex); - EXPECT_EQ(saved_image.width(), user->GetImage().width()); - EXPECT_EQ(saved_image.height(), user->GetImage().height()); + EXPECT_EQ(saved_image.width(), user->image().width()); + EXPECT_EQ(saved_image.height(), user->image().height()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, NonJPEGImageFromFile) { @@ -380,8 +380,8 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, NonJPEGImageFromFile) { EXPECT_TRUE(user->image_is_safe_format()); // Check image dimensions. Images can't be compared since JPEG is lossy. const gfx::ImageSkia& saved_image = GetDefaultImage(kFirstDefaultImageIndex); - EXPECT_EQ(saved_image.width(), user->GetImage().width()); - EXPECT_EQ(saved_image.height(), user->GetImage().height()); + EXPECT_EQ(saved_image.width(), user->image().width()); + EXPECT_EQ(saved_image.height(), user->image().height()); } IN_PROC_BROWSER_TEST_F(UserImageManagerTest, PRE_SaveUserDefaultImageIndex) { @@ -403,7 +403,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, SaveUserDefaultImageIndex) { EXPECT_TRUE(user->HasDefaultImage()); EXPECT_EQ(kFirstDefaultImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(default_image, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(default_image, user->image())); ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); } @@ -432,7 +432,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, SaveUserImage) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(custom_image, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(custom_image, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex, GetUserImagePath(kTestUser1, "jpg")); @@ -470,7 +470,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, SaveUserImageFromFile) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(*custom_image, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(*custom_image, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex, GetUserImagePath(kTestUser1, "jpg")); @@ -514,7 +514,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, SaveUserImageFromProfileImage) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kProfileImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(profile_image, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(profile_image, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kProfileImageIndex, GetUserImagePath(kTestUser1, "jpg")); @@ -564,7 +564,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, EXPECT_TRUE(user->HasDefaultImage()); EXPECT_EQ(kFirstDefaultImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(default_image, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(default_image, user->image())); ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); } @@ -679,7 +679,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, SetAndClear) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex, GetUserImagePath(kTestUser1, "jpg")); @@ -707,7 +707,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, SetAndClear) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex, GetUserImagePath(kTestUser1, "jpg")); @@ -730,7 +730,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, SetAndClear) { EXPECT_TRUE(user->HasDefaultImage()); EXPECT_EQ(kFirstDefaultImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(default_image, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(default_image, user->image())); ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); } @@ -763,7 +763,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, PolicyOverridesUser) { EXPECT_TRUE(user->HasDefaultImage()); EXPECT_EQ(kFirstDefaultImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(default_image, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(default_image, user->image())); ExpectNewUserImageInfo(kTestUser1, kFirstDefaultImageIndex, base::FilePath()); // Set policy. Verify that the policy-provided user image is downloaded, set @@ -779,7 +779,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, PolicyOverridesUser) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex, GetUserImagePath(kTestUser1, "jpg")); @@ -825,7 +825,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, UserDoesNotOverridePolicy) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex, GetUserImagePath(kTestUser1, "jpg")); @@ -846,7 +846,7 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerPolicyTest, UserDoesNotOverridePolicy) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->GetImage())); + EXPECT_TRUE(test::AreImagesEqual(*policy_image_, user->image())); ExpectNewUserImageInfo(kTestUser1, User::kExternalImageIndex, GetUserImagePath(kTestUser1, "jpg")); diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc index 5ead90d..ea729c7 100644 --- a/chrome/browser/chromeos/login/user_image_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc @@ -858,7 +858,7 @@ void UserImageManagerImpl::TryToInitDownloadedProfileImage() { // user if it has not been initialized already, the user image is the // profile image and the user image has been loaded successfully. VLOG(1) << "Profile image initialized from disk."; - downloaded_profile_image_ = user->GetImage(); + downloaded_profile_image_ = user->image(); profile_image_url_ = user->image_url(); } } diff --git a/chrome/browser/chromeos/memory/oom_priority_manager.cc b/chrome/browser/chromeos/memory/oom_priority_manager.cc index a6d408c..d182ebf 100644 --- a/chrome/browser/chromeos/memory/oom_priority_manager.cc +++ b/chrome/browser/chromeos/memory/oom_priority_manager.cc @@ -9,7 +9,7 @@ #include #include "ash/multi_profile_uma.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/bind.h" #include "base/bind_helpers.h" diff --git a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc index e439529..793ccca 100644 --- a/chrome/browser/chromeos/policy/device_local_account_browsertest.cc +++ b/chrome/browser/chromeos/policy/device_local_account_browsertest.cc @@ -1040,7 +1040,7 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, UserAvatarImage) { EXPECT_FALSE(user->HasDefaultImage()); EXPECT_EQ(chromeos::User::kExternalImageIndex, user->image_index()); - EXPECT_TRUE(chromeos::test::AreImagesEqual(*policy_image, user->GetImage())); + EXPECT_TRUE(chromeos::test::AreImagesEqual(*policy_image, user->image())); const base::DictionaryValue* images_pref = g_browser_process->local_state()->GetDictionary("user_image_info"); ASSERT_TRUE(images_pref); diff --git a/chrome/browser/chromeos/profiles/profile_list_chromeos.cc b/chrome/browser/chromeos/profiles/profile_list_chromeos.cc index 5860dda..992e758 100644 --- a/chrome/browser/chromeos/profiles/profile_list_chromeos.cc +++ b/chrome/browser/chromeos/profiles/profile_list_chromeos.cc @@ -50,7 +50,7 @@ void ProfileListChromeOS::RebuildMenu() { size_t i = profile_info_->GetIndexOfProfileWithPath( ProfileHelper::GetProfilePathByUserIdHash((*it)->username_hash())); - gfx::Image icon = gfx::Image((*it)->GetImage()); + gfx::Image icon = gfx::Image((*it)->image()); if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kNewProfileManagement)) { // old avatar menu uses resized-small images diff --git a/chrome/browser/idle_chromeos.cc b/chrome/browser/idle_chromeos.cc index 62a72d4..36a33a5 100644 --- a/chrome/browser/idle_chromeos.cc +++ b/chrome/browser/idle_chromeos.cc @@ -4,7 +4,7 @@ #include "chrome/browser/idle.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/time/time.h" #include "ui/wm/core/user_activity_detector.h" diff --git a/chrome/browser/notifications/message_center_settings_controller.cc b/chrome/browser/notifications/message_center_settings_controller.cc index d92a92e..9f1e26f 100644 --- a/chrome/browser/notifications/message_center_settings_controller.cc +++ b/chrome/browser/notifications/message_center_settings_controller.cc @@ -475,12 +475,12 @@ void MessageCenterSettingsController::CreateNotifierGroupForGuestLogin() { chromeos::User* user = user_manager->GetActiveUser(); Profile* profile = user_manager->GetProfileByUser(user); DCHECK(profile); - notifier_groups_.push_back( - new message_center::ProfileNotifierGroup(gfx::Image(user->GetImage()), - user->GetDisplayName(), - user->GetDisplayName(), - 0, - profile)); + notifier_groups_.push_back(new message_center::ProfileNotifierGroup( + gfx::Image(user->image()), + user->GetDisplayName(), + user->GetDisplayName(), + 0, + profile)); FOR_EACH_OBSERVER(message_center::NotifierSettingsObserver, observers_, diff --git a/chrome/browser/ui/ash/multi_user/multi_user_context_menu_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_context_menu_chromeos.cc index 8d56f0a..84a5fd7 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_context_menu_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_context_menu_chromeos.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" #include "ash/multi_profile_uma.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/bind.h" #include "base/callback.h" @@ -87,13 +87,13 @@ scoped_ptr CreateMultiUserContextMenu(aura::Window* window) { new chromeos::MultiUserContextMenuChromeos(window); model.reset(menu); for (int user_index = 1; user_index < logged_in_users; ++user_index) { - const ash::UserInfo* user_info = delegate->GetUserInfo(user_index); - menu->AddItem(user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 - : IDC_VISIT_DESKTOP_OF_LRU_USER_3, - l10n_util::GetStringFUTF16( - IDS_VISIT_DESKTOP_OF_LRU_USER, - user_info->GetDisplayName(), - base::ASCIIToUTF16(user_info->GetEmail()))); + menu->AddItem( + user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 : + IDC_VISIT_DESKTOP_OF_LRU_USER_3, + l10n_util::GetStringFUTF16( + IDS_VISIT_DESKTOP_OF_LRU_USER, + delegate->GetUserDisplayName(user_index), + base::ASCIIToUTF16(delegate->GetUserEmail(user_index)))); } } return model.Pass(); @@ -118,11 +118,8 @@ void ExecuteVisitDesktopCommand(int command_id, aura::Window* window) { // When running the multi user mode on Chrome OS, windows can "visit" // another user's desktop. const std::string& user_id = - ash::Shell::GetInstance() - ->session_state_delegate() - ->GetUserInfo(IDC_VISIT_DESKTOP_OF_LRU_USER_2 == command_id ? 1 - : 2) - ->GetUserID(); + ash::Shell::GetInstance()->session_state_delegate()->GetUserID( + IDC_VISIT_DESKTOP_OF_LRU_USER_2 == command_id ? 1 : 2); base::Callback on_accept = base::Bind(&OnAcceptTeleportWarning, user_id, window); diff --git a/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc b/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc index aa5e7c6..2d1bc91 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_notification_blocker_chromeos_unittest.cc @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/session/session_state_delegate.h" -#include "ash/session/user_info.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/system/system_notifier.h" #include "ash/test/ash_test_base.h" @@ -65,10 +64,7 @@ class MultiUserNotificationBlockerChromeOSTest } const std::string GetDefaultUserId() { - return ash::Shell::GetInstance() - ->session_state_delegate() - ->GetUserInfo(0) - ->GetUserID(); + return ash::Shell::GetInstance()->session_state_delegate()->GetUserID(0); } const message_center::NotificationBlocker* blocker() { diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc index 93b2af1..fc269782 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager.cc @@ -10,8 +10,7 @@ #if defined(OS_CHROMEOS) #include "ash/ash_switches.h" #include "ash/multi_profile_uma.h" -#include "ash/session/session_state_delegate.h" -#include "ash/session/user_info.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" @@ -42,11 +41,8 @@ MultiUserWindowManager* MultiUserWindowManager::CreateInstance() { ash::MultiProfileUMA::SESSION_SINGLE_USER_MODE; if (!g_instance && ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { - g_instance = - new MultiUserWindowManagerChromeOS(ash::Shell::GetInstance() - ->session_state_delegate() - ->GetUserInfo(0) - ->GetUserID()); + g_instance = new MultiUserWindowManagerChromeOS( + ash::Shell::GetInstance()->session_state_delegate()->GetUserID(0)); multi_user_mode_ = MULTI_PROFILE_MODE_SEPARATED; mode = ash::MultiProfileUMA::SESSION_SEPARATE_DESKTOP_MODE; } else if (ash::Shell::GetInstance()->delegate()->IsMultiProfilesEnabled()) { diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc index 50480bcc..d1e344e4 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc @@ -9,7 +9,7 @@ #include "ash/ash_switches.h" #include "ash/multi_profile_uma.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" #include "ash/shell_delegate.h" diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h index 4812431..66a89cc 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h @@ -8,7 +8,7 @@ #include #include -#include "ash/session/session_state_observer.h" +#include "ash/session_state_observer.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc index 8dc3171..44fe75c 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ash/session/user_info.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" @@ -103,8 +102,7 @@ class MultiUserWindowManagerChromeOSTest : public AshTestBase { // manager. This function gets the current user from it and also sets it to // the multi user window manager. std::string GetAndValidateCurrentUserFromSessionStateObserver() { - const std::string& user = - session_state_delegate()->GetActiveUserInfo()->GetUserID(); + const std::string& user = session_state_delegate()->get_activated_user(); if (user != multi_user_window_manager_->GetCurrentUserForTest()) multi_user_window_manager()->ActiveUserChanged(user); return user; @@ -150,9 +148,6 @@ void MultiUserWindowManagerChromeOSTest::SetUp() { session_state_delegate_ = static_cast ( ash::Shell::GetInstance()->session_state_delegate()); - session_state_delegate_->AddUser("a"); - session_state_delegate_->AddUser("b"); - session_state_delegate_->AddUser("c"); } void MultiUserWindowManagerChromeOSTest::SetUpForThisManyWindows(int windows) { @@ -648,11 +643,11 @@ TEST_F(MultiUserWindowManagerChromeOSTest, SwitchUsersUponModalityChange) { // Making the window system modal should not change anything. MakeWindowSystemModal(window(0)); - EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID()); + EXPECT_EQ("a", session_state_delegate()->get_activated_user()); // Making the window owned by user B should switch users. multi_user_window_manager()->SetWindowOwner(window(0), "b"); - EXPECT_EQ("b", session_state_delegate()->GetActiveUserInfo()->GetUserID()); + EXPECT_EQ("b", session_state_delegate()->get_activated_user()); } // Test that a system modal dialog will not switch desktop if active user has @@ -663,11 +658,11 @@ TEST_F(MultiUserWindowManagerChromeOSTest, DontSwitchUsersUponModalityChange) { // Making the window system modal should not change anything. MakeWindowSystemModal(window(0)); - EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID()); + EXPECT_EQ("a", session_state_delegate()->get_activated_user()); // Making the window owned by user a should not switch users. multi_user_window_manager()->SetWindowOwner(window(0), "a"); - EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID()); + EXPECT_EQ("a", session_state_delegate()->get_activated_user()); } // Test that a system modal dialog will not switch if shown on correct desktop @@ -683,7 +678,7 @@ TEST_F(MultiUserWindowManagerChromeOSTest, MakeWindowSystemModal(window(0)); // Showing the window should trigger no user switch. window(0)->Show(); - EXPECT_EQ("a", session_state_delegate()->GetActiveUserInfo()->GetUserID()); + EXPECT_EQ("a", session_state_delegate()->get_activated_user()); } // Test that a system modal dialog will switch if shown on incorrect desktop but @@ -699,7 +694,7 @@ TEST_F(MultiUserWindowManagerChromeOSTest, MakeWindowSystemModal(window(0)); // Showing the window should trigger a user switch. window(0)->Show(); - EXPECT_EQ("b", session_state_delegate()->GetActiveUserInfo()->GetUserID()); + EXPECT_EQ("b", session_state_delegate()->get_activated_user()); } // Test that using the full user switch animations are working as expected. diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc index 8679a41..07997ea 100644 --- a/chrome/browser/ui/ash/session_state_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" #include "ash/multi_profile_uma.h" -#include "ash/session/session_state_observer.h" +#include "ash/session_state_observer.h" #include "base/command_line.h" #include "base/logging.h" #include "base/prefs/pref_service.h" @@ -132,21 +132,44 @@ SessionStateDelegateChromeos::GetSessionState() const { return session_state_; } -const ash::UserInfo* SessionStateDelegateChromeos::GetUserInfo( +const base::string16 SessionStateDelegateChromeos::GetUserDisplayName( ash::MultiProfileIndex index) const { DCHECK_LT(index, NumberOfLoggedInUsers()); - return chromeos::UserManager::Get()->GetLRULoggedInUsers()[index]; + return chromeos::UserManager::Get()-> + GetLRULoggedInUsers()[index]->display_name(); } -const ash::UserInfo* SessionStateDelegateChromeos::GetUserInfo( +const base::string16 SessionStateDelegateChromeos::GetUserGivenName( + ash::MultiProfileIndex index) const { + DCHECK_LT(index, NumberOfLoggedInUsers()); + return chromeos::UserManager::Get() + ->GetLRULoggedInUsers()[index] + ->given_name(); +} + +const std::string SessionStateDelegateChromeos::GetUserEmail( + ash::MultiProfileIndex index) const { + DCHECK_LT(index, NumberOfLoggedInUsers()); + return chromeos::UserManager::Get()-> + GetLRULoggedInUsers()[index]->display_email(); +} + +const std::string SessionStateDelegateChromeos::GetUserID( + ash::MultiProfileIndex index) const { + DCHECK_LT(index, NumberOfLoggedInUsers()); + return gaia::CanonicalizeEmail(gaia::SanitizeEmail( + chromeos::UserManager::Get()-> + GetLRULoggedInUsers()[index]->email())); +} + +const gfx::ImageSkia& SessionStateDelegateChromeos::GetUserImage( content::BrowserContext* context) const { DCHECK(context); return chromeos::UserManager::Get()->GetUserByProfile( - Profile::FromBrowserContext(context)); + Profile::FromBrowserContext(context))->image(); } -bool SessionStateDelegateChromeos::ShouldShowAvatar( - aura::Window* window) const { +bool SessionStateDelegateChromeos::ShouldShowAvatar(aura::Window* window) { return chrome::MultiUserWindowManager::GetInstance()-> ShouldShowAvatar(window); } diff --git a/chrome/browser/ui/ash/session_state_delegate_chromeos.h b/chrome/browser/ui/ash/session_state_delegate_chromeos.h index 2b28c0d..913462b 100644 --- a/chrome/browser/ui/ash/session_state_delegate_chromeos.h +++ b/chrome/browser/ui/ash/session_state_delegate_chromeos.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ #define CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_CHROMEOS_H_ -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/observer_list.h" @@ -41,11 +41,17 @@ class SessionStateDelegateChromeos virtual void UnlockScreen() OVERRIDE; virtual bool IsUserSessionBlocked() const OVERRIDE; virtual SessionState GetSessionState() const OVERRIDE; - virtual const ash::UserInfo* GetUserInfo( + virtual const base::string16 GetUserDisplayName( ash::MultiProfileIndex index) const OVERRIDE; - virtual const ash::UserInfo* GetUserInfo( + virtual const base::string16 GetUserGivenName( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserEmail( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserID( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const gfx::ImageSkia& GetUserImage( content::BrowserContext* context) const OVERRIDE; - virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE; + virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; virtual void AddSessionStateObserver( diff --git a/chrome/browser/ui/ash/session_state_delegate_views.cc b/chrome/browser/ui/ash/session_state_delegate_views.cc index 2be4389..e3e86b1 100644 --- a/chrome/browser/ui/ash/session_state_delegate_views.cc +++ b/chrome/browser/ui/ash/session_state_delegate_views.cc @@ -4,50 +4,15 @@ #include "chrome/browser/ui/ash/session_state_delegate_views.h" -#include "ash/session/user_info.h" #include "base/logging.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "ui/gfx/image/image_skia.h" namespace { - -class EmptyUserInfo : public ash::UserInfo { - public: - EmptyUserInfo() {} - virtual ~EmptyUserInfo() {} - - // ash::UserInfo: - virtual base::string16 GetDisplayName() const OVERRIDE { - NOTIMPLEMENTED(); - return base::UTF8ToUTF16(std::string()); - } - virtual base::string16 GetGivenName() const OVERRIDE { - NOTIMPLEMENTED(); - return base::UTF8ToUTF16(std::string()); - } - virtual std::string GetEmail() const OVERRIDE { - NOTIMPLEMENTED(); - return std::string(); - } - virtual std::string GetUserID() const OVERRIDE { - NOTIMPLEMENTED(); - return std::string(); - } - - virtual const gfx::ImageSkia& GetImage() const OVERRIDE { - NOTIMPLEMENTED(); - // To make the compiler happy. - return null_image_; - } - - private: - const gfx::ImageSkia null_image_; - - DISALLOW_COPY_AND_ASSIGN(EmptyUserInfo); -}; - -} // namespace +// This isn't really used. It is mainly here to make the compiler happy. +gfx::ImageSkia null_image; +} SessionStateDelegate::SessionStateDelegate() { } @@ -106,18 +71,38 @@ ash::SessionStateDelegate::SessionState SessionStateDelegate::GetSessionState() return SESSION_STATE_ACTIVE; } -const ash::UserInfo* SessionStateDelegate::GetUserInfo( +const base::string16 SessionStateDelegate::GetUserDisplayName( + ash::MultiProfileIndex index) const { + NOTIMPLEMENTED(); + return base::UTF8ToUTF16(""); +} + +const base::string16 SessionStateDelegate::GetUserGivenName( + ash::MultiProfileIndex index) const { + NOTIMPLEMENTED(); + return base::UTF8ToUTF16(""); +} + +const std::string SessionStateDelegate::GetUserEmail( + ash::MultiProfileIndex index) const { + NOTIMPLEMENTED(); + return ""; +} + +const std::string SessionStateDelegate::GetUserID( ash::MultiProfileIndex index) const { - return GetUserInfo(NULL); + NOTIMPLEMENTED(); + return ""; } -const ash::UserInfo* SessionStateDelegate::GetUserInfo( +const gfx::ImageSkia& SessionStateDelegate::GetUserImage( content::BrowserContext* context) const { - static const ash::UserInfo* kUserInfo = new EmptyUserInfo(); - return kUserInfo; + NOTIMPLEMENTED(); + // To make the compiler happy. + return null_image; } -bool SessionStateDelegate::ShouldShowAvatar(aura::Window* window) const { +bool SessionStateDelegate::ShouldShowAvatar(aura::Window* window) { return false; } diff --git a/chrome/browser/ui/ash/session_state_delegate_views.h b/chrome/browser/ui/ash/session_state_delegate_views.h index 717fa61..8f6ac61 100644 --- a/chrome/browser/ui/ash/session_state_delegate_views.h +++ b/chrome/browser/ui/ash/session_state_delegate_views.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_VIEWS_H_ #define CHROME_BROWSER_UI_ASH_SESSION_STATE_DELEGATE_VIEWS_H_ -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/observer_list.h" @@ -34,11 +34,17 @@ class SessionStateDelegate : public ash::SessionStateDelegate { virtual void UnlockScreen() OVERRIDE; virtual bool IsUserSessionBlocked() const OVERRIDE; virtual SessionState GetSessionState() const OVERRIDE; - virtual const ash::UserInfo* GetUserInfo( + virtual const base::string16 GetUserDisplayName( ash::MultiProfileIndex index) const OVERRIDE; - virtual const ash::UserInfo* GetUserInfo( + virtual const base::string16 GetUserGivenName( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserEmail( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const std::string GetUserID( + ash::MultiProfileIndex index) const OVERRIDE; + virtual const gfx::ImageSkia& GetUserImage( content::BrowserContext* context) const OVERRIDE; - virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE; + virtual bool ShouldShowAvatar(aura::Window* window) OVERRIDE; virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE; virtual void CycleActiveUser(CycleUser cycle_user) OVERRIDE; virtual void AddSessionStateObserver( diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc index 02eaccd..000bd67 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc @@ -14,8 +14,8 @@ #include "ash/ime/input_method_menu_item.h" #include "ash/ime/input_method_menu_manager.h" #include "ash/metrics/user_metrics_recorder.h" -#include "ash/session/session_state_delegate.h" -#include "ash/session/session_state_observer.h" +#include "ash/session_state_delegate.h" +#include "ash/session_state_observer.h" #include "ash/shell.h" #include "ash/shell_delegate.h" #include "ash/shell_window_ids.h" diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h index 378df87..8a1fc30 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h @@ -7,7 +7,7 @@ #include "apps/app_window_registry.h" #include "ash/ime/input_method_menu_manager.h" -#include "ash/session/session_state_observer.h" +#include "ash/session_state_observer.h" #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/system/tray/system_tray_notifier.h" diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index 14ee6d5..fc95256 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -61,7 +61,7 @@ #if defined(OS_CHROMEOS) #include "ash/multi_profile_uma.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" diff --git a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc index 6b858b7..b1f8062 100644 --- a/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc +++ b/chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.cc @@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" #include "ash/root_window_controller.h" -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/command_line.h" #include "base/lazy_instance.h" diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc index 4b4606c..585a12c 100644 --- a/chrome/browser/ui/views/frame/browser_frame.cc +++ b/chrome/browser/ui/views/frame/browser_frame.cc @@ -44,7 +44,7 @@ #endif #if defined(OS_CHROMEOS) -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #endif #if defined(USE_X11) diff --git a/chrome/browser/ui/views/frame/system_menu_model_builder.cc b/chrome/browser/ui/views/frame/system_menu_model_builder.cc index 44dacd8..69b63b8 100644 --- a/chrome/browser/ui/views/frame/system_menu_model_builder.cc +++ b/chrome/browser/ui/views/frame/system_menu_model_builder.cc @@ -16,8 +16,7 @@ #include "ui/base/models/simple_menu_model.h" #if defined(OS_CHROMEOS) -#include "ash/session/session_state_delegate.h" -#include "ash/session/user_info.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" @@ -152,13 +151,13 @@ void SystemMenuModelBuilder::AppendTeleportMenu(ui::SimpleMenuModel* model) { model->AddSeparator(ui::NORMAL_SEPARATOR); DCHECK(logged_in_users <= 3); for (int user_index = 1; user_index < logged_in_users; ++user_index) { - const ash::UserInfo* user_info = delegate->GetUserInfo(user_index); model->AddItem( - user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 - : IDC_VISIT_DESKTOP_OF_LRU_USER_3, - l10n_util::GetStringFUTF16(IDS_VISIT_DESKTOP_OF_LRU_USER, - user_info->GetDisplayName(), - base::ASCIIToUTF16(user_info->GetEmail()))); + user_index == 1 ? IDC_VISIT_DESKTOP_OF_LRU_USER_2 : + IDC_VISIT_DESKTOP_OF_LRU_USER_3, + l10n_util::GetStringFUTF16( + IDS_VISIT_DESKTOP_OF_LRU_USER, + delegate->GetUserDisplayName(user_index), + base::ASCIIToUTF16(delegate->GetUserEmail(user_index)))); } #endif } diff --git a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc index 554839b..2c0732e 100644 --- a/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/change_picture_options_handler.cc @@ -269,13 +269,13 @@ void ChangePictureOptionsHandler::SendSelectedImage() { switch (previous_image_index_) { case User::kExternalImageIndex: { // User has image from camera/file, record it and add to the image list. - previous_image_ = user->GetImage(); + previous_image_ = user->image(); SendOldImage(webui::GetBitmapDataUrl(*previous_image_.bitmap())); break; } case User::kProfileImageIndex: { // User has his/her Profile image as the current image. - SendProfileImage(user->GetImage(), true); + SendProfileImage(user->image(), true); break; } default: { diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc index 5771c5e..4e3e98a 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc @@ -6,7 +6,7 @@ #include -#include "ash/session/session_state_delegate.h" +#include "ash/session_state_delegate.h" #include "ash/shell.h" #include "base/bind.h" #include "base/prefs/pref_change_registrar.h" -- cgit v1.1