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

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

Issue 2352353002: Add AppLauncherId wrapper for items shown in shelf (Closed)
Patch Set: Include AppLauncherId in prefs code v2 Created 4 years, 3 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 7f08d98574d7f8c998efaff21b05e59d40ccfcef..dd5fbf304e1aa8107b196c892f9e2f40737b0972 100644
--- a/chrome/browser/ui/ash/chrome_launcher_prefs.h
+++ b/chrome/browser/ui/ash/chrome_launcher_prefs.h
@@ -51,10 +51,29 @@ 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);
+ ~AppLauncherId();
+
+ const std::string& GetAppLauncherID() const { return app_launcher_id_; }
stevenjb 2016/09/21 16:06:40 This is confusing, it looks like it should return
Andra Paraschiv 2016/09/22 09:23:41 Done.
+
+ bool operator==(const AppLauncherId& app_launcher_id) const {
+ return app_launcher_id.GetAppLauncherID() == app_launcher_id_;
+ }
stevenjb 2016/09/21 16:06:40 Since neither of these methods are simple getters
Andra Paraschiv 2016/09/22 09:23:41 Done.
+
+ private:
+ // A unique chrome launcher id for a shelf item.
+ const std::string app_launcher_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppLauncherId);
+};
+
void RegisterChromeLauncherUserPrefs(
user_prefs::PrefRegistrySyncable* registry);
-base::DictionaryValue* CreateAppDict(const std::string& app_id);
+base::DictionaryValue* CreateAppDict(AppLauncherId* app_launcher_id);
stevenjb 2016/09/21 16:06:40 Generally prefer const AppLauncherId& for input pa
Andra Paraschiv 2016/09/22 09:23:41 Done.
// Get or set the shelf auto hide behavior preference for a particular display.
ShelfAutoHideBehavior GetShelfAutoHideBehaviorPref(PrefService* prefs,
@@ -75,16 +94,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, 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_id_after| optionally specifies an app that exists 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_id_after| optionally
+// specifies an app that exists right after the target app.
void SetPinPosition(Profile* profile,
- const std::string& app_id,
- const std::string& app_id_before,
- const std::string& app_id_after);
+ AppLauncherId* app_launcher_id,
+ AppLauncherId* app_launcher_id_before,
+ AppLauncherId* app_launcher_id_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