Chromium Code Reviews| Index: ash/shelf/shelf.cc |
| diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc |
| index 358badd6739f5d43e4b8d9321b7ae54e85d3975d..89b333c5435a095b78f459eefc6317bcc7176dab 100644 |
| --- a/ash/shelf/shelf.cc |
| +++ b/ash/shelf/shelf.cc |
| @@ -36,6 +36,10 @@ |
| #include "ui/views/widget/widget_delegate.h" |
| #include "ui/wm/public/activation_client.h" |
| +#if defined(OS_CHROMEOS) |
| +#include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
| +#endif // defined(OS_CHROMEOS) |
| + |
| namespace ash { |
| const char Shelf::kNativeViewName[] = "ShelfView"; |
| @@ -115,12 +119,24 @@ ShelfVisibilityState Shelf::GetVisibilityState() const { |
| gfx::Rect Shelf::GetScreenBoundsOfItemIconForWindow( |
| const aura::Window* window) { |
| ShelfID id = GetShelfIDForWindow(window); |
| - gfx::Rect bounds(shelf_view_->GetIdealBoundsOfItemIcon(id)); |
| - gfx::Point screen_origin; |
| - views::View::ConvertPointToScreen(shelf_view_, &screen_origin); |
| - return gfx::Rect(screen_origin.x() + bounds.x(), |
| - screen_origin.y() + bounds.y(), bounds.width(), |
| - bounds.height()); |
| + gfx::Rect bounds; |
| + gfx::Vector2d offset; |
| +#if defined(OS_CHROMEOS) |
| + if (window->GetProperty(kShelfItemOnTrayForImeMenu)) { |
| + // For opt-in IME menu, the item icon lays on the status tray. |
| + bounds = shelf_widget_->status_area_widget()->ime_menu_tray()->bounds(); |
| + gfx::Rect status_area_bounds = |
| + shelf_widget_->status_area_widget()->GetWindowBoundsInScreen(); |
| + offset = status_area_bounds.OffsetFromOrigin(); |
| + } |
|
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
|
| +#endif // defined(OS_CHROMEOS) |
| + if (!window->GetProperty(kShelfItemOnTrayForImeMenu)) { |
| + bounds = (shelf_view_->GetIdealBoundsOfItemIcon(id)); |
| + gfx::Point screen_origin; |
| + views::View::ConvertPointToScreen(shelf_view_, &screen_origin); |
| + offset = screen_origin.OffsetFromOrigin(); |
| + } |
| + return bounds + offset; |
| } |
| void Shelf::UpdateIconPositionForWindow(aura::Window* window) { |