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

Unified Diff: ash/shelf/shelf.cc

Issue 1996563002: Add ImeMenuTray element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ash/shelf/shelf.cc
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc
index cbc1e15c4b9f37fb03aeeacba823d785f5afedbb..641f2949ac04cbc9b1ba07a294a8d19b53270cea 100644
--- a/ash/shelf/shelf.cc
+++ b/ash/shelf/shelf.cc
@@ -38,6 +38,10 @@
#include "ui/views/widget/widget_delegate.h"
#include "ui/wm/public/activation_client.h"
+#if defined(OS_CHROMEOS)
+#include "ash/system/chromeos/ime_menu/ime_menu_tray.h"
+#endif // defined(OS_CHROMEOS)
+
namespace ash {
const char Shelf::kNativeViewName[] = "ShelfView";
@@ -129,12 +133,28 @@ 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(),
+ gfx::Rect bounds;
+ int offset_x = 0;
+ int offset_y = 0;
+#if defined(OS_CHROMEOS)
+ 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
+ // 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_x = status_area_bounds.x();
+ offset_y = status_area_bounds.y();
+ }
+#endif // defined(OS_CHROMEOS)
+ if (id != -1) {
+ bounds = (shelf_view_->GetIdealBoundsOfItemIcon(id));
+ gfx::Point screen_origin;
+ views::View::ConvertPointToScreen(shelf_view_, &screen_origin);
+ offset_x = screen_origin.x();
+ offset_y = screen_origin.y();
+ }
+
+ return gfx::Rect(offset_x + bounds.x(), offset_y + bounds.y(), bounds.width(),
bounds.height());
}

Powered by Google App Engine
This is Rietveld 408576698