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

Unified Diff: ash/shelf/shelf.cc

Issue 1996563002: Add ImeMenuTray element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add kShowIconOnTrayKey property for window. 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
« no previous file with comments | « ash/common/shelf/shelf_constants.h ('k') | ash/system/chromeos/ime_menu/ime_menu_tray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf.cc
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc
index 08fc4d41118884927ffd65307dcd0ccb074fc621..66bfdc88ead574b95aea091b3a3a38cad7398e3c 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,29 @@ 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 == kStatusTrayShelfID &&
+ 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();
+ 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) {
Shu Chen 2016/06/27 01:11:10 s/-1/kStatusTrayShelfID
Azure Wei 2016/06/27 05:10:31 Removed the invalid shelf id kStatusTrayShelfID. T
+ 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());
}
« no previous file with comments | « ash/common/shelf/shelf_constants.h ('k') | ash/system/chromeos/ime_menu/ime_menu_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698