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

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

Issue 2462753002: Use Ash's ShelfWindowWatcher for app panel windows. (Closed)
Patch Set: Add ShelfWindowWatcherTest, remove ChromeLauncherControllerImplTest panel use. Created 4 years, 1 month 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 a01461a6e50770048e3e8ef172edf88c928cdf49..183659de0678b61621f2bd5b85fcaeda9e7413b2 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
@@ -6,8 +6,10 @@
#include "ash/aura/wm_window_aura.h"
#include "ash/common/shelf/shelf_delegate.h"
+#include "ash/common/shelf/shelf_item_types.h"
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window_property.h"
+#include "ash/wm/window_properties.h"
#include "ash/wm/window_util.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
@@ -15,6 +17,7 @@
#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/browser/ui/ash/property_util.h"
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/native_app_window.h"
#include "extensions/common/extension.h"
@@ -28,11 +31,10 @@ namespace {
std::string GetLaunchId(AppWindow* app_window) {
// Set launch_id default value to an empty string. If showInShelf parameter
- // is true or the window type is panel and the window key is not empty, its
- // value is appended to the launch_id. Otherwise, if the window key is
- // empty, the session_id is used.
+ // is true and the window key is not empty, its value is appended to the
+ // launch_id. Otherwise, if the window key is empty, the session_id is used.
std::string launch_id;
- if (app_window->show_in_shelf() || app_window->window_type_is_panel()) {
+ if (app_window->show_in_shelf()) {
James Cook 2016/11/02 17:53:44 Can you tell me more about this? This sounds like
msw 2016/11/10 21:07:46 I aimed to remove all panel use/control from this
if (!app_window->window_key().empty())
launch_id = app_window->window_key();
else
@@ -127,7 +129,14 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) {
if (app_window->is_ime_window())
return;
+ // Ash's ShelfWindowWatcher handles app panel windows once their type is set.
aura::Window* window = app_window->GetNativeWindow();
+ if (app_window->window_type_is_panel()) {
+ property_util::SetIntProperty(window, ash::kShelfItemTypeKey,
+ ash::TYPE_APP_PANEL);
+ return;
+ }
+
// 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());
@@ -151,10 +160,7 @@ void ExtensionAppWindowLauncherController::RegisterApp(AppWindow* app_window) {
shelf_id = controller->shelf_id();
controller->AddAppWindow(app_window);
} else {
- LauncherItemController::Type type =
- app_window->window_type_is_panel()
- ? LauncherItemController::TYPE_APP_PANEL
- : LauncherItemController::TYPE_APP;
+ LauncherItemController::Type type = LauncherItemController::TYPE_APP;
std::string launch_id = GetLaunchId(app_window);
ExtensionAppWindowLauncherItemController* controller =
new ExtensionAppWindowLauncherItemController(type, app_id, launch_id,

Powered by Google App Engine
This is Rietveld 408576698