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

Side by Side Diff: ash/system/status_area_widget.cc

Issue 2825383003: Fix stylus tools palette. (Closed)
Patch Set: Load palette_tray all the time. Only check when show it 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/status_area_widget.h" 5 #include "ash/system/status_area_widget.h"
6 6
7 #include "ash/public/cpp/config.h"
7 #include "ash/public/cpp/shell_window_ids.h" 8 #include "ash/public/cpp/shell_window_ids.h"
8 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
9 #include "ash/shelf/wm_shelf.h" 10 #include "ash/shelf/wm_shelf.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/system/ime_menu/ime_menu_tray.h" 12 #include "ash/system/ime_menu/ime_menu_tray.h"
12 #include "ash/system/overview/overview_button_tray.h" 13 #include "ash/system/overview/overview_button_tray.h"
13 #include "ash/system/palette/palette_tray.h" 14 #include "ash/system/palette/palette_tray.h"
14 #include "ash/system/palette/palette_utils.h" 15 #include "ash/system/palette/palette_utils.h"
15 #include "ash/system/session/logout_button_tray.h" 16 #include "ash/system/session/logout_button_tray.h"
16 #include "ash/system/status_area_widget_delegate.h" 17 #include "ash/system/status_area_widget_delegate.h"
17 #include "ash/system/tray/system_tray.h" 18 #include "ash/system/tray/system_tray.h"
18 #include "ash/system/tray/system_tray_delegate.h" 19 #include "ash/system/tray/system_tray_delegate.h"
19 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" 20 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h"
20 #include "ash/system/web_notification/web_notification_tray.h" 21 #include "ash/system/web_notification/web_notification_tray.h"
21 #include "ash/wm_window.h" 22 #include "ash/wm_window.h"
22 #include "base/i18n/time_formatting.h" 23 #include "base/i18n/time_formatting.h"
23 #include "ui/display/display.h" 24 #include "ui/display/display.h"
25 #include "ui/events/devices/input_device_manager.h"
24 #include "ui/native_theme/native_theme_dark_aura.h" 26 #include "ui/native_theme/native_theme_dark_aura.h"
25 27
26 namespace ash { 28 namespace ash {
27 29
28 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container, 30 StatusAreaWidget::StatusAreaWidget(WmWindow* status_container,
29 WmShelf* wm_shelf) 31 WmShelf* wm_shelf)
30 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(wm_shelf)), 32 : status_area_widget_delegate_(new StatusAreaWidgetDelegate(wm_shelf)),
31 overview_button_tray_(nullptr), 33 overview_button_tray_(nullptr),
32 system_tray_(nullptr), 34 system_tray_(nullptr),
33 web_notification_tray_(nullptr), 35 web_notification_tray_(nullptr),
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 wm_shelf_, WmWindow::Get(this->GetNativeWindow()), system_tray_); 201 wm_shelf_, WmWindow::Get(this->GetNativeWindow()), system_tray_);
200 status_area_widget_delegate_->AddTray(web_notification_tray_); 202 status_area_widget_delegate_->AddTray(web_notification_tray_);
201 } 203 }
202 204
203 void StatusAreaWidget::AddLogoutButtonTray() { 205 void StatusAreaWidget::AddLogoutButtonTray() {
204 logout_button_tray_ = new LogoutButtonTray(wm_shelf_); 206 logout_button_tray_ = new LogoutButtonTray(wm_shelf_);
205 status_area_widget_delegate_->AddTray(logout_button_tray_); 207 status_area_widget_delegate_->AddTray(logout_button_tray_);
206 } 208 }
207 209
208 void StatusAreaWidget::AddPaletteTray() { 210 void StatusAreaWidget::AddPaletteTray() {
209 const display::Display& display = 211 palette_tray_ = new PaletteTray(wm_shelf_);
210 WmWindow::Get(this->GetNativeWindow())->GetDisplayNearestWindow(); 212 status_area_widget_delegate_->AddTray(palette_tray_);
211
212 // Create the palette only on the internal display, where the stylus is
213 // available. We also create a palette on every display if requested from the
214 // command line.
215 if (display.IsInternal() || palette_utils::IsPaletteEnabledOnEveryDisplay()) {
216 palette_tray_ = new PaletteTray(wm_shelf_);
217 status_area_widget_delegate_->AddTray(palette_tray_);
218 }
219 } 213 }
220 214
221 void StatusAreaWidget::AddVirtualKeyboardTray() { 215 void StatusAreaWidget::AddVirtualKeyboardTray() {
222 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_); 216 virtual_keyboard_tray_ = new VirtualKeyboardTray(wm_shelf_);
223 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_); 217 status_area_widget_delegate_->AddTray(virtual_keyboard_tray_);
224 } 218 }
225 219
226 void StatusAreaWidget::AddImeMenuTray() { 220 void StatusAreaWidget::AddImeMenuTray() {
227 ime_menu_tray_ = new ImeMenuTray(wm_shelf_); 221 ime_menu_tray_ = new ImeMenuTray(wm_shelf_);
228 status_area_widget_delegate_->AddTray(ime_menu_tray_); 222 status_area_widget_delegate_->AddTray(ime_menu_tray_);
229 } 223 }
230 224
231 void StatusAreaWidget::AddOverviewButtonTray() { 225 void StatusAreaWidget::AddOverviewButtonTray() {
232 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); 226 overview_button_tray_ = new OverviewButtonTray(wm_shelf_);
233 status_area_widget_delegate_->AddTray(overview_button_tray_); 227 status_area_widget_delegate_->AddTray(overview_button_tray_);
234 } 228 }
235 229
236 } // namespace ash 230 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698