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

Side by Side Diff: ash/shelf/shelf.cc

Issue 1996563002: Add ImeMenuTray element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove kStatusTrayShelfID. Created 4 years, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shelf/shelf.h" 5 #include "ash/shelf/shelf.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "ash/aura/wm_window_aura.h" 10 #include "ash/aura/wm_window_aura.h"
11 #include "ash/common/shelf/shelf_item_delegate.h" 11 #include "ash/common/shelf/shelf_item_delegate.h"
12 #include "ash/common/shelf/shelf_item_delegate_manager.h" 12 #include "ash/common/shelf/shelf_item_delegate_manager.h"
13 #include "ash/common/shelf/shelf_model.h" 13 #include "ash/common/shelf/shelf_model.h"
14 #include "ash/common/shelf/wm_shelf_util.h" 14 #include "ash/common/shelf/wm_shelf_util.h"
15 #include "ash/common/shell_window_ids.h" 15 #include "ash/common/shell_window_ids.h"
16 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
17 #include "ash/screen_util.h" 17 #include "ash/screen_util.h"
18 #include "ash/shelf/shelf_delegate.h" 18 #include "ash/shelf/shelf_delegate.h"
19 #include "ash/shelf/shelf_layout_manager.h" 19 #include "ash/shelf/shelf_layout_manager.h"
20 #include "ash/shelf/shelf_navigator.h" 20 #include "ash/shelf/shelf_navigator.h"
21 #include "ash/shelf/shelf_util.h" 21 #include "ash/shelf/shelf_util.h"
22 #include "ash/shelf/shelf_view.h" 22 #include "ash/shelf/shelf_view.h"
23 #include "ash/shell.h" 23 #include "ash/shell.h"
24 #include "ash/shell_delegate.h" 24 #include "ash/shell_delegate.h"
25 #include "ash/wm/window_properties.h" 25 #include "ash/wm/window_properties.h"
26 #include "ui/aura/client/aura_constants.h"
26 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
27 #include "ui/aura/window_event_dispatcher.h" 28 #include "ui/aura/window_event_dispatcher.h"
28 #include "ui/aura/window_observer.h" 29 #include "ui/aura/window_observer.h"
29 #include "ui/compositor/layer.h" 30 #include "ui/compositor/layer.h"
30 #include "ui/gfx/canvas.h" 31 #include "ui/gfx/canvas.h"
31 #include "ui/gfx/image/image.h" 32 #include "ui/gfx/image/image.h"
32 #include "ui/gfx/image/image_skia_operations.h" 33 #include "ui/gfx/image/image_skia_operations.h"
33 #include "ui/gfx/skbitmap_operations.h" 34 #include "ui/gfx/skbitmap_operations.h"
34 #include "ui/views/accessible_pane_view.h" 35 #include "ui/views/accessible_pane_view.h"
35 #include "ui/views/widget/widget.h" 36 #include "ui/views/widget/widget.h"
36 #include "ui/views/widget/widget_delegate.h" 37 #include "ui/views/widget/widget_delegate.h"
37 #include "ui/wm/public/activation_client.h" 38 #include "ui/wm/public/activation_client.h"
38 39
40 #if defined(OS_CHROMEOS)
41 #include "ash/system/chromeos/ime_menu/ime_menu_tray.h"
42 #endif // defined(OS_CHROMEOS)
43
39 namespace ash { 44 namespace ash {
40 45
41 const char Shelf::kNativeViewName[] = "ShelfView"; 46 const char Shelf::kNativeViewName[] = "ShelfView";
42 47
43 Shelf::Shelf(ShelfModel* shelf_model, 48 Shelf::Shelf(ShelfModel* shelf_model,
44 ShelfDelegate* shelf_delegate, 49 ShelfDelegate* shelf_delegate,
45 WmShelf* wm_shelf, 50 WmShelf* wm_shelf,
46 ShelfWidget* shelf_widget) 51 ShelfWidget* shelf_widget)
47 : delegate_(shelf_delegate), 52 : delegate_(shelf_delegate),
48 wm_shelf_(wm_shelf), 53 wm_shelf_(wm_shelf),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return shelf_widget_->shelf_layout_manager()->auto_hide_state(); 113 return shelf_widget_->shelf_layout_manager()->auto_hide_state();
109 } 114 }
110 115
111 ShelfVisibilityState Shelf::GetVisibilityState() const { 116 ShelfVisibilityState Shelf::GetVisibilityState() const {
112 return shelf_widget_->shelf_layout_manager()->visibility_state(); 117 return shelf_widget_->shelf_layout_manager()->visibility_state();
113 } 118 }
114 119
115 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow( 120 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow(
116 const aura::Window* window) { 121 const aura::Window* window) {
117 ShelfID id = GetShelfIDForWindow(window); 122 ShelfID id = GetShelfIDForWindow(window);
118 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); 123 gfx::Rect bounds;
119 gfx::Point screen_origin; 124 int offset_x = 0;
120 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); 125 int offset_y = 0;
sadrul 2016/06/27 15:08:05 Use a gfx::Vector2d offset here instead.
Azure Wei 2016/06/27 18:33:48 Done.
121 return gfx::Rect(screen_origin.x() + bounds.x(), 126 #if defined(OS_CHROMEOS)
122 screen_origin.y() + bounds.y(), 127 if (window->GetProperty(aura::client::kShowIconOnTrayKey)) {
123 bounds.width(), 128 // For opt-in IME menu, the item icon lays on the status tray.
129 bounds = shelf_widget_->status_area_widget()->ime_menu_tray()->bounds();
sadrul 2016/06/27 15:08:04 It's not obvious at all that 'show icon on tray' m
Azure Wei 2016/06/27 18:33:48 Renamed as kShelfItemOnTrayForImeMenu. Is that bet
130 gfx::Rect status_area_bounds =
131 shelf_widget_->status_area_widget()->GetWindowBoundsInScreen();
132 offset_x = status_area_bounds.x();
133 offset_y = status_area_bounds.y();
sadrul 2016/06/27 15:08:04 offset = status_area_bounds.OffsetFromOrigin();
Azure Wei 2016/06/27 18:33:48 Done.
134 }
135 #endif // defined(OS_CHROMEOS)
136 if (!window->GetProperty(aura::client::kShowIconOnTrayKey)) {
137 bounds = (shelf_view_->GetIdealBoundsOfItemIcon(id));
138 gfx::Point screen_origin;
139 views::View::ConvertPointToScreen(shelf_view_, &screen_origin);
140 offset_x = screen_origin.x();
141 offset_y = screen_origin.y();
142 }
143
144 return gfx::Rect(offset_x + bounds.x(), offset_y + bounds.y(), bounds.width(),
sadrul 2016/06/27 15:08:04 return bounds + offset;
Azure Wei 2016/06/27 18:33:48 Done.
124 bounds.height()); 145 bounds.height());
125 } 146 }
126 147
127 void Shelf::UpdateIconPositionForWindow(aura::Window* window) { 148 void Shelf::UpdateIconPositionForWindow(aura::Window* window) {
128 shelf_view_->UpdatePanelIconPosition( 149 shelf_view_->UpdatePanelIconPosition(
129 GetShelfIDForWindow(window), 150 GetShelfIDForWindow(window),
130 ScreenUtil::ConvertRectFromScreen( 151 ScreenUtil::ConvertRectFromScreen(
131 shelf_widget()->GetNativeView(), 152 shelf_widget()->GetNativeView(),
132 window->GetBoundsInScreen()).CenterPoint()); 153 window->GetBoundsInScreen()).CenterPoint());
133 } 154 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 233
213 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { 234 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const {
214 return shelf_view_->GetVisibleItemsBoundsInScreen(); 235 return shelf_view_->GetVisibleItemsBoundsInScreen();
215 } 236 }
216 237
217 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { 238 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() {
218 return shelf_view_; 239 return shelf_view_;
219 } 240 }
220 241
221 } // namespace ash 242 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698