OLD | NEW |
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/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
8 #include "ash/resources/grit/ash_resources.h" | 8 #include "ash/resources/grit/ash_resources.h" |
9 #include "ash/resources/vector_icons/vector_icons.h" | 9 #include "ash/resources/vector_icons/vector_icons.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
11 #include "ash/session/session_controller.h" | 11 #include "ash/session/session_controller.h" |
12 #include "ash/shelf/shelf.h" | 12 #include "ash/shelf/shelf.h" |
13 #include "ash/shelf/shelf_constants.h" | 13 #include "ash/shelf/shelf_constants.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/strings/grit/ash_strings.h" | 15 #include "ash/strings/grit/ash_strings.h" |
16 #include "ash/system/palette/palette_tool_manager.h" | 16 #include "ash/system/palette/palette_tool_manager.h" |
17 #include "ash/system/palette/palette_utils.h" | 17 #include "ash/system/palette/palette_utils.h" |
18 #include "ash/system/tray/system_menu_button.h" | 18 #include "ash/system/tray/system_menu_button.h" |
19 #include "ash/system/tray/system_tray_controller.h" | 19 #include "ash/system/tray/system_tray_controller.h" |
20 #include "ash/system/tray/tray_bubble_wrapper.h" | 20 #include "ash/system/tray/tray_bubble_wrapper.h" |
21 #include "ash/system/tray/tray_constants.h" | 21 #include "ash/system/tray/tray_constants.h" |
22 #include "ash/system/tray/tray_container.h" | 22 #include "ash/system/tray/tray_container.h" |
23 #include "ash/system/tray/tray_popup_header_button.h" | 23 #include "ash/system/tray/tray_popup_header_button.h" |
24 #include "ash/system/tray/tray_popup_item_style.h" | 24 #include "ash/system/tray/tray_popup_item_style.h" |
25 #include "ash/wm_window.h" | |
26 #include "base/metrics/histogram_macros.h" | 25 #include "base/metrics/histogram_macros.h" |
27 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/resource/resource_bundle.h" | 27 #include "ui/base/resource/resource_bundle.h" |
29 #include "ui/display/display.h" | 28 #include "ui/display/display.h" |
30 #include "ui/display/screen.h" | 29 #include "ui/display/screen.h" |
31 #include "ui/events/devices/input_device_manager.h" | 30 #include "ui/events/devices/input_device_manager.h" |
32 #include "ui/events/devices/stylus_state.h" | 31 #include "ui/events/devices/stylus_state.h" |
33 #include "ui/gfx/color_palette.h" | 32 #include "ui/gfx/color_palette.h" |
34 #include "ui/gfx/paint_vector_icon.h" | 33 #include "ui/gfx/paint_vector_icon.h" |
35 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 "Ash.Shelf.Palette.ModeCancellation", type, | 351 "Ash.Shelf.Palette.ModeCancellation", type, |
353 PaletteModeCancelType::PALETTE_MODE_CANCEL_TYPE_COUNT); | 352 PaletteModeCancelType::PALETTE_MODE_CANCEL_TYPE_COUNT); |
354 } | 353 } |
355 | 354 |
356 void PaletteTray::OnActiveToolChanged() { | 355 void PaletteTray::OnActiveToolChanged() { |
357 ++num_actions_in_bubble_; | 356 ++num_actions_in_bubble_; |
358 UpdateTrayIcon(); | 357 UpdateTrayIcon(); |
359 } | 358 } |
360 | 359 |
361 aura::Window* PaletteTray::GetWindow() { | 360 aura::Window* PaletteTray::GetWindow() { |
362 return shelf()->GetWindow()->aura_window(); | 361 return shelf()->GetWindow(); |
363 } | 362 } |
364 | 363 |
365 void PaletteTray::AnchorUpdated() { | 364 void PaletteTray::AnchorUpdated() { |
366 if (bubble_) | 365 if (bubble_) |
367 bubble_->bubble_view()->UpdateBubble(); | 366 bubble_->bubble_view()->UpdateBubble(); |
368 } | 367 } |
369 | 368 |
370 void PaletteTray::Initialize() { | 369 void PaletteTray::Initialize() { |
371 PaletteDelegate* delegate = Shell::Get()->palette_delegate(); | 370 PaletteDelegate* delegate = Shell::Get()->palette_delegate(); |
372 // |delegate| can be null in tests. | 371 // |delegate| can be null in tests. |
(...skipping 23 matching lines...) Expand all Loading... |
396 UpdateIconVisibility(); | 395 UpdateIconVisibility(); |
397 } | 396 } |
398 } | 397 } |
399 | 398 |
400 void PaletteTray::UpdateIconVisibility() { | 399 void PaletteTray::UpdateIconVisibility() { |
401 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 400 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
402 ShouldShowOnDisplay(this) && IsInUserSession()); | 401 ShouldShowOnDisplay(this) && IsInUserSession()); |
403 } | 402 } |
404 | 403 |
405 } // namespace ash | 404 } // namespace ash |
OLD | NEW |