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

Unified 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, 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 08fc4d41118884927ffd65307dcd0ccb074fc621..4a80316e1242ed6b58643681c4ac8ffbaf9a70bd 100644
--- a/ash/shelf/shelf.cc
+++ b/ash/shelf/shelf.cc
@@ -23,6 +23,7 @@
#include "ash/shell.h"
#include "ash/shell_delegate.h"
#include "ash/wm/window_properties.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/aura/window_observer.h"
@@ -36,6 +37,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";
@@ -115,12 +120,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;
sadrul 2016/06/27 15:08:05 Use a gfx::Vector2d offset here instead.
Azure Wei 2016/06/27 18:33:48 Done.
+#if defined(OS_CHROMEOS)
+ if (window->GetProperty(aura::client::kShowIconOnTrayKey)) {
+ // For opt-in IME menu, the item icon lays on the status tray.
+ 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
+ gfx::Rect status_area_bounds =
+ shelf_widget_->status_area_widget()->GetWindowBoundsInScreen();
+ offset_x = status_area_bounds.x();
+ 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.
+ }
+#endif // defined(OS_CHROMEOS)
+ if (!window->GetProperty(aura::client::kShowIconOnTrayKey)) {
+ 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(),
sadrul 2016/06/27 15:08:04 return bounds + offset;
Azure Wei 2016/06/27 18:33:48 Done.
bounds.height());
}

Powered by Google App Engine
This is Rietveld 408576698