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

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: Change SetWindowState() with SetImeWindow(). 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..17978ccf2771878fc499e41e0da8d226dda54ea9 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,28 @@
#include "chrome/browser/ui/ash/launcher/extension_app_window_launcher_controller.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/system/chromeos/ime_menu/ime_menu_tray.h"
+#endif // defined(OS_CHROMEOS)
+
using extensions::AppWindow;
using extensions::AppWindowRegistry;
@@ -109,6 +117,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.
+ 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) {
+ ime_menu_tray->SetImeWindow(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 +191,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/system/chromeos/ime_menu/ime_menu_tray.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