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

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

Issue 1149833006: Stop the OverviewButton from appearing on the Add-User screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Decouple Overview Visibility from WindowSelector activation Created 5 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 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/session/session_state_delegate.h"
7 #include "ash/shelf/shelf_types.h" 8 #include "ash/shelf/shelf_types.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "ash/system/tray/system_tray_delegate.h" 10 #include "ash/system/tray/system_tray_delegate.h"
10 #include "ash/system/tray/tray_utils.h" 11 #include "ash/system/tray/tray_utils.h"
11 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 12 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
12 #include "ash/wm/overview/window_selector_controller.h" 13 #include "ash/wm/overview/window_selector_controller.h"
13 #include "grit/ash_resources.h" 14 #include "grit/ash_resources.h"
14 #include "grit/ash_strings.h" 15 #include "grit/ash_strings.h"
15 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
(...skipping 18 matching lines...) Expand all
35 SetContentsBackground(); 36 SetContentsBackground();
36 37
37 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 38 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
38 icon_ = new views::ImageView(); 39 icon_ = new views::ImageView();
39 icon_->SetImage( 40 icon_->SetImage(
40 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia()); 41 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia());
41 SetIconBorderForShelfAlignment(); 42 SetIconBorderForShelfAlignment();
42 tray_container()->AddChildView(icon_); 43 tray_container()->AddChildView(icon_);
43 44
44 Shell::GetInstance()->AddShellObserver(this); 45 Shell::GetInstance()->AddShellObserver(this);
46 Shell::GetInstance()->session_state_delegate()->AddSessionStateObserver(this);
45 } 47 }
46 48
47 OverviewButtonTray::~OverviewButtonTray() { 49 OverviewButtonTray::~OverviewButtonTray() {
48 Shell::GetInstance()->RemoveShellObserver(this); 50 Shell::GetInstance()->RemoveShellObserver(this);
51 Shell::GetInstance()->session_state_delegate()->RemoveSessionStateObserver(
52 this);
49 } 53 }
50 54
51 void OverviewButtonTray::UpdateAfterLoginStatusChange( 55 void OverviewButtonTray::UpdateAfterLoginStatusChange(
52 user::LoginStatus status) { 56 user::LoginStatus status) {
57 if (status == user::LOGGED_IN_KIOSK_APP) {
58 SetVisible(false);
flackr 2015/06/01 17:05:32 What guarantee is there that the visibility won't
jonross 2015/06/01 17:20:37 Good point. Done.
59 return;
60 }
53 UpdateIconVisibility(); 61 UpdateIconVisibility();
54 } 62 }
55 63
56 bool OverviewButtonTray::PerformAction(const ui::Event& event) { 64 bool OverviewButtonTray::PerformAction(const ui::Event& event) {
57 WindowSelectorController* controller = 65 WindowSelectorController* controller =
58 Shell::GetInstance()->window_selector_controller(); 66 Shell::GetInstance()->window_selector_controller();
59 controller->ToggleOverview(); 67 controller->ToggleOverview();
60 SetDrawBackgroundAsActive(controller->IsSelecting()); 68 SetDrawBackgroundAsActive(controller->IsSelecting());
61 Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW); 69 Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW);
62 return true; 70 return true;
63 } 71 }
64 72
73 void OverviewButtonTray::SessionStateChanged(
74 SessionStateDelegate::SessionState state) {
75 UpdateIconVisibility();
76 }
77
65 void OverviewButtonTray::OnMaximizeModeStarted() { 78 void OverviewButtonTray::OnMaximizeModeStarted() {
66 UpdateIconVisibility(); 79 UpdateIconVisibility();
67 } 80 }
68 81
69 void OverviewButtonTray::OnMaximizeModeEnded() { 82 void OverviewButtonTray::OnMaximizeModeEnded() {
70 UpdateIconVisibility(); 83 UpdateIconVisibility();
71 } 84 }
72 85
73 void OverviewButtonTray::OnOverviewModeEnded() { 86 void OverviewButtonTray::OnOverviewModeEnded() {
74 SetDrawBackgroundAsActive(false); 87 SetDrawBackgroundAsActive(false);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } else { 121 } else {
109 icon_->SetBorder(views::Border::CreateEmptyBorder( 122 icon_->SetBorder(views::Border::CreateEmptyBorder(
110 kVerticalShelfVerticalPadding, 123 kVerticalShelfVerticalPadding,
111 kVerticalShelfHorizontalPadding, 124 kVerticalShelfHorizontalPadding,
112 kVerticalShelfVerticalPadding, 125 kVerticalShelfVerticalPadding,
113 kVerticalShelfHorizontalPadding)); 126 kVerticalShelfHorizontalPadding));
114 } 127 }
115 } 128 }
116 129
117 void OverviewButtonTray::UpdateIconVisibility() { 130 void OverviewButtonTray::UpdateIconVisibility() {
118 SetVisible(Shell::GetInstance()->maximize_mode_controller()-> 131 SetVisible(
119 IsMaximizeModeWindowManagerEnabled() && 132 Shell::GetInstance()
120 Shell::GetInstance()->window_selector_controller()->CanSelect()); 133 ->maximize_mode_controller()
134 ->IsMaximizeModeWindowManagerEnabled() &&
135 Shell::GetInstance()
136 ->session_state_delegate()
137 ->IsActiveUserSessionStarted() &&
138 !Shell::GetInstance()->session_state_delegate()->IsScreenLocked() &&
139 Shell::GetInstance()->session_state_delegate()->GetSessionState() ==
140 SessionStateDelegate::SESSION_STATE_ACTIVE);
121 } 141 }
122 142
123 } // namespace ash 143 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/overview/overview_button_tray.h ('k') | ash/system/overview/overview_button_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698