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

Unified Diff: chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc

Issue 1996563002: Add ImeMenuTray element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to ash/common/ and use WmWindow. 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: chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
index d3d80af4098e70cf967eb808caea1a26930810fd..0320633596f4263f37380f0e626ab1c28aa7ec64 100644
--- a/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
+++ b/chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.cc
@@ -4,20 +4,29 @@
#include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.h"
+#include "ash/aura/wm_window_aura.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_delegate.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
+#include "ash/system/status_area_widget.h"
+#include "ash/wm/window_state_aura.h"
#include "ash/wm/window_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
#include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_item_controller.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/extension.h"
#include "ui/aura/window_event_dispatcher.h"
+#if defined(OS_CHROMEOS)
+#include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h"
+#endif // defined(OS_CHROMEOS)
+
using extensions::AppWindow;
using extensions::AppWindowRegistry;
@@ -109,6 +118,26 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) {
return;
aura::Window* window = app_window->GetNativeWindow();
+
+#if defined(OS_CHROMEOS)
+ // IME window created by IME extension should also not register itself in the
+ // lanucher. Instead, is should show ImeMenuTray in the status tray.
James Cook 2016/06/30 21:15:47 nit: lanucher -> launcher. Or did you mean shelf?
Azure Wei 2016/07/01 03:48:05 Done.
+ if (extension_misc::IsImeMenuExtensionId(app_window->extension_id())) {
+ ash::Shelf* shelf = ash::Shelf::ForWindow(app_window->GetNativeWindow());
+ if (shelf) {
+ ash::ImeMenuTray* ime_menu_tray =
+ shelf->shelf_widget()->status_area_widget()->ime_menu_tray();
+ if (ime_menu_tray) {
James Cook 2016/06/30 21:15:47 I think this pointer is never null when you have a
Azure Wei 2016/07/01 03:48:05 Done.
+ ime_menu_tray->SetImeWindow(ash::WmWindowAura::Get(window));
+ // Sets the property of the window to indicate that the icon should be
+ // shown on the status area tray.
+ window->SetProperty(ash::kShelfItemOnTrayForImeMenu, true);
+ ash::SetShelfIDForWindow(ash::kInvalidShelfID, window);
+ }
+ }
+ return;
+ }
+#endif // defined(OS_CHROMEOS)
// Get the app's shelf identifier and add an entry to the map.
DCHECK(window_to_app_shelf_id_map_.find(window) ==
window_to_app_shelf_id_map_.end());
@@ -163,6 +192,9 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) {
}
void ExtensionAppWindowLauncherController::UnregisterApp(aura::Window* window) {
+ if (window->GetProperty(ash::kShelfItemOnTrayForImeMenu))
+ return;
+
WindowToAppShelfIdMap::iterator iter1 =
window_to_app_shelf_id_map_.find(window);
DCHECK(iter1 != window_to_app_shelf_id_map_.end());
« ash/test/test_system_tray_delegate.cc ('K') | « ash/test/test_system_tray_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698