| Index: ash/system/chromeos/enterprise/tray_enterprise.cc
|
| diff --git a/ash/system/chromeos/enterprise/tray_enterprise.cc b/ash/system/chromeos/enterprise/tray_enterprise.cc
|
| index b31673857a75348c9d9095f9d6da86b52a18ac77..05ff799283e04272d9a4514a8e00cc8a7e6cc5fc 100644
|
| --- a/ash/system/chromeos/enterprise/tray_enterprise.cc
|
| +++ b/ash/system/chromeos/enterprise/tray_enterprise.cc
|
| @@ -4,78 +4,18 @@
|
|
|
| #include "ash/system/chromeos/enterprise/tray_enterprise.h"
|
|
|
| -#include "ash/system/tray/hover_highlight_view.h"
|
| +#include "ash/system/chromeos/label_tray_view.h"
|
| #include "ash/system/tray/system_tray_notifier.h"
|
| -#include "ash/system/tray/tray_constants.h"
|
| -#include "ash/system/tray/tray_views.h"
|
| #include "ash/system/user/login_status.h"
|
| #include "base/logging.h"
|
| #include "grit/ash_resources.h"
|
| -#include "ui/base/resource/resource_bundle.h"
|
| -#include "ui/gfx/font.h"
|
| -#include "ui/views/controls/label.h"
|
| -#include "ui/views/layout/fill_layout.h"
|
|
|
| namespace ash {
|
| namespace internal {
|
|
|
| -class EnterpriseDefaultView : public views::View {
|
| - public:
|
| - explicit EnterpriseDefaultView(ViewClickListener* click_listener);
|
| - virtual ~EnterpriseDefaultView();
|
| - void SetMessage(const base::string16& message);
|
| - private:
|
| - views::View* CreateChildView(const base::string16& message) const;
|
| -
|
| - ViewClickListener* click_listener_;
|
| - base::string16 message_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(EnterpriseDefaultView);
|
| -};
|
| -
|
| -EnterpriseDefaultView::EnterpriseDefaultView(
|
| - ViewClickListener* click_listener)
|
| - : click_listener_(click_listener) {
|
| - SetLayoutManager(new views::FillLayout());
|
| - SetVisible(false);
|
| -}
|
| -
|
| -EnterpriseDefaultView::~EnterpriseDefaultView() {
|
| -}
|
| -
|
| -void EnterpriseDefaultView::SetMessage(const base::string16& message) {
|
| - if (message_ == message)
|
| - return;
|
| -
|
| - message_ = message;
|
| - RemoveAllChildViews(true);
|
| - if (!message_.empty()) {
|
| - AddChildView(CreateChildView(message_));
|
| - SetVisible(true);
|
| - } else {
|
| - SetVisible(false);
|
| - }
|
| -}
|
| -
|
| -views::View* EnterpriseDefaultView::CreateChildView(
|
| - const base::string16& message) const {
|
| - ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
|
| - const gfx::ImageSkia* icon =
|
| - rb.GetImageSkiaNamed(IDR_AURA_UBER_TRAY_ENTERPRISE_DARK);
|
| - HoverHighlightView* child = new HoverHighlightView(click_listener_);
|
| - child->AddIconAndLabel(*icon, message, gfx::Font::NORMAL);
|
| - child->text_label()->SetMultiLine(true);
|
| - child->text_label()->SetAllowCharacterBreak(true);
|
| - child->set_border(views::Border::CreateEmptyBorder(0,
|
| - kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingHorizontal));
|
| - child->SetExpandable(true);
|
| - child->SetVisible(true);
|
| - return child;
|
| -}
|
| -
|
| TrayEnterprise::TrayEnterprise(SystemTray* system_tray)
|
| : SystemTrayItem(system_tray),
|
| - default_view_(NULL) {
|
| + tray_view_(NULL) {
|
| Shell::GetInstance()->system_tray_notifier()->
|
| AddEnterpriseDomainObserver(this);
|
| }
|
| @@ -88,23 +28,23 @@ TrayEnterprise::~TrayEnterprise() {
|
| void TrayEnterprise::UpdateEnterpriseMessage() {
|
| base::string16 message = Shell::GetInstance()->system_tray_delegate()->
|
| GetEnterpriseMessage();
|
| - if (default_view_)
|
| - default_view_->SetMessage(message);
|
| + if (tray_view_)
|
| + tray_view_->SetMessage(message);
|
| }
|
|
|
| views::View* TrayEnterprise::CreateDefaultView(user::LoginStatus status) {
|
| - CHECK(default_view_ == NULL);
|
| + CHECK(tray_view_ == NULL);
|
| // For public accounts, enterprise ownership is indicated in the user details
|
| // instead.
|
| if (status == ash::user::LOGGED_IN_PUBLIC)
|
| return NULL;
|
| - default_view_ = new EnterpriseDefaultView(this);
|
| + tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_ENTERPRISE_DARK);
|
| UpdateEnterpriseMessage();
|
| - return default_view_;
|
| + return tray_view_;
|
| }
|
|
|
| void TrayEnterprise::DestroyDefaultView() {
|
| - default_view_ = NULL;
|
| + tray_view_ = NULL;
|
| }
|
|
|
| void TrayEnterprise::OnEnterpriseDomainChanged() {
|
|
|