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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.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_browser.h
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.h
index 02045015624ea43c2236ca97869f46ad63477808..3ff5c52322d6e807fde77dae73ca4b65f186dd06 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.h
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_browser.h
@@ -10,7 +10,7 @@
#include <string>
#include "ash/display/display_controller.h"
-#include "ash/launcher/launcher_delegate.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"
@@ -63,7 +63,8 @@ class BaseWindow;
// ShellWindowLauncherController.
// * Shortcuts have no LauncherItemController.
class ChromeLauncherControllerPerBrowser
- : public ash::LauncherModelObserver,
+ : public ash::LauncherItemDelegate,
+ public ash::LauncherModelObserver,
public ash::ShellObserver,
public ash::DisplayController::Observer,
public ChromeLauncherController,
@@ -166,30 +167,17 @@ class ChromeLauncherControllerPerBrowser
// Returns the id of the app for the specified tab.
virtual std::string GetAppID(content::WebContents* tab) OVERRIDE;
- 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;
-
- // 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;
@@ -201,10 +189,6 @@ class ChromeLauncherControllerPerBrowser
// 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.
@@ -250,7 +234,23 @@ class ChromeLauncherControllerPerBrowser
virtual void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window,
bool allow_minimize) 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;
+
// 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::LauncherItemDelegate overrides:
virtual void ItemSelected(const ash::LauncherItem& item,
const ui::Event& event) OVERRIDE;
virtual string16 GetTitle(const ash::LauncherItem& item) OVERRIDE;
@@ -259,11 +259,8 @@ class ChromeLauncherControllerPerBrowser
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;
- virtual void OnLauncherCreated(ash::Launcher* launcher) OVERRIDE;
- virtual void OnLauncherDestroyed(ash::Launcher* launcher) OVERRIDE;
// ash::LauncherModelObserver overrides:
virtual void LauncherItemAdded(int index) OVERRIDE;

Powered by Google App Engine
This is Rietveld 408576698