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

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

Issue 515573002: Use active state on touch start for tray icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement Touch Feedback on TrayBackgroundView Created 6 years, 3 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"
(...skipping 22 matching lines...) Expand all
33 OverviewButtonTray::OverviewButtonTray(StatusAreaWidget* status_area_widget) 33 OverviewButtonTray::OverviewButtonTray(StatusAreaWidget* status_area_widget)
34 : TrayBackgroundView(status_area_widget), icon_(NULL) { 34 : TrayBackgroundView(status_area_widget), icon_(NULL) {
35 SetContentsBackground(); 35 SetContentsBackground();
36 36
37 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 37 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
38 icon_ = new views::ImageView(); 38 icon_ = new views::ImageView();
39 icon_->SetImage( 39 icon_->SetImage(
40 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia()); 40 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_OVERVIEW_MODE).ToImageSkia());
41 SetIconBorderForShelfAlignment(); 41 SetIconBorderForShelfAlignment();
42 tray_container()->AddChildView(icon_); 42 tray_container()->AddChildView(icon_);
43
44 Shell::GetInstance()->AddShellObserver(this);
45 } 43 }
46 44
47 OverviewButtonTray::~OverviewButtonTray() { 45 OverviewButtonTray::~OverviewButtonTray() {
48 Shell::GetInstance()->RemoveShellObserver(this);
49 } 46 }
50 47
51 void OverviewButtonTray::UpdateAfterLoginStatusChange( 48 void OverviewButtonTray::UpdateAfterLoginStatusChange(
52 user::LoginStatus status) { 49 user::LoginStatus status) {
53 UpdateIconVisibility(); 50 UpdateIconVisibility();
54 } 51 }
55 52
56 bool OverviewButtonTray::PerformAction(const ui::Event& event) { 53 bool OverviewButtonTray::PerformAction(const ui::Event& event) {
57 Shell::GetInstance()->window_selector_controller()->ToggleOverview(); 54 WindowSelectorController* controller =
55 Shell::GetInstance()->window_selector_controller();
56 controller->ToggleOverview();
57 SetDrawBackgroundAsActive(controller->IsSelecting());
58 return true; 58 return true;
59 } 59 }
60 60
61 void OverviewButtonTray::OnMaximizeModeStarted() { 61 void OverviewButtonTray::OnMaximizeModeStarted() {
62 UpdateIconVisibility(); 62 UpdateIconVisibility();
63 TrayBackgroundView::OnMaximizeModeStarted();
63 } 64 }
64 65
65 void OverviewButtonTray::OnMaximizeModeEnded() { 66 void OverviewButtonTray::OnMaximizeModeEnded() {
66 UpdateIconVisibility(); 67 UpdateIconVisibility();
68 TrayBackgroundView::OnMaximizeModeEnded();
67 } 69 }
68 70
69 bool OverviewButtonTray::ClickedOutsideBubble() { 71 bool OverviewButtonTray::ClickedOutsideBubble() {
70 // This class has no bubbles dismiss, but acknowledge that the message was 72 // This class has no bubbles dismiss, but acknowledge that the message was
71 // handled. 73 // handled.
72 return true; 74 return true;
73 } 75 }
74 76
75 base::string16 OverviewButtonTray::GetAccessibleNameForTray() { 77 base::string16 OverviewButtonTray::GetAccessibleNameForTray() {
76 return l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME); 78 return l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_BUTTON_ACCESSIBLE_NAME);
(...skipping 29 matching lines...) Expand all
106 } 108 }
107 } 109 }
108 110
109 void OverviewButtonTray::UpdateIconVisibility() { 111 void OverviewButtonTray::UpdateIconVisibility() {
110 SetVisible(Shell::GetInstance()->maximize_mode_controller()-> 112 SetVisible(Shell::GetInstance()->maximize_mode_controller()->
111 IsMaximizeModeWindowManagerEnabled() && 113 IsMaximizeModeWindowManagerEnabled() &&
112 Shell::GetInstance()->window_selector_controller()->CanSelect()); 114 Shell::GetInstance()->window_selector_controller()->CanSelect());
113 } 115 }
114 116
115 } // namespace ash 117 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698