summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authornkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 23:48:30 +0000
committernkostylev@chromium.org <nkostylev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 23:48:30 +0000
commitd66eac44cda6b48f70bf6ef06adc72c8638b39bf (patch)
treef0f59465b920eb98baf01219d4d36df47822644a /ash
parentdae74c14f2a4543d900e0e5e37632ed111a08ffe (diff)
downloadchromium_src-d66eac44cda6b48f70bf6ef06adc72c8638b39bf.zip
chromium_src-d66eac44cda6b48f70bf6ef06adc72c8638b39bf.tar.gz
chromium_src-d66eac44cda6b48f70bf6ef06adc72c8638b39bf.tar.bz2
Move UserInfo to user_manager.
Since user_manager::UserInfo is used on non-chromeos ash implementation, defined part of user_manager component that is included on cross-platform ash. BUG=387614 Review URL: https://codereview.chromium.org/379803004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283087 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/DEPS1
-rw-r--r--ash/ash.gyp7
-rw-r--r--ash/frame/frame_util.cc2
-rw-r--r--ash/session/session_state_delegate.h10
-rw-r--r--ash/session/user_info.h45
-rw-r--r--ash/shell/shell_delegate_impl.cc37
-rw-r--r--ash/system/user/accounts_detailed_view.cc5
-rw-r--r--ash/system/user/tray_user.cc2
-rw-r--r--ash/system/user/tray_user_unittest.cc6
-rw-r--r--ash/system/user/user_card_view.cc2
-rw-r--r--ash/system/user/user_view.cc2
-rw-r--r--ash/test/test_session_state_delegate.cc11
-rw-r--r--ash/test/test_session_state_delegate.h6
13 files changed, 38 insertions, 98 deletions
diff --git a/ash/DEPS b/ash/DEPS
index a92f2d1..6b1fa86 100644
--- a/ash/DEPS
+++ b/ash/DEPS
@@ -2,6 +2,7 @@ include_rules = [
"+device/bluetooth",
"+cc/debug",
"+chromeos",
+ "+components/user_manager",
"+gpu/config",
"+grit/ash_resources.h",
"+grit/ash_strings.h",
diff --git a/ash/ash.gyp b/ash/ash.gyp
index d5f413d..593c47e 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -16,6 +16,7 @@
'../base/base.gyp:base_i18n',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../cc/cc.gyp:cc',
+ '../components/components.gyp:user_manager',
'../content/content.gyp:content_browser',
'../media/media.gyp:media',
'../net/net.gyp:net',
@@ -229,7 +230,6 @@
'session/session_state_delegate.h',
'session/session_state_observer.cc',
'session/session_state_observer.h',
- 'session/user_info.h',
'shelf/app_list_button.cc',
'shelf/app_list_button.h',
'shelf/app_list_shelf_item_delegate.cc',
@@ -879,6 +879,7 @@
'../base/base.gyp:base',
'../base/base.gyp:test_support_base',
'../chrome/chrome_resources.gyp:packed_resources',
+ '../components/components.gyp:user_manager',
'../content/content.gyp:content_browser',
'../content/content_shell_and_tests.gyp:test_support_content',
'../skia/skia.gyp:skia',
@@ -1178,6 +1179,7 @@
'type': 'executable',
'dependencies': [
'ash_shell_lib',
+ '../components/components.gyp:user_manager',
],
'sources': [
'shell/shell_main.cc',
@@ -1195,7 +1197,7 @@
}],
['chromeos==1', {
'dependencies': [
- '../device/bluetooth/bluetooth.gyp:device_bluetooth',
+ '../device/bluetooth/bluetooth.gyp:device_bluetooth',
],
}],
],
@@ -1205,6 +1207,7 @@
'type': 'executable',
'dependencies': [
'../base/base.gyp:test_support_base',
+ '../components/components.gyp:user_manager',
'../content/content_shell_and_tests.gyp:test_support_content',
'../skia/skia.gyp:skia',
'../testing/gtest.gyp:gtest',
diff --git a/ash/frame/frame_util.cc b/ash/frame/frame_util.cc
index fd26783..c4b1be9 100644
--- a/ash/frame/frame_util.cc
+++ b/ash/frame/frame_util.cc
@@ -5,8 +5,8 @@
#include "ash/frame/frame_util.h"
#include "ash/session/session_state_delegate.h"
-#include "ash/session/user_info.h"
#include "ash/shell.h"
+#include "components/user_manager/user_info.h"
#include "grit/ash_resources.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/image/image_skia.h"
diff --git a/ash/session/session_state_delegate.h b/ash/session/session_state_delegate.h
index 78777a0..89c1ff8 100644
--- a/ash/session/session_state_delegate.h
+++ b/ash/session/session_state_delegate.h
@@ -23,10 +23,13 @@ namespace gfx {
class ImageSkia;
} // namespace gfx
+namespace user_manager {
+class UserInfo;
+} // namespace user_manager
+
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.
@@ -113,10 +116,11 @@ class ASH_EXPORT SessionStateDelegate {
// 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;
+ virtual const user_manager::UserInfo* GetUserInfo(
+ MultiProfileIndex index) const = 0;
// Gets the avatar image for the user associated with the |context|.
- virtual const UserInfo* GetUserInfo(
+ virtual const user_manager::UserInfo* GetUserInfo(
content::BrowserContext* context) const = 0;
// Whether or not the window's title should show the avatar.
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 <string>
-
-#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/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 289d769..6261e1e 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -11,7 +11,6 @@
#include "ash/media_delegate.h"
#include "ash/new_window_delegate.h"
#include "ash/session/session_state_delegate.h"
-#include "ash/session/user_info.h"
#include "ash/shell/context_menu.h"
#include "ash/shell/example_factory.h"
#include "ash/shell/keyboard_controller_proxy_stub.h"
@@ -22,6 +21,7 @@
#include "ash/wm/window_state.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/user_manager/user_info_impl.h"
#include "ui/aura/window.h"
#include "ui/wm/core/input_method_event_filter.h"
@@ -71,36 +71,10 @@ class MediaDelegateImpl : public MediaDelegate {
DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
};
-class UserInfoImpl : public UserInfo {
- public:
- UserInfoImpl() {}
- virtual ~UserInfoImpl() {}
-
- // 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(UserInfoImpl);
-};
-
class SessionStateDelegateImpl : public SessionStateDelegate {
public:
SessionStateDelegateImpl()
- : screen_locked_(false), user_info_(new UserInfoImpl()) {}
+ : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {}
virtual ~SessionStateDelegateImpl() {}
@@ -141,10 +115,11 @@ class SessionStateDelegateImpl : public SessionStateDelegate {
return IsActiveUserSessionStarted() ? SESSION_STATE_ACTIVE
: SESSION_STATE_LOGIN_PRIMARY;
}
- virtual const UserInfo* GetUserInfo(MultiProfileIndex index) const OVERRIDE {
+ virtual const user_manager::UserInfo* GetUserInfo(
+ MultiProfileIndex index) const OVERRIDE {
return user_info_.get();
}
- virtual const UserInfo* GetUserInfo(
+ virtual const user_manager::UserInfo* GetUserInfo(
content::BrowserContext* context) const OVERRIDE {
return user_info_.get();
}
@@ -162,7 +137,7 @@ class SessionStateDelegateImpl : public SessionStateDelegate {
bool screen_locked_;
// A pseudo user info.
- scoped_ptr<UserInfo> user_info_;
+ scoped_ptr<user_manager::UserInfo> user_info_;
DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl);
};
diff --git a/ash/system/user/accounts_detailed_view.cc b/ash/system/user/accounts_detailed_view.cc
index 5b78a76..393f8d5 100644
--- a/ash/system/user/accounts_detailed_view.cc
+++ b/ash/system/user/accounts_detailed_view.cc
@@ -7,7 +7,6 @@
#include <vector>
#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"
@@ -18,6 +17,7 @@
#include "ash/system/user/config.h"
#include "ash/system/user/tray_user.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/user_manager/user_info.h"
#include "grit/ash_resources.h"
#include "grit/ui_resources.h"
#include "ui/base/resource/resource_bundle.h"
@@ -120,7 +120,8 @@ 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);
+ const user_manager::UserInfo* user_info =
+ session_state_delegate->GetUserInfo(0);
base::string16 user_name = user_info->GetGivenName();
if (user_name.empty())
user_name = user_info->GetDisplayName();
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index cb5676c..91dce33 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -7,7 +7,6 @@
#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/shelf/shelf_layout_manager.h"
#include "ash/shell_delegate.h"
#include "ash/system/tray/system_tray.h"
@@ -20,6 +19,7 @@
#include "ash/system/user/user_view.h"
#include "base/logging.h"
#include "base/strings/string16.h"
+#include "components/user_manager/user_info.h"
#include "grit/ash_strings.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/ash/system/user/tray_user_unittest.cc b/ash/system/user/tray_user_unittest.cc
index 0135054..25eae95 100644
--- a/ash/system/user/tray_user_unittest.cc
+++ b/ash/system/user/tray_user_unittest.cc
@@ -5,7 +5,6 @@
#include <vector>
#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"
@@ -16,6 +15,7 @@
#include "ash/test/ash_test_base.h"
#include "ash/test/test_session_state_delegate.h"
#include "ash/test/test_shell_delegate.h"
+#include "components/user_manager/user_info.h"
#include "ui/aura/test/event_generator.h"
#include "ui/gfx/animation/animation_container_element.h"
#include "ui/views/view.h"
@@ -237,8 +237,8 @@ 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);
+ const user_manager::UserInfo* active_user = delegate()->GetActiveUserInfo();
+ const user_manager::UserInfo* second_user = delegate()->GetUserInfo(1);
EXPECT_EQ(active_user->GetUserID(), second_user->GetUserID());
// Since the name is capitalized, the email should be different then the
// user_id.
diff --git a/ash/system/user/user_card_view.cc b/ash/system/user/user_card_view.cc
index 11cff83..84d52b6 100644
--- a/ash/system/user/user_card_view.cc
+++ b/ash/system/user/user_card_view.cc
@@ -8,7 +8,6 @@
#include <vector>
#include "ash/session/session_state_delegate.h"
-#include "ash/session/user_info.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/system_tray_notifier.h"
@@ -20,6 +19,7 @@
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "components/user_manager/user_info.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc
index 18e8ee8..0d66217 100644
--- a/ash/system/user/user_view.cc
+++ b/ash/system/user/user_view.cc
@@ -9,7 +9,6 @@
#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/shell.h"
#include "ash/shell_delegate.h"
#include "ash/system/tray/system_tray.h"
@@ -20,6 +19,7 @@
#include "ash/system/user/config.h"
#include "ash/system/user/rounded_image_view.h"
#include "ash/system/user/user_card_view.h"
+#include "components/user_manager/user_info.h"
#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h"
diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc
index 8831b58..4c76143 100644
--- a/ash/test/test_session_state_delegate.cc
+++ b/ash/test/test_session_state_delegate.cc
@@ -7,12 +7,12 @@
#include <algorithm>
#include <string>
-#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 "components/user_manager/user_info.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace ash {
@@ -29,7 +29,7 @@ std::string GetUserIDFromEmail(const std::string& email) {
} // namespace
-class MockUserInfo : public UserInfo {
+class MockUserInfo : public user_manager::UserInfo {
public:
explicit MockUserInfo(const std::string& id) : email_(id) {}
virtual ~MockUserInfo() {}
@@ -89,7 +89,8 @@ void TestSessionStateDelegate::AddUser(const std::string user_id) {
user_list_.push_back(new MockUserInfo(user_id));
}
-const UserInfo* TestSessionStateDelegate::GetActiveUserInfo() const {
+const user_manager::UserInfo* TestSessionStateDelegate::GetActiveUserInfo()
+ const {
return user_list_[active_user_index_];
}
@@ -192,13 +193,13 @@ void TestSessionStateDelegate::SetUserImage(
user_list_[active_user_index_]->SetUserImage(user_image);
}
-const UserInfo* TestSessionStateDelegate::GetUserInfo(
+const user_manager::UserInfo* TestSessionStateDelegate::GetUserInfo(
MultiProfileIndex index) const {
int max = static_cast<int>(user_list_.size());
return user_list_[index < max ? index : max - 1];
}
-const UserInfo* TestSessionStateDelegate::GetUserInfo(
+const user_manager::UserInfo* TestSessionStateDelegate::GetUserInfo(
content::BrowserContext* context) const {
return user_list_[active_user_index_];
}
diff --git a/ash/test/test_session_state_delegate.h b/ash/test/test_session_state_delegate.h
index 5616eec..478c340 100644
--- a/ash/test/test_session_state_delegate.h
+++ b/ash/test/test_session_state_delegate.h
@@ -24,7 +24,7 @@ class TestSessionStateDelegate : public SessionStateDelegate {
void set_logged_in_users(int users) { logged_in_users_ = users; }
void AddUser(const std::string user_id);
- const UserInfo* GetActiveUserInfo() const;
+ const user_manager::UserInfo* GetActiveUserInfo() const;
// SessionStateDelegate:
virtual content::BrowserContext* GetBrowserContextByIndex(
@@ -41,9 +41,9 @@ class TestSessionStateDelegate : public SessionStateDelegate {
virtual void UnlockScreen() OVERRIDE;
virtual bool IsUserSessionBlocked() const OVERRIDE;
virtual SessionState GetSessionState() const OVERRIDE;
- virtual const UserInfo* GetUserInfo(
+ virtual const user_manager::UserInfo* GetUserInfo(
ash::MultiProfileIndex index) const OVERRIDE;
- virtual const UserInfo* GetUserInfo(
+ virtual const user_manager::UserInfo* GetUserInfo(
content::BrowserContext* context) const OVERRIDE;
virtual bool ShouldShowAvatar(aura::Window* window) const OVERRIDE;
virtual void SwitchActiveUser(const std::string& user_id) OVERRIDE;