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

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

Issue 2352353002: Add AppLauncherId wrapper for items shown in shelf (Closed)
Patch Set: Review v3 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
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 9f1f5e18cf96332f30f2316e07dbd888cb60f4eb..7fb872e3af4da078089f511364c8be2ad11af624 100644
--- a/chrome/browser/ui/ash/chrome_launcher_prefs.h
+++ b/chrome/browser/ui/ash/chrome_launcher_prefs.h
@@ -51,10 +51,37 @@ extern const char kShelfAlignmentBottom[];
extern const char kShelfAlignmentLeft[];
extern const char kShelfAlignmentRight[];
+// A unique chrome launcher id used to identify a shelf item.
+class AppLauncherId {
+ public:
+ explicit AppLauncherId(const std::string& app_id);
+ // This constructor is currently unused, but will be used in a follow-up CL.
+ AppLauncherId(const std::string& app_id, const std::string& launch_id);
James Cook 2016/10/03 21:14:36 Document here (or in the class comment above) abou
Andra Paraschiv 2016/10/04 11:39:00 Done.
+ ~AppLauncherId();
James Cook 2016/10/03 21:14:36 What about copy-construction and assignment? I thi
Andra Paraschiv 2016/10/04 11:39:00 Done.
+
+ const std::string& GetAsString() const { return app_launcher_id_; }
+
+ bool operator==(const AppLauncherId& app_launcher_id) const;
+
+ bool operator!=(const AppLauncherId& app_launcher_id) const;
James Cook 2016/10/03 21:14:36 Do you really need all of these operators? I would
Andra Paraschiv 2016/10/04 11:39:00 Yes, you are right, we currently need only these c
James Cook 2016/10/04 16:08:37 Yes, only include the ones you need.
Andra Paraschiv 2016/10/05 11:21:58 Done.
+
+ bool operator<(const AppLauncherId& app_launcher_id) const;
+
+ bool operator<=(const AppLauncherId& app_launcher_id) const;
+
+ bool operator>(const AppLauncherId& app_launcher_id) const;
+
+ bool operator>=(const AppLauncherId& app_launcher_id) const;
+
+ private:
+ // A unique chrome launcher id for a shelf item.
+ std::string app_launcher_id_;
+};
+
void RegisterChromeLauncherUserPrefs(
user_prefs::PrefRegistrySyncable* registry);
-base::DictionaryValue* CreateAppDict(const std::string& app_id);
+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,
@@ -75,16 +102,16 @@ std::vector<std::string> GetPinnedAppsFromPrefs(
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') | chrome/browser/ui/ash/chrome_launcher_prefs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698