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

Unified Diff: chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h

Issue 1823923002: arc: Support running Arc app in shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased + few nits Created 4 years, 9 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/app_window_launcher_item_controller.h
diff --git a/chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h b/chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h
index 5d54fda37c92e46bddc576560fffc30a1f824d73..888555026c7a3035e07793a05c1f0650ef68785e 100644
--- a/chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h
+++ b/chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h
@@ -5,8 +5,6 @@
#ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
#define CHROME_BROWSER_UI_ASH_LAUNCHER_APP_WINDOW_LAUNCHER_ITEM_CONTROLLER_H_
-#include <stddef.h>
-
#include <list>
#include <string>
@@ -19,32 +17,26 @@ namespace aura {
class Window;
}
-namespace extensions {
-class AppWindow;
+namespace ui {
+class BaseWindow;
}
class ChromeLauncherController;
-// This is a LauncherItemController for app windows. There is one instance per
-// app, per launcher id. For apps with multiple windows, each item controller
-// keeps track of all windows associated with the app and their activation
-// order. Instances are owned by ash::ShelfItemDelegateManager.
+// This is a LauncherItemController for abstract app windows. There is one
+// instance per app, per launcher id. For apps with multiple windows, each item
+// controller keeps track of all windows associated with the app and their
+// activation order. Instances are owned by ash::ShelfItemDelegateManager.
//
// Tests are in chrome_launcher_controller_browsertest.cc
class AppWindowLauncherItemController : public LauncherItemController,
public aura::WindowObserver {
public:
- AppWindowLauncherItemController(Type type,
- const std::string& app_shelf_id,
- const std::string& app_id,
- ChromeLauncherController* controller);
-
~AppWindowLauncherItemController() override;
- void AddAppWindow(extensions::AppWindow* app_window,
- ash::ShelfItemStatus status);
+ void AddWindow(ui::BaseWindow* window);
- void RemoveAppWindowForWindow(aura::Window* window);
+ void RemoveWindowForNativeWindow(aura::Window* window);
void SetActiveWindow(aura::Window* window);
@@ -60,7 +52,6 @@ class AppWindowLauncherItemController : public LauncherItemController,
ash::ShelfItemDelegate::PerformedAction ItemSelected(
const ui::Event& eent) override;
base::string16 GetTitle() override;
- ash::ShelfMenuModel* CreateApplicationMenu(int event_flags) override;
bool IsDraggable() override;
bool CanPin() const override;
bool ShouldShowTooltip() override;
@@ -72,31 +63,44 @@ class AppWindowLauncherItemController : public LauncherItemController,
intptr_t old) override;
// Get the number of running applications/incarnations of this.
- size_t app_window_count() const { return app_windows_.size(); }
+ size_t window_count() const { return windows_.size(); }
// Activates the window at position |index|.
void ActivateIndexedApp(size_t index);
- private:
- typedef std::list<extensions::AppWindow*> AppWindowList;
+ protected:
+ using WindowList = std::list<ui::BaseWindow*>;
+
+ AppWindowLauncherItemController(Type type,
+ const std::string& app_shelf_id,
+ const std::string& app_id,
+ ChromeLauncherController* controller);
+
+ // Called when app window is removed from controller.
+ virtual void OnWindowRemoved(ui::BaseWindow* window) {}
// Returns the action performed. Should be one of kNoAction,
// kExistingWindowActivated, or kExistingWindowMinimized.
ash::ShelfItemDelegate::PerformedAction ShowAndActivateOrMinimize(
- extensions::AppWindow* app_window);
+ ui::BaseWindow* window);
// Activate the given |window_to_show|, or - if already selected - advance to
// the next window of similar type.
// Returns the action performed. Should be one of kNoAction,
// kExistingWindowActivated, or kExistingWindowMinimized.
ash::ShelfItemDelegate::PerformedAction ActivateOrAdvanceToNextAppWindow(
- extensions::AppWindow* window_to_show);
+ ui::BaseWindow* window_to_show);
+
+ const WindowList& windows() { return windows_; }
+
+ private:
+ WindowList::iterator GetFromNativeWindow(aura::Window* window);
// List of associated app windows
- AppWindowList app_windows_;
+ WindowList windows_;
// Pointer to the most recently active app window
- extensions::AppWindow* last_active_app_window_;
+ ui::BaseWindow* last_active_window_ = nullptr;
// The launcher id associated with this set of windows. There is one
// AppLauncherItemController for each |app_shelf_id_|.

Powered by Google App Engine
This is Rietveld 408576698