Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: ash/common/system/chromeos/enterprise/tray_enterprise.cc

Issue 2715463004: Remove non-MD code from LabelTrayView (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/chromeos/enterprise/tray_enterprise.h" 5 #include "ash/common/system/chromeos/enterprise/tray_enterprise.h"
6 6
7 #include "ash/common/login_status.h" 7 #include "ash/common/login_status.h"
8 #include "ash/common/system/tray/label_tray_view.h" 8 #include "ash/common/system/tray/label_tray_view.h"
9 #include "ash/common/system/tray/system_tray_delegate.h" 9 #include "ash/common/system/tray/system_tray_delegate.h"
10 #include "ash/common/system/tray/system_tray_notifier.h" 10 #include "ash/common/system/tray/system_tray_notifier.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ash/resources/grit/ash_resources.h" 12 #include "ash/resources/vector_icons/vector_icons.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 15
16 namespace ash { 16 namespace ash {
17 17
18 TrayEnterprise::TrayEnterprise(SystemTray* system_tray) 18 TrayEnterprise::TrayEnterprise(SystemTray* system_tray)
19 : SystemTrayItem(system_tray, UMA_ENTERPRISE), tray_view_(nullptr) { 19 : SystemTrayItem(system_tray, UMA_ENTERPRISE), tray_view_(nullptr) {
20 WmShell::Get()->system_tray_notifier()->AddEnterpriseDomainObserver(this); 20 WmShell::Get()->system_tray_notifier()->AddEnterpriseDomainObserver(this);
21 } 21 }
22 22
23 TrayEnterprise::~TrayEnterprise() { 23 TrayEnterprise::~TrayEnterprise() {
24 WmShell::Get()->system_tray_notifier()->RemoveEnterpriseDomainObserver(this); 24 WmShell::Get()->system_tray_notifier()->RemoveEnterpriseDomainObserver(this);
25 } 25 }
26 26
27 void TrayEnterprise::UpdateEnterpriseMessage() { 27 void TrayEnterprise::UpdateEnterpriseMessage() {
28 base::string16 message = 28 base::string16 message =
29 WmShell::Get()->system_tray_delegate()->GetEnterpriseMessage(); 29 WmShell::Get()->system_tray_delegate()->GetEnterpriseMessage();
30 if (tray_view_) 30 if (tray_view_)
31 tray_view_->SetMessage(message); 31 tray_view_->SetMessage(message);
32 } 32 }
33 33
34 views::View* TrayEnterprise::CreateDefaultView(LoginStatus status) { 34 views::View* TrayEnterprise::CreateDefaultView(LoginStatus status) {
35 CHECK(tray_view_ == NULL); 35 CHECK(!tray_view_);
Evan Stade 2017/02/22 21:43:46 nit: DCHECK
tdanderson 2017/03/30 14:51:39 Done.
36 // For public accounts, enterprise ownership is indicated in the user details 36 // For public accounts, enterprise ownership is indicated in the user details
37 // instead. 37 // instead.
38 if (status == LoginStatus::PUBLIC) 38 if (status == LoginStatus::PUBLIC)
39 return NULL; 39 return nullptr;
40 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_ENTERPRISE); 40 tray_view_ = new LabelTrayView(this, kSystemMenuBusinessIcon);
41 UpdateEnterpriseMessage(); 41 UpdateEnterpriseMessage();
42 return tray_view_; 42 return tray_view_;
43 } 43 }
44 44
45 void TrayEnterprise::DestroyDefaultView() { 45 void TrayEnterprise::DestroyDefaultView() {
Evan Stade 2017/02/22 21:43:46 aside: it seems like this should be called Default
tdanderson 2017/03/30 14:51:39 Yes, agreed. Filed https://bugs.chromium.org/p/chr
46 tray_view_ = NULL; 46 tray_view_ = nullptr;
47 } 47 }
48 48
49 void TrayEnterprise::OnEnterpriseDomainChanged() { 49 void TrayEnterprise::OnEnterpriseDomainChanged() {
50 UpdateEnterpriseMessage(); 50 UpdateEnterpriseMessage();
51 } 51 }
52 52
53 void TrayEnterprise::OnViewClicked(views::View* sender) { 53 void TrayEnterprise::OnViewClicked(views::View* sender) {
54 WmShell::Get()->system_tray_delegate()->ShowEnterpriseInfo(); 54 WmShell::Get()->system_tray_delegate()->ShowEnterpriseInfo();
55 } 55 }
56 56
57 } // namespace ash 57 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698