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

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

Issue 212553005: Overview Tray Button should not be visible on login screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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/shelf/shelf_types.h" 7 #include "ash/shelf/shelf_types.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/system/tray/system_tray_delegate.h"
9 #include "ash/system/tray/tray_utils.h" 10 #include "ash/system/tray/tray_utils.h"
10 #include "ash/wm/overview/window_selector_controller.h" 11 #include "ash/wm/overview/window_selector_controller.h"
11 #include "grit/ash_resources.h" 12 #include "grit/ash_resources.h"
12 #include "grit/ash_strings.h" 13 #include "grit/ash_strings.h"
13 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
14 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/views/border.h" 16 #include "ui/views/border.h"
16 #include "ui/views/controls/image_view.h" 17 #include "ui/views/controls/image_view.h"
17 18
18 namespace { 19 namespace {
(...skipping 15 matching lines...) Expand all
34 icon_(NULL) { 35 icon_(NULL) {
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 SetVisible(Shell::GetInstance()->IsMaximizeModeWindowManagerEnabled()); 45 UpdateIconVisibility(Shell::GetInstance()->
46 IsMaximizeModeWindowManagerEnabled());
45 47
46 Shell::GetInstance()->AddShellObserver(this); 48 Shell::GetInstance()->AddShellObserver(this);
47 } 49 }
48 50
49 OverviewButtonTray::~OverviewButtonTray() { 51 OverviewButtonTray::~OverviewButtonTray() {
50 Shell::GetInstance()->RemoveShellObserver(this); 52 Shell::GetInstance()->RemoveShellObserver(this);
51 } 53 }
52 54
53 bool OverviewButtonTray::PerformAction(const ui::Event& event) { 55 bool OverviewButtonTray::PerformAction(const ui::Event& event) {
54 Shell::GetInstance()->window_selector_controller()->ToggleOverview(); 56 Shell::GetInstance()->window_selector_controller()->ToggleOverview();
55 return true; 57 return true;
56 } 58 }
57 59
58 void OverviewButtonTray::OnMaximizeModeStarted() { 60 void OverviewButtonTray::OnMaximizeModeStarted() {
59 SetVisible(true); 61 UpdateIconVisibility(/* maximize_mode_enabled */ true);
sadrul 2014/03/28 21:23:35 In some parts of the code, an enum is used instead
jonross 2014/03/31 15:09:01 This is only here until a refactor of MaximizeMode
60 } 62 }
61 63
62 void OverviewButtonTray::OnMaximizeModeEnded() { 64 void OverviewButtonTray::OnMaximizeModeEnded() {
63 SetVisible(false); 65 UpdateIconVisibility(/* maximize_mode_enabled */ false);
64 } 66 }
65 67
66 bool OverviewButtonTray::ClickedOutsideBubble() { 68 bool OverviewButtonTray::ClickedOutsideBubble() {
67 // This class has no bubbles dismiss, but acknowledge that the message was 69 // This class has no bubbles dismiss, but acknowledge that the message was
68 // handled. 70 // handled.
69 return true; 71 return true;
70 } 72 }
71 73
72 base::string16 OverviewButtonTray::GetAccessibleNameForTray() { 74 base::string16 OverviewButtonTray::GetAccessibleNameForTray() {
73 return l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME); 75 return l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME);
(...skipping 22 matching lines...) Expand all
96 kHorizontalShelfHorizontalPadding)); 98 kHorizontalShelfHorizontalPadding));
97 } else { 99 } else {
98 icon_->SetBorder(views::Border::CreateEmptyBorder( 100 icon_->SetBorder(views::Border::CreateEmptyBorder(
99 kVerticalShelfVerticalPadding, 101 kVerticalShelfVerticalPadding,
100 kVerticalShelfHorizontalPadding, 102 kVerticalShelfHorizontalPadding,
101 kVerticalShelfVerticalPadding, 103 kVerticalShelfVerticalPadding,
102 kVerticalShelfHorizontalPadding)); 104 kVerticalShelfHorizontalPadding));
103 } 105 }
104 } 106 }
105 107
108 void OverviewButtonTray::UpdateIconVisibility(bool maximize_mode_enabled) {
109 SetVisible(maximize_mode_enabled &&
110 Shell::GetInstance()->window_selector_controller()->CanSelect());
111 }
112
113 void OverviewButtonTray::UpdateAfterLoginStatusChange(
114 user::LoginStatus status) {
115 UpdateIconVisibility(Shell::GetInstance()->
116 IsMaximizeModeWindowManagerEnabled());
117 }
sadrul 2014/03/28 21:23:35 The function order in .cc should match the order i
jonross 2014/03/31 15:09:01 Done.
118
106 } // namespace ash 119 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698