| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ | 6 #define CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace syncable_prefs { | 24 namespace syncable_prefs { |
| 25 class PrefServiceSyncable; | 25 class PrefServiceSyncable; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace user_prefs { | 28 namespace user_prefs { |
| 29 class PrefRegistrySyncable; | 29 class PrefRegistrySyncable; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace ash { | 32 namespace ash { |
| 33 namespace launcher { |
| 33 | 34 |
| 34 // Path within the dictionary entries in the prefs::kPinnedLauncherApps list | 35 // Path within the dictionary entries in the prefs::kPinnedLauncherApps list |
| 35 // specifying the extension ID of the app to be pinned by that entry. | 36 // specifying the extension ID of the app to be pinned by that entry. |
| 36 extern const char kPinnedAppsPrefAppIDPath[]; | 37 extern const char kPinnedAppsPrefAppIDPath[]; |
| 37 | 38 |
| 38 extern const char kPinnedAppsPrefPinnedByPolicy[]; | 39 extern const char kPinnedAppsPrefPinnedByPolicy[]; |
| 39 | 40 |
| 40 // Value used as a placeholder in the list of pinned applications. | 41 // Value used as a placeholder in the list of pinned applications. |
| 41 // This is NOT a valid extension identifier so pre-M31 versions ignore it. | 42 // This is NOT a valid extension identifier so pre-M31 versions ignore it. |
| 42 extern const char kPinnedAppsPlaceholder[]; | 43 extern const char kPinnedAppsPlaceholder[]; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 // Get or set the shelf alignment preference for a particular display. | 66 // Get or set the shelf alignment preference for a particular display. |
| 66 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id); | 67 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id); |
| 67 void SetShelfAlignmentPref(PrefService* prefs, | 68 void SetShelfAlignmentPref(PrefService* prefs, |
| 68 int64_t display_id, | 69 int64_t display_id, |
| 69 ShelfAlignment alignment); | 70 ShelfAlignment alignment); |
| 70 | 71 |
| 71 // Get the list of pinned apps from preferences. | 72 // Get the list of pinned apps from preferences. |
| 72 std::vector<std::string> GetPinnedAppsFromPrefs( | 73 std::vector<std::string> GetPinnedAppsFromPrefs( |
| 73 const PrefService* prefs, | 74 const PrefService* prefs, |
| 74 const LauncherControllerHelper* helper); | 75 LauncherControllerHelper* helper); |
| 76 |
| 77 // Removes information about pin position from sync model for the app. |
| 78 void RemovePinPosition(Profile* profile, const std::string& app_id); |
| 79 |
| 80 // Updates information about pin position in sync model for the app |app_id|. |
| 81 // |app_id_before| optionally specifies an app that exists right before the |
| 82 // target app. |app_id_after| optionally specifies an app that exists right |
| 83 // after the target app. |
| 84 void SetPinPosition(Profile* profile, |
| 85 const std::string& app_id, |
| 86 const std::string& app_id_before, |
| 87 const std::string& app_id_after); |
| 75 | 88 |
| 76 // Used to propagate remote preferences to local during the first run. | 89 // Used to propagate remote preferences to local during the first run. |
| 77 class ChromeLauncherPrefsObserver | 90 class ChromeLauncherPrefsObserver |
| 78 : public syncable_prefs::PrefServiceSyncableObserver { | 91 : public syncable_prefs::PrefServiceSyncableObserver { |
| 79 public: | 92 public: |
| 80 // Creates and returns an instance of ChromeLauncherPrefsObserver if the | 93 // Creates and returns an instance of ChromeLauncherPrefsObserver if the |
| 81 // profile prefs do not contain all the necessary local settings for the | 94 // profile prefs do not contain all the necessary local settings for the |
| 82 // shelf. If the local settings are present, returns null. | 95 // shelf. If the local settings are present, returns null. |
| 83 static std::unique_ptr<ChromeLauncherPrefsObserver> CreateIfNecessary( | 96 static std::unique_ptr<ChromeLauncherPrefsObserver> CreateIfNecessary( |
| 84 Profile* profile); | 97 Profile* profile); |
| 85 | 98 |
| 86 ~ChromeLauncherPrefsObserver() override; | 99 ~ChromeLauncherPrefsObserver() override; |
| 87 | 100 |
| 88 private: | 101 private: |
| 89 explicit ChromeLauncherPrefsObserver( | 102 explicit ChromeLauncherPrefsObserver( |
| 90 syncable_prefs::PrefServiceSyncable* prefs); | 103 syncable_prefs::PrefServiceSyncable* prefs); |
| 91 | 104 |
| 92 // syncable_prefs::PrefServiceSyncableObserver: | 105 // syncable_prefs::PrefServiceSyncableObserver: |
| 93 void OnIsSyncingChanged() override; | 106 void OnIsSyncingChanged() override; |
| 94 | 107 |
| 95 // Profile prefs. Not owned. | 108 // Profile prefs. Not owned. |
| 96 syncable_prefs::PrefServiceSyncable* prefs_; | 109 syncable_prefs::PrefServiceSyncable* prefs_; |
| 97 | 110 |
| 98 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherPrefsObserver); | 111 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherPrefsObserver); |
| 99 }; | 112 }; |
| 100 | 113 |
| 114 } // namespace launcher |
| 101 } // namespace ash | 115 } // namespace ash |
| 102 | 116 |
| 103 #endif // CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ | 117 #endif // CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ |
| OLD | NEW |