Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / ash / system / chromeos / enterprise / tray_enterprise.cc
blobd2d2d77e8c9a511f20cf82a6a46e7ab4924691a5
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/system/chromeos/enterprise/tray_enterprise.h"
7 #include "ash/shell.h"
8 #include "ash/system/chromeos/label_tray_view.h"
9 #include "ash/system/tray/system_tray_notifier.h"
10 #include "ash/system/user/login_status.h"
11 #include "base/logging.h"
12 #include "grit/ash_resources.h"
14 namespace ash {
16 TrayEnterprise::TrayEnterprise(SystemTray* system_tray)
17 : SystemTrayItem(system_tray),
18 tray_view_(NULL) {
19 Shell::GetInstance()->system_tray_notifier()->
20 AddEnterpriseDomainObserver(this);
23 TrayEnterprise::~TrayEnterprise() {
24 Shell::GetInstance()->system_tray_notifier()->
25 RemoveEnterpriseDomainObserver(this);
28 void TrayEnterprise::UpdateEnterpriseMessage() {
29 base::string16 message = Shell::GetInstance()->system_tray_delegate()->
30 GetEnterpriseMessage();
31 if (tray_view_)
32 tray_view_->SetMessage(message);
35 views::View* TrayEnterprise::CreateDefaultView(user::LoginStatus status) {
36 CHECK(tray_view_ == NULL);
37 // For public accounts, enterprise ownership is indicated in the user details
38 // instead.
39 if (status == ash::user::LOGGED_IN_PUBLIC)
40 return NULL;
41 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_ENTERPRISE);
42 UpdateEnterpriseMessage();
43 return tray_view_;
46 void TrayEnterprise::DestroyDefaultView() {
47 tray_view_ = NULL;
50 void TrayEnterprise::OnEnterpriseDomainChanged() {
51 UpdateEnterpriseMessage();
54 void TrayEnterprise::OnViewClicked(views::View* sender) {
55 Shell::GetInstance()->system_tray_delegate()->ShowEnterpriseInfo();
58 } // namespace ash