Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 #include "ui/compositor/layer.h" | 31 #include "ui/compositor/layer.h" |
| 32 #include "ui/gfx/canvas.h" | 32 #include "ui/gfx/canvas.h" |
| 33 #include "ui/gfx/image/image.h" | 33 #include "ui/gfx/image/image.h" |
| 34 #include "ui/gfx/image/image_skia_operations.h" | 34 #include "ui/gfx/image/image_skia_operations.h" |
| 35 #include "ui/gfx/skbitmap_operations.h" | 35 #include "ui/gfx/skbitmap_operations.h" |
| 36 #include "ui/views/accessible_pane_view.h" | 36 #include "ui/views/accessible_pane_view.h" |
| 37 #include "ui/views/widget/widget.h" | 37 #include "ui/views/widget/widget.h" |
| 38 #include "ui/views/widget/widget_delegate.h" | 38 #include "ui/views/widget/widget_delegate.h" |
| 39 #include "ui/wm/public/activation_client.h" | 39 #include "ui/wm/public/activation_client.h" |
| 40 | 40 |
| 41 #if defined(OS_CHROMEOS) | |
| 42 #include "ash/system/chromeos/ime_menu/ime_menu_tray.h" | |
| 43 #endif // defined(OS_CHROMEOS) | |
| 44 | |
| 41 namespace ash { | 45 namespace ash { |
| 42 | 46 |
| 43 const char Shelf::kNativeViewName[] = "ShelfView"; | 47 const char Shelf::kNativeViewName[] = "ShelfView"; |
| 44 | 48 |
| 45 Shelf::Shelf(ShelfModel* shelf_model, | 49 Shelf::Shelf(ShelfModel* shelf_model, |
| 46 ShelfDelegate* shelf_delegate, | 50 ShelfDelegate* shelf_delegate, |
| 47 WmShelf* wm_shelf, | 51 WmShelf* wm_shelf, |
| 48 ShelfWidget* shelf_widget) | 52 ShelfWidget* shelf_widget) |
| 49 : delegate_(shelf_delegate), | 53 : delegate_(shelf_delegate), |
| 50 wm_shelf_(wm_shelf), | 54 wm_shelf_(wm_shelf), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 return shelf_widget_->shelf_layout_manager()->auto_hide_state(); | 126 return shelf_widget_->shelf_layout_manager()->auto_hide_state(); |
| 123 } | 127 } |
| 124 | 128 |
| 125 ShelfVisibilityState Shelf::GetVisibilityState() const { | 129 ShelfVisibilityState Shelf::GetVisibilityState() const { |
| 126 return shelf_widget_->shelf_layout_manager()->visibility_state(); | 130 return shelf_widget_->shelf_layout_manager()->visibility_state(); |
| 127 } | 131 } |
| 128 | 132 |
| 129 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow( | 133 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow( |
| 130 const aura::Window* window) { | 134 const aura::Window* window) { |
| 131 ShelfID id = GetShelfIDForWindow(window); | 135 ShelfID id = GetShelfIDForWindow(window); |
| 132 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); | 136 gfx::Rect bounds; |
| 133 gfx::Point screen_origin; | 137 int offset_x = 0; |
| 134 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | 138 int offset_y = 0; |
| 135 return gfx::Rect(screen_origin.x() + bounds.x(), | 139 #if defined(OS_CHROMEOS) |
| 136 screen_origin.y() + bounds.y(), | 140 if (id == -1) { |
|
sadrul
2016/06/20 16:18:12
How can you tell that -1 is the ime tray item?
Azure Wei
2016/06/22 01:47:09
Set it in extension_app_window_launcher_controller
| |
| 137 bounds.width(), | 141 // For opt-in IME menu, the item icon lays on the status tray. |
| 142 bounds = shelf_widget_->status_area_widget()->ime_menu_tray()->bounds(); | |
| 143 gfx::Rect status_area_bounds = | |
| 144 shelf_widget_->status_area_widget()->GetWindowBoundsInScreen(); | |
| 145 offset_x = status_area_bounds.x(); | |
| 146 offset_y = status_area_bounds.y(); | |
| 147 } | |
| 148 #endif // defined(OS_CHROMEOS) | |
| 149 if (id != -1) { | |
| 150 bounds = (shelf_view_->GetIdealBoundsOfItemIcon(id)); | |
| 151 gfx::Point screen_origin; | |
| 152 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | |
| 153 offset_x = screen_origin.x(); | |
| 154 offset_y = screen_origin.y(); | |
| 155 } | |
| 156 | |
| 157 return gfx::Rect(offset_x + bounds.x(), offset_y + bounds.y(), bounds.width(), | |
| 138 bounds.height()); | 158 bounds.height()); |
| 139 } | 159 } |
| 140 | 160 |
| 141 void Shelf::UpdateIconPositionForWindow(aura::Window* window) { | 161 void Shelf::UpdateIconPositionForWindow(aura::Window* window) { |
| 142 shelf_view_->UpdatePanelIconPosition( | 162 shelf_view_->UpdatePanelIconPosition( |
| 143 GetShelfIDForWindow(window), | 163 GetShelfIDForWindow(window), |
| 144 ScreenUtil::ConvertRectFromScreen( | 164 ScreenUtil::ConvertRectFromScreen( |
| 145 shelf_widget()->GetNativeView(), | 165 shelf_widget()->GetNativeView(), |
| 146 window->GetBoundsInScreen()).CenterPoint()); | 166 window->GetBoundsInScreen()).CenterPoint()); |
| 147 } | 167 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 | 246 |
| 227 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { | 247 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { |
| 228 return shelf_view_->GetVisibleItemsBoundsInScreen(); | 248 return shelf_view_->GetVisibleItemsBoundsInScreen(); |
| 229 } | 249 } |
| 230 | 250 |
| 231 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { | 251 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { |
| 232 return shelf_view_; | 252 return shelf_view_; |
| 233 } | 253 } |
| 234 | 254 |
| 235 } // namespace ash | 255 } // namespace ash |
| OLD | NEW |