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 18 matching lines...) Expand all Loading... | |
| 29 #include "ui/compositor/layer.h" | 29 #include "ui/compositor/layer.h" |
| 30 #include "ui/gfx/canvas.h" | 30 #include "ui/gfx/canvas.h" |
| 31 #include "ui/gfx/image/image.h" | 31 #include "ui/gfx/image/image.h" |
| 32 #include "ui/gfx/image/image_skia_operations.h" | 32 #include "ui/gfx/image/image_skia_operations.h" |
| 33 #include "ui/gfx/skbitmap_operations.h" | 33 #include "ui/gfx/skbitmap_operations.h" |
| 34 #include "ui/views/accessible_pane_view.h" | 34 #include "ui/views/accessible_pane_view.h" |
| 35 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
| 36 #include "ui/views/widget/widget_delegate.h" | 36 #include "ui/views/widget/widget_delegate.h" |
| 37 #include "ui/wm/public/activation_client.h" | 37 #include "ui/wm/public/activation_client.h" |
| 38 | 38 |
| 39 #if defined(OS_CHROMEOS) | |
| 40 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" | |
| 41 #endif // defined(OS_CHROMEOS) | |
| 42 | |
| 39 namespace ash { | 43 namespace ash { |
| 40 | 44 |
| 41 const char Shelf::kNativeViewName[] = "ShelfView"; | 45 const char Shelf::kNativeViewName[] = "ShelfView"; |
| 42 | 46 |
| 43 Shelf::Shelf(ShelfModel* shelf_model, | 47 Shelf::Shelf(ShelfModel* shelf_model, |
| 44 ShelfDelegate* shelf_delegate, | 48 ShelfDelegate* shelf_delegate, |
| 45 WmShelf* wm_shelf, | 49 WmShelf* wm_shelf, |
| 46 ShelfWidget* shelf_widget) | 50 ShelfWidget* shelf_widget) |
| 47 : delegate_(shelf_delegate), | 51 : delegate_(shelf_delegate), |
| 48 wm_shelf_(wm_shelf), | 52 wm_shelf_(wm_shelf), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 return shelf_widget_->shelf_layout_manager()->auto_hide_state(); | 112 return shelf_widget_->shelf_layout_manager()->auto_hide_state(); |
| 109 } | 113 } |
| 110 | 114 |
| 111 ShelfVisibilityState Shelf::GetVisibilityState() const { | 115 ShelfVisibilityState Shelf::GetVisibilityState() const { |
| 112 return shelf_widget_->shelf_layout_manager()->visibility_state(); | 116 return shelf_widget_->shelf_layout_manager()->visibility_state(); |
| 113 } | 117 } |
| 114 | 118 |
| 115 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow( | 119 gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow( |
| 116 const aura::Window* window) { | 120 const aura::Window* window) { |
| 117 ShelfID id = GetShelfIDForWindow(window); | 121 ShelfID id = GetShelfIDForWindow(window); |
| 118 gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); | 122 gfx::Rect bounds; |
| 119 gfx::Point screen_origin; | 123 gfx::Vector2d offset; |
| 120 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | 124 #if defined(OS_CHROMEOS) |
| 121 return gfx::Rect(screen_origin.x() + bounds.x(), | 125 if (window->GetProperty(kShelfItemOnTrayForImeMenu)) { |
| 122 screen_origin.y() + bounds.y(), bounds.width(), | 126 // For opt-in IME menu, the item icon lays on the status tray. |
| 123 bounds.height()); | 127 bounds = shelf_widget_->status_area_widget()->ime_menu_tray()->bounds(); |
| 128 gfx::Rect status_area_bounds = | |
| 129 shelf_widget_->status_area_widget()->GetWindowBoundsInScreen(); | |
| 130 offset = status_area_bounds.OffsetFromOrigin(); | |
| 131 } | |
|
James Cook
2016/06/30 21:15:47
nit: This might be easier to read with an early re
Azure Wei
2016/07/01 03:48:05
Yes, kShelfItemOnTrayForImeMenu is only for Chrome
| |
| 132 #endif // defined(OS_CHROMEOS) | |
| 133 if (!window->GetProperty(kShelfItemOnTrayForImeMenu)) { | |
| 134 bounds = (shelf_view_->GetIdealBoundsOfItemIcon(id)); | |
| 135 gfx::Point screen_origin; | |
| 136 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | |
| 137 offset = screen_origin.OffsetFromOrigin(); | |
| 138 } | |
| 139 return bounds + offset; | |
| 124 } | 140 } |
| 125 | 141 |
| 126 void Shelf::UpdateIconPositionForWindow(aura::Window* window) { | 142 void Shelf::UpdateIconPositionForWindow(aura::Window* window) { |
| 127 shelf_view_->UpdatePanelIconPosition( | 143 shelf_view_->UpdatePanelIconPosition( |
| 128 GetShelfIDForWindow(window), | 144 GetShelfIDForWindow(window), |
| 129 ScreenUtil::ConvertRectFromScreen(shelf_widget()->GetNativeView(), | 145 ScreenUtil::ConvertRectFromScreen(shelf_widget()->GetNativeView(), |
| 130 window->GetBoundsInScreen()) | 146 window->GetBoundsInScreen()) |
| 131 .CenterPoint()); | 147 .CenterPoint()); |
| 132 } | 148 } |
| 133 | 149 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 | 227 |
| 212 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { | 228 gfx::Rect Shelf::GetVisibleItemsBoundsInScreen() const { |
| 213 return shelf_view_->GetVisibleItemsBoundsInScreen(); | 229 return shelf_view_->GetVisibleItemsBoundsInScreen(); |
| 214 } | 230 } |
| 215 | 231 |
| 216 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { | 232 app_list::ApplicationDragAndDropHost* Shelf::GetDragAndDropHostForAppList() { |
| 217 return shelf_view_; | 233 return shelf_view_; |
| 218 } | 234 } |
| 219 | 235 |
| 220 } // namespace ash | 236 } // namespace ash |
| OLD | NEW |