| 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/common/system/chromeos/palette/palette_tray.h" | 5 #include "ash/common/system/chromeos/palette/palette_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
| 8 #include "ash/common/session/session_state_delegate.h" | 8 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/shelf/shelf_constants.h" | 9 #include "ash/common/shelf/shelf_constants.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/common/shelf/wm_shelf_util.h" | 11 #include "ash/common/shelf/wm_shelf_util.h" |
| 12 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" | 12 #include "ash/common/system/chromeos/palette/palette_tool_manager.h" |
| 13 #include "ash/common/system/chromeos/palette/palette_utils.h" | 13 #include "ash/common/system/chromeos/palette/palette_utils.h" |
| 14 #include "ash/common/system/tray/system_menu_button.h" | 14 #include "ash/common/system/tray/system_menu_button.h" |
| 15 #include "ash/common/system/tray/system_tray_controller.h" | 15 #include "ash/common/system/tray/system_tray_controller.h" |
| 16 #include "ash/common/system/tray/system_tray_delegate.h" | 16 #include "ash/common/system/tray/system_tray_delegate.h" |
| 17 #include "ash/common/system/tray/tray_bubble_wrapper.h" | 17 #include "ash/common/system/tray/tray_bubble_wrapper.h" |
| 18 #include "ash/common/system/tray/tray_constants.h" | 18 #include "ash/common/system/tray/tray_constants.h" |
| 19 #include "ash/common/system/tray/tray_popup_header_button.h" | 19 #include "ash/common/system/tray/tray_popup_header_button.h" |
| 20 #include "ash/common/system/tray/tray_popup_item_style.h" | 20 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 21 #include "ash/common/wm_lookup.h" | |
| 22 #include "ash/common/wm_shell.h" | 21 #include "ash/common/wm_shell.h" |
| 23 #include "ash/common/wm_window.h" | 22 #include "ash/common/wm_window.h" |
| 24 #include "ash/public/cpp/shell_window_ids.h" | 23 #include "ash/public/cpp/shell_window_ids.h" |
| 25 #include "ash/resources/grit/ash_resources.h" | 24 #include "ash/resources/grit/ash_resources.h" |
| 26 #include "ash/resources/vector_icons/vector_icons.h" | 25 #include "ash/resources/vector_icons/vector_icons.h" |
| 27 #include "ash/root_window_controller.h" | 26 #include "ash/root_window_controller.h" |
| 28 #include "ash/strings/grit/ash_strings.h" | 27 #include "ash/strings/grit/ash_strings.h" |
| 29 #include "base/metrics/histogram_macros.h" | 28 #include "base/metrics/histogram_macros.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 321 |
| 323 base::string16 PaletteTray::GetAccessibleNameForBubble() { | 322 base::string16 PaletteTray::GetAccessibleNameForBubble() { |
| 324 return GetAccessibleNameForTray(); | 323 return GetAccessibleNameForTray(); |
| 325 } | 324 } |
| 326 | 325 |
| 327 void PaletteTray::OnBeforeBubbleWidgetInit( | 326 void PaletteTray::OnBeforeBubbleWidgetInit( |
| 328 views::Widget* anchor_widget, | 327 views::Widget* anchor_widget, |
| 329 views::Widget* bubble_widget, | 328 views::Widget* bubble_widget, |
| 330 views::Widget::InitParams* params) const { | 329 views::Widget::InitParams* params) const { |
| 331 // Place the bubble in the same root window as |anchor_widget|. | 330 // Place the bubble in the same root window as |anchor_widget|. |
| 332 WmLookup::Get() | 331 WmWindow::Get(anchor_widget->GetNativeWindow()) |
| 333 ->GetWindowForWidget(anchor_widget) | |
| 334 ->GetRootWindowController() | 332 ->GetRootWindowController() |
| 335 ->ConfigureWidgetInitParamsForContainer( | 333 ->ConfigureWidgetInitParamsForContainer( |
| 336 bubble_widget, kShellWindowId_SettingBubbleContainer, params); | 334 bubble_widget, kShellWindowId_SettingBubbleContainer, params); |
| 337 } | 335 } |
| 338 | 336 |
| 339 void PaletteTray::HideBubble(const views::TrayBubbleView* bubble_view) { | 337 void PaletteTray::HideBubble(const views::TrayBubbleView* bubble_view) { |
| 340 HideBubbleWithView(bubble_view); | 338 HideBubbleWithView(bubble_view); |
| 341 } | 339 } |
| 342 | 340 |
| 343 void PaletteTray::HidePalette() { | 341 void PaletteTray::HidePalette() { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 UpdateIconVisibility(); | 428 UpdateIconVisibility(); |
| 431 } | 429 } |
| 432 } | 430 } |
| 433 | 431 |
| 434 void PaletteTray::UpdateIconVisibility() { | 432 void PaletteTray::UpdateIconVisibility() { |
| 435 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 433 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
| 436 IsInUserSession()); | 434 IsInUserSession()); |
| 437 } | 435 } |
| 438 | 436 |
| 439 } // namespace ash | 437 } // namespace ash |
| OLD | NEW |