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

Side by Side Diff: ash/system/overview/overview_button_tray.cc

Issue 2099443002: Migrate simple ash Shell metrics users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compile error. 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
« no previous file with comments | « ash/system/chromeos/tray_caps_lock.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/overview/overview_button_tray.h" 5 #include "ash/system/overview/overview_button_tray.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/shelf/shelf_constants.h" 9 #include "ash/common/shelf/shelf_constants.h"
10 #include "ash/common/shelf/shelf_types.h" 10 #include "ash/common/shelf/shelf_types.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 } else { 50 } else {
51 gfx::ImageSkia* image_non_md = 51 gfx::ImageSkia* image_non_md =
52 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 52 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
53 IDR_AURA_UBER_TRAY_OVERVIEW_MODE); 53 IDR_AURA_UBER_TRAY_OVERVIEW_MODE);
54 icon_->SetImage(image_non_md); 54 icon_->SetImage(image_non_md);
55 } 55 }
56 SetIconBorderForShelfAlignment(); 56 SetIconBorderForShelfAlignment();
57 tray_container()->AddChildView(icon_); 57 tray_container()->AddChildView(icon_);
58 58
59 WmShell::Get()->AddShellObserver(this); 59 WmShell::Get()->AddShellObserver(this);
60 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this); 60 WmShell::Get()->GetSessionStateDelegate()->AddSessionStateObserver(this);
61 } 61 }
62 62
63 OverviewButtonTray::~OverviewButtonTray() { 63 OverviewButtonTray::~OverviewButtonTray() {
64 WmShell::Get()->RemoveShellObserver(this); 64 WmShell::Get()->RemoveShellObserver(this);
65 Shell::GetInstance()->session_state_delegate()->RemoveSessionStateObserver( 65 WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(this);
66 this);
67 } 66 }
68 67
69 void OverviewButtonTray::UpdateAfterLoginStatusChange(LoginStatus status) { 68 void OverviewButtonTray::UpdateAfterLoginStatusChange(LoginStatus status) {
70 UpdateIconVisibility(); 69 UpdateIconVisibility();
71 } 70 }
72 71
73 bool OverviewButtonTray::PerformAction(const ui::Event& event) { 72 bool OverviewButtonTray::PerformAction(const ui::Event& event) {
74 WindowSelectorController* controller = 73 WindowSelectorController* controller =
75 WmShell::Get()->window_selector_controller(); 74 WmShell::Get()->window_selector_controller();
76 controller->ToggleOverview(); 75 controller->ToggleOverview();
77 SetDrawBackgroundAsActive(controller->IsSelecting()); 76 SetDrawBackgroundAsActive(controller->IsSelecting());
78 Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW); 77 WmShell::Get()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW);
79 return true; 78 return true;
80 } 79 }
81 80
82 void OverviewButtonTray::SessionStateChanged( 81 void OverviewButtonTray::SessionStateChanged(
83 SessionStateDelegate::SessionState state) { 82 SessionStateDelegate::SessionState state) {
84 UpdateIconVisibility(); 83 UpdateIconVisibility();
85 } 84 }
86 85
87 void OverviewButtonTray::OnMaximizeModeStarted() { 86 void OverviewButtonTray::OnMaximizeModeStarted() {
88 UpdateIconVisibility(); 87 UpdateIconVisibility();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } 130 }
132 } 131 }
133 132
134 void OverviewButtonTray::UpdateIconVisibility() { 133 void OverviewButtonTray::UpdateIconVisibility() {
135 // The visibility of the OverviewButtonTray has diverge from 134 // The visibility of the OverviewButtonTray has diverge from
136 // WindowSelectorController::CanSelect. The visibility of the button should 135 // WindowSelectorController::CanSelect. The visibility of the button should
137 // not change during transient times in which CanSelect is false. Such as when 136 // not change during transient times in which CanSelect is false. Such as when
138 // a modal dialog is present. 137 // a modal dialog is present.
139 Shell* shell = Shell::GetInstance(); 138 Shell* shell = Shell::GetInstance();
140 SessionStateDelegate* session_state_delegate = 139 SessionStateDelegate* session_state_delegate =
141 shell->session_state_delegate(); 140 WmShell::Get()->GetSessionStateDelegate();
142 141
143 SetVisible( 142 SetVisible(
144 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() && 143 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() &&
145 session_state_delegate->IsActiveUserSessionStarted() && 144 session_state_delegate->IsActiveUserSessionStarted() &&
146 !session_state_delegate->IsScreenLocked() && 145 !session_state_delegate->IsScreenLocked() &&
147 session_state_delegate->GetSessionState() == 146 session_state_delegate->GetSessionState() ==
148 SessionStateDelegate::SESSION_STATE_ACTIVE && 147 SessionStateDelegate::SESSION_STATE_ACTIVE &&
149 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() != 148 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus() !=
150 LoginStatus::KIOSK_APP); 149 LoginStatus::KIOSK_APP);
151 } 150 }
152 151
153 } // namespace ash 152 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/tray_caps_lock.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698