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

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

Issue 2058173002: mash: Move SystemTrayDelegate ownership to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 4 years, 6 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/system/chromeos/enterprise/tray_enterprise.h" 5 #include "ash/system/chromeos/enterprise/tray_enterprise.h"
6 6
7 #include "ash/common/system/tray/system_tray_delegate.h" 7 #include "ash/common/system/tray/system_tray_delegate.h"
8 #include "ash/common/wm_shell.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "ash/system/chromeos/label_tray_view.h" 10 #include "ash/system/chromeos/label_tray_view.h"
10 #include "ash/system/tray/system_tray_notifier.h" 11 #include "ash/system/tray/system_tray_notifier.h"
11 #include "ash/system/user/login_status.h" 12 #include "ash/system/user/login_status.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
14 #include "grit/ash_resources.h" 15 #include "grit/ash_resources.h"
15 16
16 namespace ash { 17 namespace ash {
17 18
18 TrayEnterprise::TrayEnterprise(SystemTray* system_tray) 19 TrayEnterprise::TrayEnterprise(SystemTray* system_tray)
19 : SystemTrayItem(system_tray), 20 : SystemTrayItem(system_tray),
20 tray_view_(NULL) { 21 tray_view_(NULL) {
21 Shell::GetInstance()->system_tray_notifier()-> 22 Shell::GetInstance()->system_tray_notifier()->
22 AddEnterpriseDomainObserver(this); 23 AddEnterpriseDomainObserver(this);
23 } 24 }
24 25
25 TrayEnterprise::~TrayEnterprise() { 26 TrayEnterprise::~TrayEnterprise() {
26 Shell::GetInstance()->system_tray_notifier()-> 27 Shell::GetInstance()->system_tray_notifier()->
27 RemoveEnterpriseDomainObserver(this); 28 RemoveEnterpriseDomainObserver(this);
28 } 29 }
29 30
30 void TrayEnterprise::UpdateEnterpriseMessage() { 31 void TrayEnterprise::UpdateEnterpriseMessage() {
31 base::string16 message = Shell::GetInstance()->system_tray_delegate()-> 32 base::string16 message =
32 GetEnterpriseMessage(); 33 WmShell::Get()->system_tray_delegate()->GetEnterpriseMessage();
33 if (tray_view_) 34 if (tray_view_)
34 tray_view_->SetMessage(message); 35 tray_view_->SetMessage(message);
35 } 36 }
36 37
37 views::View* TrayEnterprise::CreateDefaultView(LoginStatus status) { 38 views::View* TrayEnterprise::CreateDefaultView(LoginStatus status) {
38 CHECK(tray_view_ == NULL); 39 CHECK(tray_view_ == NULL);
39 // For public accounts, enterprise ownership is indicated in the user details 40 // For public accounts, enterprise ownership is indicated in the user details
40 // instead. 41 // instead.
41 if (status == LoginStatus::PUBLIC) 42 if (status == LoginStatus::PUBLIC)
42 return NULL; 43 return NULL;
43 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_ENTERPRISE); 44 tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_ENTERPRISE);
44 UpdateEnterpriseMessage(); 45 UpdateEnterpriseMessage();
45 return tray_view_; 46 return tray_view_;
46 } 47 }
47 48
48 void TrayEnterprise::DestroyDefaultView() { 49 void TrayEnterprise::DestroyDefaultView() {
49 tray_view_ = NULL; 50 tray_view_ = NULL;
50 } 51 }
51 52
52 void TrayEnterprise::OnEnterpriseDomainChanged() { 53 void TrayEnterprise::OnEnterpriseDomainChanged() {
53 UpdateEnterpriseMessage(); 54 UpdateEnterpriseMessage();
54 } 55 }
55 56
56 void TrayEnterprise::OnViewClicked(views::View* sender) { 57 void TrayEnterprise::OnViewClicked(views::View* sender) {
57 Shell::GetInstance()->system_tray_delegate()->ShowEnterpriseInfo(); 58 WmShell::Get()->system_tray_delegate()->ShowEnterpriseInfo();
58 } 59 }
59 60
60 } // namespace ash 61 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698