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

Unified Diff: chrome/browser/ui/ash/chrome_launcher_prefs.h

Issue 2352353002: Add AppLauncherId wrapper for items shown in shelf (Closed)
Patch Set: Review v9 Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/chrome_launcher_prefs.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/chrome_launcher_prefs.h
diff --git a/chrome/browser/ui/ash/chrome_launcher_prefs.h b/chrome/browser/ui/ash/chrome_launcher_prefs.h
index 25751e4ebf30097e2442e13350c67c4b87292798..71b49c0a87595c095d7d3c8409e64ab0b3f1d700 100644
--- a/chrome/browser/ui/ash/chrome_launcher_prefs.h
+++ b/chrome/browser/ui/ash/chrome_launcher_prefs.h
@@ -51,10 +51,45 @@ extern const char kShelfAlignmentBottom[];
extern const char kShelfAlignmentLeft[];
extern const char kShelfAlignmentRight[];
+// A unique chrome launcher id used to identify a shelf item. This class is a
+// wrapper for the chrome launcher identifier. |app_launcher_id_| includes the
+// |app_id| and the |launch_id|. The |app_id| is the application id associated
+// with a set of windows. The |launch_id| is an id that can be passed to an app
+// when launched in order to support multiple shelf items per app. This id is
+// used together with the |app_id| to uniquely identify each shelf item that
+// has the same |app_id|. The |app_id| must not be empty.
+class AppLauncherId {
+ public:
+ AppLauncherId(const std::string& app_id, const std::string& launch_id);
+ // Creates an AppLauncherId with an empty |launch_id|.
+ explicit AppLauncherId(const std::string& app_id);
+ // Empty constructor.
stevenjb 2016/10/18 21:07:28 nit: // Empty constructor for pre-allocating.
Andra Paraschiv 2016/10/19 06:57:18 Done.
+ AppLauncherId();
+ ~AppLauncherId();
+
+ AppLauncherId(const AppLauncherId& app_launcher_id) = default;
+ AppLauncherId(AppLauncherId&& app_launcher_id) = default;
+ AppLauncherId& operator=(const AppLauncherId& other) = default;
+
+ std::string ToString() const;
+ const std::string& app_id() const { return app_id_; }
+ const std::string& launch_id() const { return launch_id_; }
+
+ bool operator<(const AppLauncherId& other) const;
+
+ private:
+ // The application id associated with a set of windows.
+ std::string app_id_;
+ // An id that can be passed to an app when launched in order to support
+ // multiple shelf items per app.
+ std::string launch_id_;
+};
+
void RegisterChromeLauncherUserPrefs(
user_prefs::PrefRegistrySyncable* registry);
-std::unique_ptr<base::DictionaryValue> CreateAppDict(const std::string& app_id);
+std::unique_ptr<base::DictionaryValue> CreateAppDict(
+ const AppLauncherId& app_launcher_id);
// Get or set the shelf auto hide behavior preference for a particular display.
ShelfAutoHideBehavior GetShelfAutoHideBehaviorPref(PrefService* prefs,
@@ -70,21 +105,21 @@ void SetShelfAlignmentPref(PrefService* prefs,
ShelfAlignment alignment);
// Get the list of pinned apps from preferences.
-std::vector<std::string> GetPinnedAppsFromPrefs(
+std::vector<AppLauncherId> GetPinnedAppsFromPrefs(
const PrefService* prefs,
LauncherControllerHelper* helper);
// Removes information about pin position from sync model for the app.
-void RemovePinPosition(Profile* profile, const std::string& app_id);
+void RemovePinPosition(Profile* profile, const AppLauncherId& app_launcher_id);
-// Updates information about pin position in sync model for the app |app_id|.
-// |app_id_before| optionally specifies an app that exists right before the
-// target app. |app_ids_after| optionally specifies sorted by position apps that
-// exist right after the target app.
+// Updates information about pin position in sync model for the app
+// |app_launcher_id|. |app_launcher_id_before| optionally specifies an app that
+// exists right before the target app. |app_launcher_ids_after| optionally
+// specifies sorted by position apps that exist right after the target app.
void SetPinPosition(Profile* profile,
- const std::string& app_id,
- const std::string& app_id_before,
- const std::vector<std::string>& app_ids_after);
+ const AppLauncherId& app_launcher_id,
+ const AppLauncherId& app_launcher_id_before,
+ const std::vector<AppLauncherId>& app_launcher_ids_after);
// Used to propagate remote preferences to local during the first run.
class ChromeLauncherPrefsObserver
« no previous file with comments | « no previous file | chrome/browser/ui/ash/chrome_launcher_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698