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

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: 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) {
53 UpdateIconVisibility(); 57 UpdateIconVisibility();
54 } 58 }
55 59
56 bool OverviewButtonTray::PerformAction(const ui::Event& event) { 60 bool OverviewButtonTray::PerformAction(const ui::Event& event) {
57 WindowSelectorController* controller = 61 WindowSelectorController* controller =
58 Shell::GetInstance()->window_selector_controller(); 62 Shell::GetInstance()->window_selector_controller();
59 controller->ToggleOverview(); 63 controller->ToggleOverview();
60 SetDrawBackgroundAsActive(controller->IsSelecting()); 64 SetDrawBackgroundAsActive(controller->IsSelecting());
61 Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW); 65 Shell::GetInstance()->metrics()->RecordUserMetricsAction(UMA_TRAY_OVERVIEW);
62 return true; 66 return true;
63 } 67 }
64 68
69 void OverviewButtonTray::SessionStateChanged(
70 SessionStateDelegate::SessionState state) {
71 UpdateIconVisibility();
72 }
73
65 void OverviewButtonTray::OnMaximizeModeStarted() { 74 void OverviewButtonTray::OnMaximizeModeStarted() {
66 UpdateIconVisibility(); 75 UpdateIconVisibility();
67 } 76 }
68 77
69 void OverviewButtonTray::OnMaximizeModeEnded() { 78 void OverviewButtonTray::OnMaximizeModeEnded() {
70 UpdateIconVisibility(); 79 UpdateIconVisibility();
71 } 80 }
72 81
73 void OverviewButtonTray::OnOverviewModeEnded() { 82 void OverviewButtonTray::OnOverviewModeEnded() {
74 SetDrawBackgroundAsActive(false); 83 SetDrawBackgroundAsActive(false);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } else { 117 } else {
109 icon_->SetBorder(views::Border::CreateEmptyBorder( 118 icon_->SetBorder(views::Border::CreateEmptyBorder(
110 kVerticalShelfVerticalPadding, 119 kVerticalShelfVerticalPadding,
111 kVerticalShelfHorizontalPadding, 120 kVerticalShelfHorizontalPadding,
112 kVerticalShelfVerticalPadding, 121 kVerticalShelfVerticalPadding,
113 kVerticalShelfHorizontalPadding)); 122 kVerticalShelfHorizontalPadding));
114 } 123 }
115 } 124 }
116 125
117 void OverviewButtonTray::UpdateIconVisibility() { 126 void OverviewButtonTray::UpdateIconVisibility() {
118 SetVisible(Shell::GetInstance()->maximize_mode_controller()-> 127 // The visibility of the OverviewButtonTray has diverge from
119 IsMaximizeModeWindowManagerEnabled() && 128 // WindowSelectorController::CanSelect. The visibility of the button should
120 Shell::GetInstance()->window_selector_controller()->CanSelect()); 129 // not change during transient times in which CanSelect is false. Such as when
130 // a modal dialog is present.
131 Shell* shell = Shell::GetInstance();
132 SessionStateDelegate* session_state_delegate =
133 shell->session_state_delegate();
134
135 SetVisible(
136 shell->maximize_mode_controller()->IsMaximizeModeWindowManagerEnabled() &&
137 session_state_delegate->IsActiveUserSessionStarted() &&
138 !session_state_delegate->IsScreenLocked() &&
139 session_state_delegate->GetSessionState() ==
140 SessionStateDelegate::SESSION_STATE_ACTIVE &&
sadrul 2015/06/03 19:08:36 This ... is a bit complex. Can this be made better
jonross 2015/06/04 17:38:22 The "Active Session" term has become a bit overloa
jonross 2015/06/04 17:55:54 Filed crbug.com/496761 to cover a refactor of Sess
141 shell->system_tray_delegate()->GetUserLoginStatus() !=
142 user::LOGGED_IN_KIOSK_APP);
121 } 143 }
122 144
123 } // namespace ash 145 } // 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