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

Side by Side Diff: ash/system/palette/palette_tray.cc

Issue 2897553002: Do not activate TrayBubbleView by default (Closed)
Patch Set: Add comment. Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/palette/palette_tray.h" 5 #include "ash/system/palette/palette_tray.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accessibility_delegate.h"
7 #include "ash/resources/vector_icons/vector_icons.h" 9 #include "ash/resources/vector_icons/vector_icons.h"
8 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
9 #include "ash/session/session_controller.h" 11 #include "ash/session/session_controller.h"
10 #include "ash/shelf/shelf.h" 12 #include "ash/shelf/shelf.h"
11 #include "ash/shelf/shelf_constants.h" 13 #include "ash/shelf/shelf_constants.h"
12 #include "ash/shell.h" 14 #include "ash/shell.h"
13 #include "ash/strings/grit/ash_strings.h" 15 #include "ash/strings/grit/ash_strings.h"
14 #include "ash/system/palette/palette_tool_manager.h" 16 #include "ash/system/palette/palette_tool_manager.h"
15 #include "ash/system/palette/palette_utils.h" 17 #include "ash/system/palette/palette_utils.h"
16 #include "ash/system/tray/system_menu_button.h" 18 #include "ash/system/tray/system_menu_button.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 150
149 tray_container()->SetMargin(kTrayIconMainAxisInset, kTrayIconCrossAxisInset); 151 tray_container()->SetMargin(kTrayIconMainAxisInset, kTrayIconCrossAxisInset);
150 tray_container()->AddChildView(icon_); 152 tray_container()->AddChildView(icon_);
151 153
152 Shell::Get()->AddShellObserver(this); 154 Shell::Get()->AddShellObserver(this);
153 ui::InputDeviceManager::GetInstance()->AddObserver(this); 155 ui::InputDeviceManager::GetInstance()->AddObserver(this);
154 } 156 }
155 157
156 PaletteTray::~PaletteTray() { 158 PaletteTray::~PaletteTray() {
157 if (bubble_) 159 if (bubble_)
158 bubble_->bubble_view()->reset_delegate(); 160 bubble_->bubble_view()->ResetDelegate();
159 161
160 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); 162 ui::InputDeviceManager::GetInstance()->RemoveObserver(this);
161 Shell::Get()->RemoveShellObserver(this); 163 Shell::Get()->RemoveShellObserver(this);
162 } 164 }
163 165
164 bool PaletteTray::PerformAction(const ui::Event& event) { 166 bool PaletteTray::PerformAction(const ui::Event& event) {
165 if (bubble_) { 167 if (bubble_) {
166 if (num_actions_in_bubble_ == 0) 168 if (num_actions_in_bubble_ == 0)
167 RecordPaletteOptionsUsage(PaletteTrayOptions::PALETTE_CLOSED_NO_ACTION); 169 RecordPaletteOptionsUsage(PaletteTrayOptions::PALETTE_CLOSED_NO_ACTION);
168 HidePalette(); 170 HidePalette();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 294
293 void PaletteTray::BubbleViewDestroyed() { 295 void PaletteTray::BubbleViewDestroyed() {
294 palette_tool_manager_->NotifyViewsDestroyed(); 296 palette_tool_manager_->NotifyViewsDestroyed();
295 SetIsActive(false); 297 SetIsActive(false);
296 } 298 }
297 299
298 void PaletteTray::OnMouseEnteredView() {} 300 void PaletteTray::OnMouseEnteredView() {}
299 301
300 void PaletteTray::OnMouseExitedView() {} 302 void PaletteTray::OnMouseExitedView() {}
301 303
304 void PaletteTray::RegisterAccelerators(
305 const std::vector<ui::Accelerator>& accelerators,
306 views::TrayBubbleView* tray_bubble_view) {
307 Shell::Get()->accelerator_controller()->Register(accelerators,
308 tray_bubble_view);
309 }
310
311 void PaletteTray::UnregisterAllAccelerators(
312 views::TrayBubbleView* tray_bubble_view) {
313 Shell::Get()->accelerator_controller()->UnregisterAll(tray_bubble_view);
314 }
315
302 base::string16 PaletteTray::GetAccessibleNameForBubble() { 316 base::string16 PaletteTray::GetAccessibleNameForBubble() {
303 return GetAccessibleNameForTray(); 317 return GetAccessibleNameForTray();
304 } 318 }
305 319
320 bool PaletteTray::ShouldEnableExtraKeyboardAccessibility() {
321 return Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled();
322 }
323
306 void PaletteTray::HideBubble(const views::TrayBubbleView* bubble_view) { 324 void PaletteTray::HideBubble(const views::TrayBubbleView* bubble_view) {
307 HideBubbleWithView(bubble_view); 325 HideBubbleWithView(bubble_view);
308 } 326 }
309 327
310 void PaletteTray::HidePalette() { 328 void PaletteTray::HidePalette() {
311 is_bubble_auto_opened_ = false; 329 is_bubble_auto_opened_ = false;
312 num_actions_in_bubble_ = 0; 330 num_actions_in_bubble_ = 0;
313 bubble_.reset(); 331 bubble_.reset();
314 332
315 shelf()->UpdateAutoHideState(); 333 shelf()->UpdateAutoHideState();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 UpdateIconVisibility(); 403 UpdateIconVisibility();
386 } 404 }
387 } 405 }
388 406
389 void PaletteTray::UpdateIconVisibility() { 407 void PaletteTray::UpdateIconVisibility() {
390 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && 408 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
391 ShouldShowOnDisplay(this) && IsInUserSession()); 409 ShouldShowOnDisplay(this) && IsInUserSession());
392 } 410 }
393 411
394 } // namespace ash 412 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698