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

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

Issue 308683002: Move MaximizeModeWindowManager to the controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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/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/system_tray_delegate.h"
10 #include "ash/system/tray/tray_utils.h" 10 #include "ash/system/tray/tray_utils.h"
11 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
11 #include "ash/wm/overview/window_selector_controller.h" 12 #include "ash/wm/overview/window_selector_controller.h"
12 #include "grit/ash_resources.h" 13 #include "grit/ash_resources.h"
13 #include "grit/ash_strings.h" 14 #include "grit/ash_strings.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
16 #include "ui/views/border.h" 17 #include "ui/views/border.h"
17 #include "ui/views/controls/image_view.h" 18 #include "ui/views/controls/image_view.h"
18 19
19 namespace { 20 namespace {
20 21
(...skipping 11 matching lines...) Expand all
32 OverviewButtonTray::OverviewButtonTray(StatusAreaWidget* status_area_widget) 33 OverviewButtonTray::OverviewButtonTray(StatusAreaWidget* status_area_widget)
33 : TrayBackgroundView(status_area_widget), icon_(NULL) { 34 : TrayBackgroundView(status_area_widget), icon_(NULL) {
34 SetContentsBackground(); 35 SetContentsBackground();
35 36
36 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 37 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
37 icon_ = new views::ImageView(); 38 icon_ = new views::ImageView();
38 icon_->SetImage( 39 icon_->SetImage(
39 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia()); 40 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia());
40 SetIconBorderForShelfAlignment(); 41 SetIconBorderForShelfAlignment();
41 tray_container()->AddChildView(icon_); 42 tray_container()->AddChildView(icon_);
42 43 UpdateIconVisibility();
43 UpdateIconVisibility(Shell::GetInstance()->
44 IsMaximizeModeWindowManagerEnabled());
45 44
46 Shell::GetInstance()->AddShellObserver(this); 45 Shell::GetInstance()->AddShellObserver(this);
47 } 46 }
48 47
49 OverviewButtonTray::~OverviewButtonTray() { 48 OverviewButtonTray::~OverviewButtonTray() {
50 Shell::GetInstance()->RemoveShellObserver(this); 49 Shell::GetInstance()->RemoveShellObserver(this);
51 } 50 }
52 51
53 void OverviewButtonTray::UpdateAfterLoginStatusChange( 52 void OverviewButtonTray::UpdateAfterLoginStatusChange(
54 user::LoginStatus status) { 53 user::LoginStatus status) {
55 UpdateIconVisibility(Shell::GetInstance()-> 54 UpdateIconVisibility();
56 IsMaximizeModeWindowManagerEnabled());
57 } 55 }
58 56
59 bool OverviewButtonTray::PerformAction(const ui::Event& event) { 57 bool OverviewButtonTray::PerformAction(const ui::Event& event) {
60 Shell::GetInstance()->window_selector_controller()->ToggleOverview(); 58 Shell::GetInstance()->window_selector_controller()->ToggleOverview();
61 return true; 59 return true;
62 } 60 }
63 61
64 void OverviewButtonTray::OnMaximizeModeStarted() { 62 void OverviewButtonTray::OnMaximizeModeStarted() {
65 // TODO(flackr): once maximize mode has been refactored remove this so that 63 UpdateIconVisibility();
66 // UpdateIconVisibility polls Shell for the status directly
67 UpdateIconVisibility(/* maximize_mode_enabled */ true);
68 } 64 }
69 65
70 void OverviewButtonTray::OnMaximizeModeEnded() { 66 void OverviewButtonTray::OnMaximizeModeEnded() {
71 UpdateIconVisibility(/* maximize_mode_enabled */ false); 67 UpdateIconVisibility();
72 } 68 }
73 69
74 bool OverviewButtonTray::ClickedOutsideBubble() { 70 bool OverviewButtonTray::ClickedOutsideBubble() {
75 // This class has no bubbles dismiss, but acknowledge that the message was 71 // This class has no bubbles dismiss, but acknowledge that the message was
76 // handled. 72 // handled.
77 return true; 73 return true;
78 } 74 }
79 75
80 base::string16 OverviewButtonTray::GetAccessibleNameForTray() { 76 base::string16 OverviewButtonTray::GetAccessibleNameForTray() {
81 return l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME); 77 return l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME);
(...skipping 22 matching lines...) Expand all
104 kHorizontalShelfHorizontalPadding)); 100 kHorizontalShelfHorizontalPadding));
105 } else { 101 } else {
106 icon_->SetBorder(views::Border::CreateEmptyBorder( 102 icon_->SetBorder(views::Border::CreateEmptyBorder(
107 kVerticalShelfVerticalPadding, 103 kVerticalShelfVerticalPadding,
108 kVerticalShelfHorizontalPadding, 104 kVerticalShelfHorizontalPadding,
109 kVerticalShelfVerticalPadding, 105 kVerticalShelfVerticalPadding,
110 kVerticalShelfHorizontalPadding)); 106 kVerticalShelfHorizontalPadding));
111 } 107 }
112 } 108 }
113 109
114 void OverviewButtonTray::UpdateIconVisibility(bool maximize_mode_enabled) { 110 void OverviewButtonTray::UpdateIconVisibility() {
115 SetVisible(maximize_mode_enabled && 111 SetVisible(Shell::GetInstance()->maximize_mode_controller()->
112 IsMaximizeModeWindowManagerEnabled() &&
116 Shell::GetInstance()->window_selector_controller()->CanSelect()); 113 Shell::GetInstance()->window_selector_controller()->CanSelect());
117 } 114 }
118 115
119 } // namespace ash 116 } // 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