summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authordzhioev <dzhioev@chromium.org>2015-11-17 15:31:12 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-17 23:31:54 +0000
commitd7b496824a8db45080762037d3861970215dcfa6 (patch)
treeaee426771be8fe0c04f9d8bf8c21411f041d02ce /ash
parent6a590850d9b0dc35c9cebbebc07f82f4a3fae960 (diff)
downloadchromium_src-d7b496824a8db45080762037d3861970215dcfa6.zip
chromium_src-d7b496824a8db45080762037d3861970215dcfa6.tar.gz
chromium_src-d7b496824a8db45080762037d3861970215dcfa6.tar.bz2
Remove Chrome OS "Mirror" UI. Part 1.
Removed ash/ part of the Mirror UI. Sign-in part will be removed in a following CL. BUG=546731 Review URL: https://codereview.chromium.org/1448283002 Cr-Commit-Position: refs/heads/master@{#360201}
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp6
-rw-r--r--ash/ash_strings.grd12
-rw-r--r--ash/resources/ash_resources.grd5
-rw-r--r--ash/resources/default_100_percent/cros/status/status_add_profile.pngbin298 -> 0 bytes
-rw-r--r--ash/resources/default_100_percent/cros/status/status_add_profile_hover.pngbin303 -> 0 bytes
-rw-r--r--ash/resources/default_100_percent/cros/status/status_remove_account.pngbin142 -> 0 bytes
-rw-r--r--ash/resources/default_100_percent/cros/status/status_remove_account_hover.pngbin240 -> 0 bytes
-rw-r--r--ash/resources/default_200_percent/cros/status/status_add_profile.pngbin547 -> 0 bytes
-rw-r--r--ash/resources/default_200_percent/cros/status/status_add_profile_hover.pngbin562 -> 0 bytes
-rw-r--r--ash/resources/default_200_percent/cros/status/status_remove_account.pngbin212 -> 0 bytes
-rw-r--r--ash/resources/default_200_percent/cros/status/status_remove_account_hover.pngbin365 -> 0 bytes
-rw-r--r--ash/shell/shell_delegate_impl.cc4
-rw-r--r--ash/shell/shell_delegate_impl.h1
-rw-r--r--ash/shell_delegate.h3
-rw-r--r--ash/system/tray/system_tray_delegate.cc5
-rw-r--r--ash/system/tray/system_tray_delegate.h8
-rw-r--r--ash/system/user/accounts_detailed_view.cc230
-rw-r--r--ash/system/user/accounts_detailed_view.h69
-rw-r--r--ash/system/user/config.cc36
-rw-r--r--ash/system/user/config.h22
-rw-r--r--ash/system/user/tray_user.cc19
-rw-r--r--ash/system/user/tray_user.h2
-rw-r--r--ash/system/user/user_accounts_delegate.cc27
-rw-r--r--ash/system/user/user_accounts_delegate.h66
-rw-r--r--ash/system/user/user_card_view.cc7
-rw-r--r--ash/system/user/user_view.cc85
-rw-r--r--ash/system/user/user_view.h6
-rw-r--r--ash/test/test_shell_delegate.cc4
-rw-r--r--ash/test/test_shell_delegate.h1
29 files changed, 30 insertions, 588 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 01e9d9e..bf78086 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -460,12 +460,8 @@
'system/tray_accessibility.h',
'system/tray_update.cc',
'system/tray_update.h',
- 'system/user/accounts_detailed_view.cc',
- 'system/user/accounts_detailed_view.h',
'system/user/button_from_view.cc',
'system/user/button_from_view.h',
- 'system/user/config.cc',
- 'system/user/config.h',
'system/user/login_status.cc',
'system/user/login_status.h',
'system/user/rounded_image_view.cc',
@@ -475,8 +471,6 @@
'system/user/tray_user_separator.cc',
'system/user/tray_user_separator.h',
'system/user/update_observer.h',
- 'system/user/user_accounts_delegate.cc',
- 'system/user/user_accounts_delegate.h',
'system/user/user_card_view.cc',
'system/user/user_card_view.h',
'system/user/user_observer.h',
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd
index 0bec772..c3ff0c4 100644
--- a/ash/ash_strings.grd
+++ b/ash/ash_strings.grd
@@ -391,18 +391,6 @@ Press Ctrl+Alt+Z to disable.
<message name="IDS_ASH_MOD3_KEY" desc="Name of ISOLevel5 (mod3) key name. Shouldn't be translated in many languages actually. This name should be lower case.">
mod3
</message>
- <message name="IDS_ASH_STATUS_TRAY_ACCOUNTS_TITLE" desc="The footer label of the menu which is used to manage the profile accounts.">
- Manage accounts
- </message>
- <message name="IDS_ASH_STATUS_TRAY_ACCOUNT_LIST_TITLE" desc="The title label for the menu which holds the accounts list.">
- Accounts
- </message>
- <message name="IDS_ASH_STATUS_TRAY_PRIMARY_ACCOUNT_LABEL" desc="The primary user account label in the accounts menu.">
- <ph name="PRIMARY_ACCOUNT">$1<ex>test@gmail.com</ex></ph> (primary)
- </message>
- <message name="IDS_ASH_STATUS_TRAY_ADD_ACCOUNT_LABEL" desc="The label of the button which launches the dialog to add a new account.">
- Add an account for <ph name="GIVEN_NAME">$1<ex>Jenn</ex></ph>
- </message>
<!-- Overview Mode -->
<message name="IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME" desc="The accessible name for the Overview button in the system tray.">
diff --git a/ash/resources/ash_resources.grd b/ash/resources/ash_resources.grd
index 5722f8e..c160d5e 100644
--- a/ash/resources/ash_resources.grd
+++ b/ash/resources/ash_resources.grd
@@ -180,11 +180,6 @@
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_VOLUME_LEVELS" file="cros/status/status_volume_dark.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_VOLUME_MUTE" file="cros/status/status_volume_mute.png" />
- <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_ADD_PROFILE" file="cros/status/status_add_profile.png" />
- <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_ADD_PROFILE_HOVER" file="cros/status/status_add_profile_hover.png" />
- <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_REMOVE_ACCOUNT" file="cros/status/status_remove_account.png" />
- <structure type="chrome_scaled_image" name="IDR_AURA_UBER_TRAY_REMOVE_ACCOUNT_HOVER" file="cros/status/status_remove_account_hover.png" />
-
<structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_CONTROL_BACKGROUND_H" file="common/window_control_background_hover.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_CONTROL_BACKGROUND_P" file="common/window_control_background_pressed.png" />
<structure type="chrome_scaled_image" name="IDR_AURA_WINDOW_CONTROL_ICON_BACK" file="common/window_control_icon_back.png" />
diff --git a/ash/resources/default_100_percent/cros/status/status_add_profile.png b/ash/resources/default_100_percent/cros/status/status_add_profile.png
deleted file mode 100644
index 70629ee..0000000
--- a/ash/resources/default_100_percent/cros/status/status_add_profile.png
+++ /dev/null
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_add_profile_hover.png b/ash/resources/default_100_percent/cros/status/status_add_profile_hover.png
deleted file mode 100644
index 1fec151..0000000
--- a/ash/resources/default_100_percent/cros/status/status_add_profile_hover.png
+++ /dev/null
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_remove_account.png b/ash/resources/default_100_percent/cros/status/status_remove_account.png
deleted file mode 100644
index b97900b..0000000
--- a/ash/resources/default_100_percent/cros/status/status_remove_account.png
+++ /dev/null
Binary files differ
diff --git a/ash/resources/default_100_percent/cros/status/status_remove_account_hover.png b/ash/resources/default_100_percent/cros/status/status_remove_account_hover.png
deleted file mode 100644
index ba402d5..0000000
--- a/ash/resources/default_100_percent/cros/status/status_remove_account_hover.png
+++ /dev/null
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_add_profile.png b/ash/resources/default_200_percent/cros/status/status_add_profile.png
deleted file mode 100644
index 59071f8..0000000
--- a/ash/resources/default_200_percent/cros/status/status_add_profile.png
+++ /dev/null
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_add_profile_hover.png b/ash/resources/default_200_percent/cros/status/status_add_profile_hover.png
deleted file mode 100644
index 5486370..0000000
--- a/ash/resources/default_200_percent/cros/status/status_add_profile_hover.png
+++ /dev/null
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_remove_account.png b/ash/resources/default_200_percent/cros/status/status_remove_account.png
deleted file mode 100644
index 8a0822c..0000000
--- a/ash/resources/default_200_percent/cros/status/status_remove_account.png
+++ /dev/null
Binary files differ
diff --git a/ash/resources/default_200_percent/cros/status/status_remove_account_hover.png b/ash/resources/default_200_percent/cros/status/status_remove_account_hover.png
deleted file mode 100644
index b2ef4b6..0000000
--- a/ash/resources/default_200_percent/cros/status/status_remove_account_hover.png
+++ /dev/null
Binary files differ
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc
index 5677b9b..38fbe8e 100644
--- a/ash/shell/shell_delegate_impl.cc
+++ b/ash/shell/shell_delegate_impl.cc
@@ -165,10 +165,6 @@ bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
return false;
}
-bool ShellDelegateImpl::IsMultiAccountEnabled() const {
- return false;
-}
-
bool ShellDelegateImpl::CanShowWindowForUser(aura::Window* window) const {
return true;
}
diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h
index acab404..65577c0 100644
--- a/ash/shell/shell_delegate_impl.h
+++ b/ash/shell/shell_delegate_impl.h
@@ -31,7 +31,6 @@ class ShellDelegateImpl : public ash::ShellDelegate {
bool IsIncognitoAllowed() const override;
bool IsMultiProfilesEnabled() const override;
bool IsRunningInForcedAppMode() const override;
- bool IsMultiAccountEnabled() const override;
bool CanShowWindowForUser(aura::Window* window) const override;
bool IsForceMaximizeOnFirstRun() const override;
void PreInit() override;
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h
index e378e77..c66eb15 100644
--- a/ash/shell_delegate.h
+++ b/ash/shell_delegate.h
@@ -84,9 +84,6 @@ class ASH_EXPORT ShellDelegate {
// Returns true if we're running in forced app mode.
virtual bool IsRunningInForcedAppMode() const = 0;
- // Returns true if multi account is enabled.
- virtual bool IsMultiAccountEnabled() const = 0;
-
// Returns true if |window| can be shown for the delegate's concept of current
// user.
virtual bool CanShowWindowForUser(aura::Window* window) const = 0;
diff --git a/ash/system/tray/system_tray_delegate.cc b/ash/system/tray/system_tray_delegate.cc
index 15e7304..a5d49b5 100644
--- a/ash/system/tray/system_tray_delegate.cc
+++ b/ash/system/tray/system_tray_delegate.cc
@@ -258,11 +258,6 @@ bool SystemTrayDelegate::IsSearchKeyMappedToCapsLock() {
return false;
}
-tray::UserAccountsDelegate* SystemTrayDelegate::GetUserAccountsDelegate(
- const AccountId& account_id) {
- return nullptr;
-}
-
void SystemTrayDelegate::AddCustodianInfoTrayObserver(
CustodianInfoTrayObserver* observer) {
}
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index 9b05286..3f84f4b 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -106,10 +106,6 @@ class VPNDelegate;
using RebootOnShutdownCallback = base::Callback<void(bool)>;
-namespace tray {
-class UserAccountsDelegate;
-} // namespace tray
-
// SystemTrayDelegate is intended for delegating tasks in the System Tray to the
// application (e.g. Chrome). These tasks should be limited to application
// (browser) specific tasks. For non application specific tasks, where possible,
@@ -314,10 +310,6 @@ class ASH_EXPORT SystemTrayDelegate {
// Returns true when the Search key is configured to be treated as Caps Lock.
virtual bool IsSearchKeyMappedToCapsLock();
- // Returns accounts delegate for given user. May return nullptr.
- virtual tray::UserAccountsDelegate* GetUserAccountsDelegate(
- const AccountId& account_id);
-
// Adding observers that are notified when supervised info is being changed.
virtual void AddCustodianInfoTrayObserver(
CustodianInfoTrayObserver* observer);
diff --git a/ash/system/user/accounts_detailed_view.cc b/ash/system/user/accounts_detailed_view.cc
deleted file mode 100644
index fe41fd3..0000000
--- a/ash/system/user/accounts_detailed_view.cc
+++ /dev/null
@@ -1,230 +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.
-
-#include "ash/system/user/accounts_detailed_view.h"
-
-#include <vector>
-
-#include "ash/multi_profile_uma.h"
-#include "ash/shell.h"
-#include "ash/system/tray/fixed_sized_scroll_view.h"
-#include "ash/system/tray/hover_highlight_view.h"
-#include "ash/system/tray/system_tray.h"
-#include "ash/system/tray/system_tray_delegate.h"
-#include "ash/system/tray/tray_constants.h"
-#include "ash/system/tray/tray_popup_header_button.h"
-#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/ash_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/views/border.h"
-#include "ui/views/layout/box_layout.h"
-#include "ui/views/layout/grid_layout.h"
-
-namespace ash {
-namespace tray {
-
-namespace {
-
-const int kAccountsViewVerticalPadding = 12;
-const int kPrimaryAccountColumnSetID = 0;
-const int kSecondaryAccountColumnSetID = 1;
-const int kPaddingBetweenAccounts = 20;
-
-} // namespace
-
-AccountsDetailedView::AccountsDetailedView(TrayUser* owner,
- user::LoginStatus login_status,
- UserAccountsDelegate* delegate)
- : TrayDetailsView(owner),
- delegate_(delegate),
- account_list_(nullptr),
- add_account_button_(nullptr),
- add_user_button_(nullptr) {
- DCHECK(delegate_);
- delegate_->AddObserver(this);
- AddHeader(login_status);
- CreateScrollableList();
- AddAccountList();
- AddAddAccountButton();
- AddFooter();
-}
-
-AccountsDetailedView::~AccountsDetailedView() {
- delegate_->RemoveObserver(this);
-}
-
-void AccountsDetailedView::OnViewClicked(views::View* sender) {
- if (sender == footer()->content())
- TransitionToDefaultView();
- else if (sender == add_account_button_)
- delegate_->LaunchAddAccountDialog();
- else
- NOTREACHED();
-}
-
-void AccountsDetailedView::ButtonPressed(views::Button* sender,
- const ui::Event& event) {
- std::map<views::View*, std::string>::iterator it =
- delete_button_to_account_id_.find(sender);
- if (it != delete_button_to_account_id_.end()) {
- delegate_->DeleteAccount(it->second);
- } else if (add_user_button_ && add_user_button_ == sender) {
- MultiProfileUMA::RecordSigninUser(MultiProfileUMA::SIGNIN_USER_BY_TRAY);
- Shell::GetInstance()->system_tray_delegate()->ShowUserLogin();
- owner()->system_tray()->CloseSystemBubble();
- } else {
- NOTREACHED();
- }
-}
-
-void AccountsDetailedView::AccountListChanged() { UpdateAccountList(); }
-
-void AccountsDetailedView::AddHeader(user::LoginStatus login_status) {
- views::View* user_view_container = new views::View;
- user_view_container->SetLayoutManager(
- new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
- user_view_container->SetBorder(
- views::Border::CreateSolidSidedBorder(0, 0, 1, 0, kBorderLightColor));
- user_view_container->AddChildView(
- new tray::UserView(owner(), login_status, 0, true));
- AddChildView(user_view_container);
-}
-
-void AccountsDetailedView::AddAccountList() {
- scroll_content()->SetBorder(
- views::Border::CreateEmptyBorder(kAccountsViewVerticalPadding,
- kTrayPopupPaddingHorizontal,
- kAccountsViewVerticalPadding,
- kTrayPopupPaddingHorizontal));
- views::Label* account_list_title = new views::Label(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCOUNT_LIST_TITLE));
- account_list_title->SetEnabledColor(SkColorSetARGB(0x7f, 0, 0, 0));
- account_list_title->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- scroll_content()->AddChildView(account_list_title);
- account_list_ = new views::View();
- UpdateAccountList();
- scroll_content()->AddChildView(account_list_);
-}
-
-void AccountsDetailedView::AddAddAccountButton() {
- SessionStateDelegate* session_state_delegate =
- Shell::GetInstance()->session_state_delegate();
- HoverHighlightView* add_account_button = new HoverHighlightView(this);
- 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();
- if (user_name.empty())
- user_name = base::ASCIIToUTF16(user_info->GetEmail());
- add_account_button->AddLabel(
- l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_ADD_ACCOUNT_LABEL,
- user_name),
- gfx::ALIGN_CENTER, false /* highlight */);
- AddChildView(add_account_button);
- add_account_button_ = add_account_button;
-}
-
-void AccountsDetailedView::AddFooter() {
- CreateSpecialRow(IDS_ASH_STATUS_TRAY_ACCOUNTS_TITLE, this);
- if (!IsMultiProfileSupportedAndUserActive())
- return;
- TrayPopupHeaderButton* add_user_button =
- new TrayPopupHeaderButton(this,
- IDR_AURA_UBER_TRAY_ADD_PROFILE,
- IDR_AURA_UBER_TRAY_ADD_PROFILE,
- IDR_AURA_UBER_TRAY_ADD_PROFILE_HOVER,
- IDR_AURA_UBER_TRAY_ADD_PROFILE_HOVER,
- IDS_ASH_STATUS_TRAY_SIGN_IN_ANOTHER_ACCOUNT);
- add_user_button->SetTooltipText(
- l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SIGN_IN_ANOTHER_ACCOUNT));
- footer()->AddButton(add_user_button);
- add_user_button_ = add_user_button;
-}
-
-void AccountsDetailedView::UpdateAccountList() {
- // Clear existing view.
- delete_button_to_account_id_.clear();
- account_list_->RemoveAllChildViews(true);
-
- // Configuring layout manager.
- views::GridLayout* layout = new views::GridLayout(account_list_);
- account_list_->SetLayoutManager(layout);
- views::ColumnSet* primary_account_row =
- layout->AddColumnSet(kPrimaryAccountColumnSetID);
- primary_account_row->AddColumn(views::GridLayout::LEADING,
- views::GridLayout::CENTER,
- 1.0,
- views::GridLayout::USE_PREF,
- 0,
- 0);
- views::ColumnSet* secondary_account_row =
- layout->AddColumnSet(kSecondaryAccountColumnSetID);
- secondary_account_row->AddColumn(views::GridLayout::FILL,
- views::GridLayout::CENTER,
- 1.0,
- views::GridLayout::USE_PREF,
- 0,
- 0);
- secondary_account_row->AddPaddingColumn(0.0, kTrayPopupPaddingBetweenItems);
- secondary_account_row->AddColumn(views::GridLayout::FILL,
- views::GridLayout::CENTER,
- 0.0,
- views::GridLayout::USE_PREF,
- 0,
- 0);
-
- // Adding primary account.
- layout->AddPaddingRow(0.0, kPaddingBetweenAccounts);
- layout->StartRow(0.0, kPrimaryAccountColumnSetID);
- const std::string& primary_account = delegate_->GetPrimaryAccountId();
- views::Label* primary_account_label =
- new views::Label(l10n_util::GetStringFUTF16(
- IDS_ASH_STATUS_TRAY_PRIMARY_ACCOUNT_LABEL,
- base::ASCIIToUTF16(
- delegate_->GetAccountDisplayName(primary_account))));
- layout->AddView(primary_account_label);
-
- // Adding secondary accounts.
- const std::vector<std::string>& secondary_accounts =
- delegate_->GetSecondaryAccountIds();
- for (size_t i = 0; i < secondary_accounts.size(); ++i) {
- layout->AddPaddingRow(0.0, kPaddingBetweenAccounts);
- layout->StartRow(0.0, kSecondaryAccountColumnSetID);
- const std::string& account_id = secondary_accounts[i];
- views::Label* account_label = new views::Label(
- base::ASCIIToUTF16(delegate_->GetAccountDisplayName(account_id)));
- account_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- layout->AddView(account_label);
- views::View* delete_button = CreateDeleteButton();
- delete_button_to_account_id_[delete_button] = account_id;
- layout->AddView(delete_button);
- }
-
- scroll_content()->SizeToPreferredSize();
- scroller()->Layout();
-}
-
-views::View* AccountsDetailedView::CreateDeleteButton() {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- views::ImageButton* delete_button = new views::ImageButton(this);
- delete_button->SetImage(
- views::Button::STATE_NORMAL,
- rb.GetImageNamed(IDR_AURA_UBER_TRAY_REMOVE_ACCOUNT).ToImageSkia());
- delete_button->SetImage(
- views::Button::STATE_HOVERED,
- rb.GetImageNamed(IDR_AURA_UBER_TRAY_REMOVE_ACCOUNT_HOVER).ToImageSkia());
- delete_button->SetImage(
- views::Button::STATE_PRESSED,
- rb.GetImageNamed(IDR_AURA_UBER_TRAY_REMOVE_ACCOUNT_HOVER).ToImageSkia());
- return delete_button;
-}
-
-} // namespace tray
-} // namespace ash
diff --git a/ash/system/user/accounts_detailed_view.h b/ash/system/user/accounts_detailed_view.h
deleted file mode 100644
index 8b6f8f3..0000000
--- a/ash/system/user/accounts_detailed_view.h
+++ /dev/null
@@ -1,69 +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_SYSTEM_USER_ACCOUNTS_DETAILED_VIEW_H_
-#define ASH_SYSTEM_USER_ACCOUNTS_DETAILED_VIEW_H_
-
-#include <map>
-#include <string>
-
-#include "ash/system/tray/tray_details_view.h"
-#include "ash/system/tray/view_click_listener.h"
-#include "ash/system/user/login_status.h"
-#include "ash/system/user/user_accounts_delegate.h"
-#include "ash/system/user/user_view.h"
-#include "base/macros.h"
-#include "ui/views/controls/button/button.h"
-#include "ui/views/controls/label.h"
-
-namespace ash {
-
-class TrayUser;
-
-namespace tray {
-
-// This detailed view appears after a click on the primary user's card when the
-// new account managment is enabled.
-class AccountsDetailedView : public TrayDetailsView,
- public ViewClickListener,
- public views::ButtonListener,
- public ash::tray::UserAccountsDelegate::Observer {
- public:
- AccountsDetailedView(TrayUser* owner,
- user::LoginStatus login_status,
- UserAccountsDelegate* delegate);
- ~AccountsDetailedView() override;
-
- private:
- // Overridden from ViewClickListener.
- void OnViewClicked(views::View* sender) override;
-
- // Overridden from views::ButtonListener.
- void ButtonPressed(views::Button* sender, const ui::Event& event) override;
-
- // Overridden from ash::tray::UserAccountsDelegate::Observer.
- void AccountListChanged() override;
-
- void AddHeader(user::LoginStatus login_status);
- void AddAccountList();
- void AddAddAccountButton();
- void AddFooter();
-
- void UpdateAccountList();
-
- views::View* CreateDeleteButton();
-
- UserAccountsDelegate* delegate_;
- views::View* account_list_;
- views::View* add_account_button_;
- views::View* add_user_button_;
- std::map<views::View*, std::string> delete_button_to_account_id_;
-
- DISALLOW_COPY_AND_ASSIGN(AccountsDetailedView);
-};
-
-} // namespace tray
-} // namespace ash
-
-#endif // ASH_SYSTEM_USER_ACCOUNTS_DETAILED_VIEW_H_
diff --git a/ash/system/user/config.cc b/ash/system/user/config.cc
deleted file mode 100644
index 1ea6d32..0000000
--- a/ash/system/user/config.cc
+++ /dev/null
@@ -1,36 +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.
-
-#include "ash/system/user/config.h"
-
-#include "ash/session/session_state_delegate.h"
-#include "ash/shell.h"
-#include "ash/shell_delegate.h"
-
-namespace ash {
-namespace tray {
-
-namespace {
-
-// Returns true if session is blocked by e.g. the login screen.
-bool IsUserSessionBlocked() {
- return Shell::GetInstance()
- ->session_state_delegate()
- ->IsUserSessionBlocked();
-}
-
-} // namespace
-
-bool IsMultiProfileSupportedAndUserActive() {
- return Shell::GetInstance()->delegate()->IsMultiProfilesEnabled() &&
- !IsUserSessionBlocked();
-}
-
-bool IsMultiAccountSupportedAndUserActive() {
- return Shell::GetInstance()->delegate()->IsMultiAccountEnabled() &&
- !IsUserSessionBlocked();
-}
-
-} // namespace tray
-} // namespace ash
diff --git a/ash/system/user/config.h b/ash/system/user/config.h
deleted file mode 100644
index c3676e4..0000000
--- a/ash/system/user/config.h
+++ /dev/null
@@ -1,22 +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_SYSTEM_USER_CONFIG_H_
-#define ASH_SYSTEM_USER_CONFIG_H_
-
-#include "base/macros.h"
-
-namespace ash {
-namespace tray {
-
-// Returns true when multi profile is supported and user is active.
-bool IsMultiProfileSupportedAndUserActive();
-
-// Returns true when multi account is supported and user is active.
-bool IsMultiAccountSupportedAndUserActive();
-
-} // namespace tray
-} // namespace ash
-
-#endif // ASH_SYSTEM_USER_CONFIG_H_
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index e947641..7d988e0 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -15,7 +15,6 @@
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_item_view.h"
#include "ash/system/tray/tray_utils.h"
-#include "ash/system/user/accounts_detailed_view.h"
#include "ash/system/user/rounded_image_view.h"
#include "ash/system/user/user_view.h"
#include "base/logging.h"
@@ -108,23 +107,10 @@ views::View* TrayUser::CreateDefaultView(user::LoginStatus status) {
if (user_index_ >= logged_in_users)
return nullptr;
- user_ = new tray::UserView(this, status, user_index_, false);
+ user_ = new tray::UserView(this, status, user_index_);
return user_;
}
-views::View* TrayUser::CreateDetailedView(user::LoginStatus status) {
- const AccountId account_id = Shell::GetInstance()
- ->session_state_delegate()
- ->GetUserInfo(0)
- ->GetAccountId();
- tray::UserAccountsDelegate* delegate =
- Shell::GetInstance()->system_tray_delegate()->GetUserAccountsDelegate(
- account_id);
- if (!delegate)
- return nullptr;
- return new tray::AccountsDetailedView(this, status, delegate);
-}
-
void TrayUser::DestroyTrayView() {
layout_view_ = nullptr;
avatar_ = nullptr;
@@ -135,9 +121,6 @@ void TrayUser::DestroyDefaultView() {
user_ = nullptr;
}
-void TrayUser::DestroyDetailedView() {
-}
-
void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) {
// Only the active user is represented in the tray.
if (!layout_view_)
diff --git a/ash/system/user/tray_user.h b/ash/system/user/tray_user.h
index f13005c..bbbb5a7 100644
--- a/ash/system/user/tray_user.h
+++ b/ash/system/user/tray_user.h
@@ -65,10 +65,8 @@ class ASH_EXPORT TrayUser : public SystemTrayItem,
// Overridden from SystemTrayItem.
views::View* CreateTrayView(user::LoginStatus status) override;
views::View* CreateDefaultView(user::LoginStatus status) override;
- views::View* CreateDetailedView(user::LoginStatus status) override;
void DestroyTrayView() override;
void DestroyDefaultView() override;
- void DestroyDetailedView() override;
void UpdateAfterLoginStatusChange(user::LoginStatus status) override;
void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override;
diff --git a/ash/system/user/user_accounts_delegate.cc b/ash/system/user/user_accounts_delegate.cc
deleted file mode 100644
index 2e29a9b..0000000
--- a/ash/system/user/user_accounts_delegate.cc
+++ /dev/null
@@ -1,27 +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.
-
-#include "ash/system/user/user_accounts_delegate.h"
-
-namespace ash {
-namespace tray {
-
-UserAccountsDelegate::UserAccountsDelegate() {}
-
-UserAccountsDelegate::~UserAccountsDelegate() {}
-
-void UserAccountsDelegate::AddObserver(Observer* observer) {
- observers_.AddObserver(observer);
-}
-
-void UserAccountsDelegate::RemoveObserver(Observer* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void UserAccountsDelegate::NotifyAccountListChanged() {
- FOR_EACH_OBSERVER(Observer, observers_, AccountListChanged());
-}
-
-} // namespace tray
-} // namespace ash
diff --git a/ash/system/user/user_accounts_delegate.h b/ash/system/user/user_accounts_delegate.h
deleted file mode 100644
index e25e291..0000000
--- a/ash/system/user/user_accounts_delegate.h
+++ /dev/null
@@ -1,66 +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_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_
-#define ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_
-
-#include <string>
-#include <vector>
-
-#include "ash/ash_export.h"
-#include "base/macros.h"
-#include "base/observer_list.h"
-
-namespace ash {
-namespace tray {
-
-class ASH_EXPORT UserAccountsDelegate {
- public:
- class Observer {
- public:
- Observer() {}
- virtual ~Observer() {}
-
- // Called when the account list of user has been changed.
- virtual void AccountListChanged() = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Observer);
- };
-
- UserAccountsDelegate();
- virtual ~UserAccountsDelegate();
-
- void AddObserver(Observer* observer);
- void RemoveObserver(Observer* observer);
-
- // Returns the user's primary account's ID.
- virtual std::string GetPrimaryAccountId() = 0;
-
- // Returns a list of the user's secondary accounts' IDs.
- virtual std::vector<std::string> GetSecondaryAccountIds() = 0;
-
- // Returns display name for given |account_id|.
- virtual std::string GetAccountDisplayName(const std::string& account_id) = 0;
-
- // Deletes given |account_id| from the list of user's account. Passing
- // |account_id| that is not from list is no-op.
- virtual void DeleteAccount(const std::string& account_id) = 0;
-
- // Launches a dialog which lets the user add a new account.
- virtual void LaunchAddAccountDialog() = 0;
-
- protected:
- void NotifyAccountListChanged();
-
- private:
- base::ObserverList<Observer> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(UserAccountsDelegate);
-};
-
-} // namespace tray
-} // namespace ash
-
-#endif // ASH_SYSTEM_USER_USER_ACCOUNTS_DELEGATE_H_
diff --git a/ash/system/user/user_card_view.cc b/ash/system/user/user_card_view.cc
index 6ce0c18..a0eaeeb 100644
--- a/ash/system/user/user_card_view.cc
+++ b/ash/system/user/user_card_view.cc
@@ -13,7 +13,6 @@
#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_utils.h"
-#include "ash/system/user/config.h"
#include "ash/system/user/rounded_image_view.h"
#include "base/i18n/rtl.h"
#include "base/memory/scoped_vector.h"
@@ -375,9 +374,6 @@ void UserCardView::AddUserContent(user::LoginStatus login_status,
login_status == user::LOGGED_IN_GUEST
? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL)
: delegate->GetUserInfo(user_index)->GetDisplayName();
- if (user_name_string.empty() && IsMultiAccountSupportedAndUserActive())
- user_name_string =
- base::ASCIIToUTF16(delegate->GetUserInfo(user_index)->GetEmail());
if (!user_name_string.empty()) {
user_name = new views::Label(user_name_string);
user_name->SetHorizontalAlignment(gfx::ALIGN_LEFT);
@@ -385,8 +381,7 @@ void UserCardView::AddUserContent(user::LoginStatus login_status,
}
views::Label* user_email = NULL;
- if (login_status != user::LOGGED_IN_GUEST &&
- (user_index || !IsMultiAccountSupportedAndUserActive())) {
+ if (login_status != user::LOGGED_IN_GUEST) {
SystemTrayDelegate* tray_delegate =
Shell::GetInstance()->system_tray_delegate();
base::string16 user_email_string =
diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc
index 1b65bd5..4d1b538 100644
--- a/ash/system/user/user_view.cc
+++ b/ash/system/user/user_view.cc
@@ -16,7 +16,6 @@
#include "ash/system/tray/tray_popup_label_button.h"
#include "ash/system/tray/tray_popup_label_button_border.h"
#include "ash/system/user/button_from_view.h"
-#include "ash/system/user/config.h"
#include "ash/system/user/rounded_image_view.h"
#include "ash/system/user/user_card_view.h"
#include "components/signin/core/account_id/account_id.h"
@@ -81,24 +80,11 @@ void SwitchUser(ash::UserIndex user_index) {
delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetAccountId());
}
-class LogoutButton : public TrayPopupLabelButton {
- public:
- // If |placeholder| is true, button is used as placeholder. That means that
- // button is inactive and is not painted, but consume the same ammount of
- // space, as if it was painted.
- LogoutButton(views::ButtonListener* listener,
- const base::string16& text,
- bool placeholder)
- : TrayPopupLabelButton(listener, text), placeholder_(placeholder) {
- SetVisible(!placeholder_);
- }
-
- ~LogoutButton() override {}
-
- private:
- bool placeholder_;
- DISALLOW_COPY_AND_ASSIGN(LogoutButton);
-};
+bool IsMultiProfileSupportedAndUserActive() {
+ auto* shell = Shell::GetInstance();
+ return shell->delegate()->IsMultiProfilesEnabled() &&
+ !shell->session_state_delegate()->IsUserSessionBlocked();
+}
class UserViewMouseWatcherHost : public views::MouseWatcherHost {
public:
@@ -194,15 +180,13 @@ void AddUserView::AddContent() {
UserView::UserView(SystemTrayItem* owner,
user::LoginStatus login,
- UserIndex index,
- bool for_detailed_view)
+ UserIndex index)
: user_index_(index),
user_card_view_(NULL),
owner_(owner),
is_user_card_button_(false),
logout_button_(NULL),
add_user_enabled_(true),
- for_detailed_view_(for_detailed_view),
focus_manager_(NULL) {
CHECK_NE(user::LOGGED_IN_NONE, login);
if (!index) {
@@ -273,10 +257,9 @@ void UserView::Layout() {
// Give the remaining space to the user card.
gfx::Rect user_card_area = contents_area;
int remaining_width = contents_area.width() - logout_area.width();
- if (IsMultiProfileSupportedAndUserActive() ||
- IsMultiAccountSupportedAndUserActive()) {
- // In multiprofile/multiaccount case |user_card_view_| and
- // |logout_button_| have to have the same height.
+ if (IsMultiProfileSupportedAndUserActive()) {
+ // In multiprofile case |user_card_view_| and |logout_button_| have to
+ // have the same height.
int y = std::min(user_card_area.y(), logout_area.y());
int height = std::max(user_card_area.height(), logout_area.height());
logout_area.set_y(y);
@@ -314,9 +297,6 @@ void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) {
ash::UMA_STATUS_AREA_SIGN_OUT);
RemoveAddUserMenuOption();
Shell::GetInstance()->system_tray_delegate()->SignOut();
- } else if (sender == user_card_view_ && !user_index_ &&
- IsMultiAccountSupportedAndUserActive()) {
- owner_->TransitionDetailedView();
} else if (sender == user_card_view_ &&
IsMultiProfileSupportedAndUserActive()) {
if (!user_index_) {
@@ -352,8 +332,7 @@ void UserView::OnDidChangeFocus(View* focused_before, View* focused_now) {
void UserView::AddLogoutButton(user::LoginStatus login) {
const base::string16 title =
user::GetLocalizedSignOutStringForStatus(login, true);
- TrayPopupLabelButton* logout_button =
- new LogoutButton(this, title, for_detailed_view_);
+ auto* logout_button = new TrayPopupLabelButton(this, title);
logout_button->SetAccessibleName(title);
logout_button_ = logout_button;
// In public account mode, the logout button border has a custom color.
@@ -392,11 +371,10 @@ void UserView::AddUserCard(user::LoginStatus login) {
if (logout_button_)
max_card_width -= logout_button_->GetPreferredSize().width();
user_card_view_ = new UserCardView(login, max_card_width, user_index_);
- // The entry is clickable when no system modal dialog is open and one of the
- // multi user options is active.
+ // The entry is clickable when no system modal dialog is open and the multi
+ // profile option is active.
bool clickable = !Shell::GetInstance()->IsSystemModalWindowOpen() &&
- (IsMultiProfileSupportedAndUserActive() ||
- IsMultiAccountSupportedAndUserActive());
+ IsMultiProfileSupportedAndUserActive();
if (clickable) {
// To allow the border to start before the icon, reduce the size before and
// add an inset to the icon to get the spacing.
@@ -411,30 +389,21 @@ void UserView::AddUserCard(user::LoginStatus login) {
}
gfx::Insets insets = gfx::Insets(1, 1, 1, 1);
views::View* contents_view = user_card_view_;
- ButtonFromView* button = NULL;
- if (!for_detailed_view_) {
- if (user_index_) {
- // Since the activation border needs to be drawn around the tile, we
- // have to put the tile into another view which fills the menu panel,
- // but keeping the offsets of the content.
- contents_view = new views::View();
- contents_view->SetBorder(views::Border::CreateEmptyBorder(
- kTrayPopupUserCardVerticalPadding,
- kTrayPopupPaddingHorizontal,
- kTrayPopupUserCardVerticalPadding,
- kTrayPopupPaddingHorizontal));
- contents_view->SetLayoutManager(new views::FillLayout());
- SetBorder(views::Border::CreateEmptyBorder(0, 0, 0, 0));
- contents_view->AddChildView(user_card_view_);
- insets = gfx::Insets(1, 1, 1, 3);
- }
- button = new ButtonFromView(contents_view, this, !user_index_, insets);
- } else {
- // We want user card for detailed view to have exactly the same look
- // as user card for default view. That's why we wrap it in a button
- // without click listener and special hover behavior.
- button = new ButtonFromView(contents_view, NULL, false, insets);
+ if (user_index_) {
+ // Since the activation border needs to be drawn around the tile, we
+ // have to put the tile into another view which fills the menu panel,
+ // but keeping the offsets of the content.
+ contents_view = new views::View();
+ contents_view->SetBorder(views::Border::CreateEmptyBorder(
+ kTrayPopupUserCardVerticalPadding, kTrayPopupPaddingHorizontal,
+ kTrayPopupUserCardVerticalPadding, kTrayPopupPaddingHorizontal));
+ contents_view->SetLayoutManager(new views::FillLayout());
+ SetBorder(views::Border::CreateEmptyBorder(0, 0, 0, 0));
+ contents_view->AddChildView(user_card_view_);
+ insets = gfx::Insets(1, 1, 1, 3);
}
+ auto* button =
+ new ButtonFromView(contents_view, this, !user_index_, insets);
// A click on the button should not trigger a focus change.
button->set_request_focus_on_press(false);
user_card_view_ = button;
diff --git a/ash/system/user/user_view.h b/ash/system/user/user_view.h
index 562ce67..b258d03 100644
--- a/ash/system/user/user_view.h
+++ b/ash/system/user/user_view.h
@@ -40,8 +40,7 @@ class UserView : public views::View,
public:
UserView(SystemTrayItem* owner,
ash::user::LoginStatus login,
- UserIndex index,
- bool for_detailed_view);
+ UserIndex index);
~UserView() override;
// Overridden from MouseWatcherListener:
@@ -93,9 +92,6 @@ class UserView : public views::View,
// False when the add user panel is visible but not activatable.
bool add_user_enabled_;
- // True if this view will be used inside detailed view.
- bool for_detailed_view_;
-
// The mouse watcher which takes care of out of window hover events.
scoped_ptr<views::MouseWatcher> mouse_watcher_;
diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc
index d601cde..08c7219 100644
--- a/ash/test/test_shell_delegate.cc
+++ b/ash/test/test_shell_delegate.cc
@@ -108,10 +108,6 @@ bool TestShellDelegate::IsRunningInForcedAppMode() const {
return false;
}
-bool TestShellDelegate::IsMultiAccountEnabled() const {
- return false;
-}
-
bool TestShellDelegate::CanShowWindowForUser(aura::Window* window) const {
return true;
}
diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h
index 3bf7cef..2377fdf 100644
--- a/ash/test/test_shell_delegate.h
+++ b/ash/test/test_shell_delegate.h
@@ -35,7 +35,6 @@ class TestShellDelegate : public ShellDelegate {
bool IsIncognitoAllowed() const override;
bool IsMultiProfilesEnabled() const override;
bool IsRunningInForcedAppMode() const override;
- bool IsMultiAccountEnabled() const override;
bool CanShowWindowForUser(aura::Window* window) const override;
bool IsForceMaximizeOnFirstRun() const override;
void PreInit() override;