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

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

Issue 22429004: Refactor LauncherDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some comments Created 7 years, 4 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/chrome_launcher_controller_per_app.h
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h
index 951589cdfecb64c7f58066b2e94204594a09ab83..1909682b6fabe9b7319cbc2c4ad919df14a428e3 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.h
@@ -12,6 +12,7 @@
#include <vector>
#include "ash/display/display_controller.h"
+#include "ash/launcher/launcher_item_delegate.h"
#include "ash/launcher/launcher_model_observer.h"
#include "ash/launcher/launcher_types.h"
#include "ash/shelf/shelf_layout_manager_observer.h"
@@ -69,7 +70,8 @@ class BaseWindow;
// ShellWindowLauncherController.
// * Shortcuts have no LauncherItemController.
class ChromeLauncherControllerPerApp
- : public ash::LauncherModelObserver,
+ : public ash::LauncherItemDelegate,
+ public ash::LauncherModelObserver,
public ash::ShellObserver,
public ash::DisplayController::Observer,
public ChromeLauncherController,
@@ -173,35 +175,23 @@ class ChromeLauncherControllerPerApp
// Returns the id of the app for the specified tab.
virtual std::string GetAppID(content::WebContents* tab) OVERRIDE;
- // Returns the |LauncherModel|'s ID or 0 if the AppId was not found.
- virtual ash::LauncherID GetLauncherIDForAppID(
- const std::string& app_id) OVERRIDE;
virtual std::string GetAppIDForLauncherID(ash::LauncherID id) OVERRIDE;
// Set the image for a specific launcher item (e.g. when set by the app).
virtual void SetLauncherItemImage(ash::LauncherID launcher_id,
const gfx::ImageSkia& image) OVERRIDE;
- // Returns true if a pinned launcher item with given |app_id| could be found.
- virtual bool IsAppPinned(const std::string& app_id) OVERRIDE;
// Find out if the given application |id| is a windowed app item and not a
// pinned item in the launcher.
bool IsWindowedAppInLauncher(const std::string& app_id);
- // Pins an app with |app_id| to launcher. If there is a running instance in
- // launcher, the running instance is pinned. If there is no running instance,
- // a new launcher item is created and pinned.
- virtual void PinAppWithID(const std::string& app_id) OVERRIDE;
// Updates the launche type of the app for the specified id to |launch_type|.
virtual void SetLaunchType(
ash::LauncherID id,
extensions::ExtensionPrefs::LaunchType launch_type) OVERRIDE;
- // Unpins any app items whose id is |app_id|.
- virtual void UnpinAppsWithID(const std::string& app_id) OVERRIDE;
-
// Returns true if the user is currently logged in as a guest.
virtual bool IsLoggedInAsGuest() OVERRIDE;
@@ -213,10 +203,6 @@ class ChromeLauncherControllerPerApp
// incognito window.
virtual void CreateNewIncognitoWindow() OVERRIDE;
- // Checks whether the user is allowed to pin apps. Pinning may be disallowed
- // by policy in case there is a pre-defined set of pinned apps.
- virtual bool CanPin() const OVERRIDE;
-
// Updates the pinned pref state. The pinned state consists of a list pref.
// Each item of the list is a dictionary. The key |kAppIDPath| gives the
// id of the app.
@@ -262,7 +248,11 @@ class ChromeLauncherControllerPerApp
virtual void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window,
bool allow_minimize) OVERRIDE;
- // ash::LauncherDelegate overrides:
+ // Checks whether the user is allowed to pin apps. Pinning may be disallowed
+ // by policy in case there is a pre-defined set of pinned apps.
+ virtual bool CanPin() const OVERRIDE;
+
+ // ash::LauncherItemDelegate overrides:
virtual void ItemSelected(const ash::LauncherItem& item,
const ui::Event& event) OVERRIDE;
virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE;
@@ -271,11 +261,20 @@ class ChromeLauncherControllerPerApp
virtual ash::LauncherMenuModel* CreateApplicationMenu(
const ash::LauncherItem& item,
int event_flags) OVERRIDE;
- virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE;
virtual bool IsDraggable(const ash::LauncherItem& item) OVERRIDE;
virtual bool ShouldShowTooltip(const ash::LauncherItem& item) OVERRIDE;
+
+ // ash::LauncherDelegate overrides:
+ virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE;
virtual void OnLauncherCreated(ash::Launcher* launcher) OVERRIDE;
virtual void OnLauncherDestroyed(ash::Launcher* launcher) OVERRIDE;
+ virtual ash::LauncherID GetLauncherIDForAppID(
+ const std::string& app_id) OVERRIDE;
+ virtual void PinAppWithID(const std::string& app_id) OVERRIDE;
+ virtual bool IsAppPinned(const std::string& app_id) OVERRIDE;
+ virtual void UnpinAppsWithID(const std::string& app_id) OVERRIDE;
+ virtual ash::LauncherItemDelegate* GetLauncherItemDelegate(
+ const ash::LauncherItem& item) OVERRIDE;
// ash::LauncherModelObserver overrides:
virtual void LauncherItemAdded(int index) OVERRIDE;

Powered by Google App Engine
This is Rietveld 408576698