Chromium Code Reviews| 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/material_design/material_design_controller.h" | 7 #include "ash/material_design/material_design_controller.h" |
| 8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
| 9 #include "ash/resources/grit/ash_resources.h" | 9 #include "ash/resources/grit/ash_resources.h" |
| 10 #include "ash/resources/vector_icons/vector_icons.h" | 10 #include "ash/resources/vector_icons/vector_icons.h" |
| 11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 12 #include "ash/session/session_controller.h" | 12 #include "ash/session/session_controller.h" |
| 13 #include "ash/shelf/shelf_constants.h" | 13 #include "ash/shelf/shelf_constants.h" |
| 14 #include "ash/shelf/wm_shelf.h" | 14 #include "ash/shelf/wm_shelf.h" |
| 15 #include "ash/shelf/wm_shelf_util.h" | 15 #include "ash/shelf/wm_shelf_util.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "ash/strings/grit/ash_strings.h" | 17 #include "ash/strings/grit/ash_strings.h" |
| 18 #include "ash/system/palette/palette_tool_manager.h" | 18 #include "ash/system/palette/palette_tool_manager.h" |
| 19 #include "ash/system/palette/palette_utils.h" | 19 #include "ash/system/palette/palette_utils.h" |
| 20 #include "ash/system/tray/system_menu_button.h" | 20 #include "ash/system/tray/system_menu_button.h" |
| 21 #include "ash/system/tray/system_tray_controller.h" | 21 #include "ash/system/tray/system_tray_controller.h" |
| 22 #include "ash/system/tray/system_tray_delegate.h" | 22 #include "ash/system/tray/system_tray_delegate.h" |
| 23 #include "ash/system/tray/tray_bubble_wrapper.h" | 23 #include "ash/system/tray/tray_bubble_wrapper.h" |
| 24 #include "ash/system/tray/tray_constants.h" | 24 #include "ash/system/tray/tray_constants.h" |
| 25 #include "ash/system/tray/tray_container.h" | |
|
James Cook
2017/04/17 16:54:35
Is this needed?
mohsen
2017/04/19 22:59:07
Yes, this file works with TrayBackgroundView::tray
| |
| 25 #include "ash/system/tray/tray_popup_header_button.h" | 26 #include "ash/system/tray/tray_popup_header_button.h" |
| 26 #include "ash/system/tray/tray_popup_item_style.h" | 27 #include "ash/system/tray/tray_popup_item_style.h" |
| 27 #include "ash/wm_shell.h" | 28 #include "ash/wm_shell.h" |
| 28 #include "ash/wm_window.h" | 29 #include "ash/wm_window.h" |
| 29 #include "base/metrics/histogram_macros.h" | 30 #include "base/metrics/histogram_macros.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 32 #include "ui/events/devices/input_device_manager.h" | 33 #include "ui/events/devices/input_device_manager.h" |
| 33 #include "ui/events/devices/stylus_state.h" | 34 #include "ui/events/devices/stylus_state.h" |
| 34 #include "ui/gfx/color_palette.h" | 35 #include "ui/gfx/color_palette.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 views::View* settings_button_; | 143 views::View* settings_button_; |
| 143 views::View* help_button_; | 144 views::View* help_button_; |
| 144 PaletteTray* palette_tray_; | 145 PaletteTray* palette_tray_; |
| 145 | 146 |
| 146 DISALLOW_COPY_AND_ASSIGN(TitleView); | 147 DISALLOW_COPY_AND_ASSIGN(TitleView); |
| 147 }; | 148 }; |
| 148 | 149 |
| 149 } // namespace | 150 } // namespace |
| 150 | 151 |
| 151 PaletteTray::PaletteTray(WmShelf* wm_shelf) | 152 PaletteTray::PaletteTray(WmShelf* wm_shelf) |
| 152 : TrayBackgroundView(wm_shelf, true), | 153 : TrayBackgroundView(wm_shelf), |
| 153 palette_tool_manager_(new PaletteToolManager(this)), | 154 palette_tool_manager_(new PaletteToolManager(this)), |
| 154 weak_factory_(this) { | 155 weak_factory_(this) { |
| 155 PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); | 156 PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); |
| 156 | 157 |
| 157 if (MaterialDesignController::IsShelfMaterial()) | 158 if (MaterialDesignController::IsShelfMaterial()) |
| 158 SetInkDropMode(InkDropMode::ON); | 159 SetInkDropMode(InkDropMode::ON); |
| 159 | 160 |
| 160 SetLayoutManager(new views::FillLayout()); | 161 SetLayoutManager(new views::FillLayout()); |
| 161 icon_ = new views::ImageView(); | 162 icon_ = new views::ImageView(); |
| 162 UpdateTrayIcon(); | 163 UpdateTrayIcon(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 | 380 |
| 380 void PaletteTray::OnActiveToolChanged() { | 381 void PaletteTray::OnActiveToolChanged() { |
| 381 ++num_actions_in_bubble_; | 382 ++num_actions_in_bubble_; |
| 382 UpdateTrayIcon(); | 383 UpdateTrayIcon(); |
| 383 } | 384 } |
| 384 | 385 |
| 385 WmWindow* PaletteTray::GetWindow() { | 386 WmWindow* PaletteTray::GetWindow() { |
| 386 return shelf()->GetWindow(); | 387 return shelf()->GetWindow(); |
| 387 } | 388 } |
| 388 | 389 |
| 389 void PaletteTray::SetShelfAlignment(ShelfAlignment alignment) { | |
| 390 if (alignment == shelf_alignment()) | |
| 391 return; | |
| 392 | |
| 393 TrayBackgroundView::SetShelfAlignment(alignment); | |
| 394 } | |
| 395 | |
| 396 void PaletteTray::AnchorUpdated() { | 390 void PaletteTray::AnchorUpdated() { |
| 397 if (bubble_) | 391 if (bubble_) |
| 398 bubble_->bubble_view()->UpdateBubble(); | 392 bubble_->bubble_view()->UpdateBubble(); |
| 399 } | 393 } |
| 400 | 394 |
| 401 void PaletteTray::Initialize() { | 395 void PaletteTray::Initialize() { |
| 402 PaletteDelegate* delegate = Shell::Get()->palette_delegate(); | 396 PaletteDelegate* delegate = Shell::Get()->palette_delegate(); |
| 403 // |delegate| can be null in tests. | 397 // |delegate| can be null in tests. |
| 404 if (!delegate) | 398 if (!delegate) |
| 405 return; | 399 return; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 427 UpdateIconVisibility(); | 421 UpdateIconVisibility(); |
| 428 } | 422 } |
| 429 } | 423 } |
| 430 | 424 |
| 431 void PaletteTray::UpdateIconVisibility() { | 425 void PaletteTray::UpdateIconVisibility() { |
| 432 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && | 426 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && |
| 433 IsInUserSession()); | 427 IsInUserSession()); |
| 434 } | 428 } |
| 435 | 429 |
| 436 } // namespace ash | 430 } // namespace ash |
| OLD | NEW |