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

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

Issue 2807693002: Make LogoutButtonTray a regular View (Closed)
Patch Set: Rebased Created 3 years, 8 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
« no previous file with comments | « ash/system/palette/palette_tray.h ('k') | ash/system/session/logout_button_tray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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_constants.h" 12 #include "ash/shelf/shelf_constants.h"
13 #include "ash/shelf/wm_shelf.h" 13 #include "ash/shelf/wm_shelf.h"
14 #include "ash/shelf/wm_shelf_util.h" 14 #include "ash/shelf/wm_shelf_util.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ash/strings/grit/ash_strings.h" 16 #include "ash/strings/grit/ash_strings.h"
17 #include "ash/system/palette/palette_tool_manager.h" 17 #include "ash/system/palette/palette_tool_manager.h"
18 #include "ash/system/palette/palette_utils.h" 18 #include "ash/system/palette/palette_utils.h"
19 #include "ash/system/tray/system_menu_button.h" 19 #include "ash/system/tray/system_menu_button.h"
20 #include "ash/system/tray/system_tray_controller.h" 20 #include "ash/system/tray/system_tray_controller.h"
21 #include "ash/system/tray/system_tray_delegate.h" 21 #include "ash/system/tray/system_tray_delegate.h"
22 #include "ash/system/tray/tray_bubble_wrapper.h" 22 #include "ash/system/tray/tray_bubble_wrapper.h"
23 #include "ash/system/tray/tray_constants.h" 23 #include "ash/system/tray/tray_constants.h"
24 #include "ash/system/tray/tray_container.h"
24 #include "ash/system/tray/tray_popup_header_button.h" 25 #include "ash/system/tray/tray_popup_header_button.h"
25 #include "ash/system/tray/tray_popup_item_style.h" 26 #include "ash/system/tray/tray_popup_item_style.h"
26 #include "ash/wm_window.h" 27 #include "ash/wm_window.h"
27 #include "base/metrics/histogram_macros.h" 28 #include "base/metrics/histogram_macros.h"
28 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/events/devices/input_device_manager.h" 31 #include "ui/events/devices/input_device_manager.h"
31 #include "ui/events/devices/stylus_state.h" 32 #include "ui/events/devices/stylus_state.h"
32 #include "ui/gfx/color_palette.h" 33 #include "ui/gfx/color_palette.h"
33 #include "ui/gfx/paint_vector_icon.h" 34 #include "ui/gfx/paint_vector_icon.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 views::View* settings_button_; 122 views::View* settings_button_;
122 views::View* help_button_; 123 views::View* help_button_;
123 PaletteTray* palette_tray_; 124 PaletteTray* palette_tray_;
124 125
125 DISALLOW_COPY_AND_ASSIGN(TitleView); 126 DISALLOW_COPY_AND_ASSIGN(TitleView);
126 }; 127 };
127 128
128 } // namespace 129 } // namespace
129 130
130 PaletteTray::PaletteTray(WmShelf* wm_shelf) 131 PaletteTray::PaletteTray(WmShelf* wm_shelf)
131 : TrayBackgroundView(wm_shelf, true), 132 : TrayBackgroundView(wm_shelf),
132 palette_tool_manager_(new PaletteToolManager(this)), 133 palette_tool_manager_(new PaletteToolManager(this)),
133 scoped_session_observer_(this), 134 scoped_session_observer_(this),
134 weak_factory_(this) { 135 weak_factory_(this) {
135 PaletteTool::RegisterToolInstances(palette_tool_manager_.get()); 136 PaletteTool::RegisterToolInstances(palette_tool_manager_.get());
136 137
137 SetInkDropMode(InkDropMode::ON); 138 SetInkDropMode(InkDropMode::ON);
138 SetLayoutManager(new views::FillLayout()); 139 SetLayoutManager(new views::FillLayout());
139 icon_ = new views::ImageView(); 140 icon_ = new views::ImageView();
140 UpdateTrayIcon(); 141 UpdateTrayIcon();
141 142
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 356
356 void PaletteTray::OnActiveToolChanged() { 357 void PaletteTray::OnActiveToolChanged() {
357 ++num_actions_in_bubble_; 358 ++num_actions_in_bubble_;
358 UpdateTrayIcon(); 359 UpdateTrayIcon();
359 } 360 }
360 361
361 WmWindow* PaletteTray::GetWindow() { 362 WmWindow* PaletteTray::GetWindow() {
362 return shelf()->GetWindow(); 363 return shelf()->GetWindow();
363 } 364 }
364 365
365 void PaletteTray::SetShelfAlignment(ShelfAlignment alignment) {
366 if (alignment == shelf_alignment())
367 return;
368
369 TrayBackgroundView::SetShelfAlignment(alignment);
370 }
371
372 void PaletteTray::AnchorUpdated() { 366 void PaletteTray::AnchorUpdated() {
373 if (bubble_) 367 if (bubble_)
374 bubble_->bubble_view()->UpdateBubble(); 368 bubble_->bubble_view()->UpdateBubble();
375 } 369 }
376 370
377 void PaletteTray::Initialize() { 371 void PaletteTray::Initialize() {
378 PaletteDelegate* delegate = Shell::Get()->palette_delegate(); 372 PaletteDelegate* delegate = Shell::Get()->palette_delegate();
379 // |delegate| can be null in tests. 373 // |delegate| can be null in tests.
380 if (!delegate) 374 if (!delegate)
381 return; 375 return;
(...skipping 21 matching lines...) Expand all
403 UpdateIconVisibility(); 397 UpdateIconVisibility();
404 } 398 }
405 } 399 }
406 400
407 void PaletteTray::UpdateIconVisibility() { 401 void PaletteTray::UpdateIconVisibility() {
408 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() && 402 SetVisible(is_palette_enabled_ && palette_utils::HasStylusInput() &&
409 IsInUserSession()); 403 IsInUserSession());
410 } 404 }
411 405
412 } // namespace ash 406 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/palette/palette_tray.h ('k') | ash/system/session/logout_button_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698