| 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> |
| 11 | 11 |
| 12 #include "ash/public/cpp/shelf_types.h" | 12 #include "ash/public/cpp/shelf_types.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "components/sync_preferences/pref_service_syncable_observer.h" | 14 #include "components/sync_preferences/pref_service_syncable_observer.h" |
| 15 | 15 |
| 16 class LauncherControllerHelper; | 16 class LauncherControllerHelper; |
| 17 class PrefService; | 17 class PrefService; |
| 18 class Profile; | 18 class Profile; |
| 19 | 19 |
| 20 namespace sync_preferences { | 20 namespace sync_preferences { |
| 21 class PrefServiceSyncable; | 21 class PrefServiceSyncable; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace user_prefs { | 24 namespace user_prefs { |
| 25 class PrefRegistrySyncable; | 25 class PrefRegistrySyncable; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ash { | 28 namespace ash { |
| 29 | 29 |
| 30 class AppLauncherId; | 30 class AppLaunchId; |
| 31 | 31 |
| 32 namespace launcher { | 32 namespace launcher { |
| 33 | 33 |
| 34 // Path within the dictionary entries in the prefs::kPinnedLauncherApps list | 34 // Path within the dictionary entries in the prefs::kPinnedLauncherApps list |
| 35 // specifying the extension ID of the app to be pinned by that entry. | 35 // specifying the extension ID of the app to be pinned by that entry. |
| 36 extern const char kPinnedAppsPrefAppIDPath[]; | 36 extern const char kPinnedAppsPrefAppIDPath[]; |
| 37 | 37 |
| 38 extern const char kPinnedAppsPrefPinnedByPolicy[]; | 38 extern const char kPinnedAppsPrefPinnedByPolicy[]; |
| 39 | 39 |
| 40 // Value used as a placeholder in the list of pinned applications. | 40 // Value used as a placeholder in the list of pinned applications. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 60 int64_t display_id, | 60 int64_t display_id, |
| 61 ShelfAutoHideBehavior behavior); | 61 ShelfAutoHideBehavior behavior); |
| 62 | 62 |
| 63 // Get or set the shelf alignment preference for a particular display. | 63 // Get or set the shelf alignment preference for a particular display. |
| 64 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id); | 64 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id); |
| 65 void SetShelfAlignmentPref(PrefService* prefs, | 65 void SetShelfAlignmentPref(PrefService* prefs, |
| 66 int64_t display_id, | 66 int64_t display_id, |
| 67 ShelfAlignment alignment); | 67 ShelfAlignment alignment); |
| 68 | 68 |
| 69 // Get the list of pinned apps from preferences. | 69 // Get the list of pinned apps from preferences. |
| 70 std::vector<AppLauncherId> GetPinnedAppsFromPrefs( | 70 std::vector<AppLaunchId> GetPinnedAppsFromPrefs( |
| 71 const PrefService* prefs, | 71 const PrefService* prefs, |
| 72 LauncherControllerHelper* helper); | 72 LauncherControllerHelper* helper); |
| 73 | 73 |
| 74 // Removes information about pin position from sync model for the app. Note, | 74 // Removes information about pin position from sync model for the app. Note, |
| 75 // |app_launcher_id| with non-empty launch_id is not supported. | 75 // |app_launch_id| with non-empty launch_id is not supported. |
| 76 void RemovePinPosition(Profile* profile, const AppLauncherId& app_launcher_id); | 76 void RemovePinPosition(Profile* profile, const AppLaunchId& app_launch_id); |
| 77 | 77 |
| 78 // Updates information about pin position in sync model for the app | 78 // Updates information about pin position in sync model for the app |
| 79 // |app_launcher_id|. |app_launcher_id_before| optionally specifies an app that | 79 // |app_launch_id|. |app_launch_id_before| optionally specifies an app that |
| 80 // exists right before the target app. |app_launcher_ids_after| optionally | 80 // exists right before the target app. |app_launch_ids_after| optionally |
| 81 // specifies sorted by position apps that exist right after the target app. | 81 // specifies sorted by position apps that exist right after the target app. |
| 82 // Note, |app_launcher_id| with non-empty launch_id is not supported. | 82 // Note, |app_launch_id| with non-empty launch_id is not supported. |
| 83 void SetPinPosition(Profile* profile, | 83 void SetPinPosition(Profile* profile, |
| 84 const AppLauncherId& app_launcher_id, | 84 const AppLaunchId& app_launch_id, |
| 85 const AppLauncherId& app_launcher_id_before, | 85 const AppLaunchId& app_launch_id_before, |
| 86 const std::vector<AppLauncherId>& app_launcher_ids_after); | 86 const std::vector<AppLaunchId>& app_launch_ids_after); |
| 87 | 87 |
| 88 // Used to propagate remote preferences to local during the first run. | 88 // Used to propagate remote preferences to local during the first run. |
| 89 class ChromeLauncherPrefsObserver | 89 class ChromeLauncherPrefsObserver |
| 90 : public sync_preferences::PrefServiceSyncableObserver { | 90 : public sync_preferences::PrefServiceSyncableObserver { |
| 91 public: | 91 public: |
| 92 // Creates and returns an instance of ChromeLauncherPrefsObserver if the | 92 // Creates and returns an instance of ChromeLauncherPrefsObserver if the |
| 93 // profile prefs do not contain all the necessary local settings for the | 93 // profile prefs do not contain all the necessary local settings for the |
| 94 // shelf. If the local settings are present, returns null. | 94 // shelf. If the local settings are present, returns null. |
| 95 static std::unique_ptr<ChromeLauncherPrefsObserver> CreateIfNecessary( | 95 static std::unique_ptr<ChromeLauncherPrefsObserver> CreateIfNecessary( |
| 96 Profile* profile); | 96 Profile* profile); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 // Profile prefs. Not owned. | 107 // Profile prefs. Not owned. |
| 108 sync_preferences::PrefServiceSyncable* prefs_; | 108 sync_preferences::PrefServiceSyncable* prefs_; |
| 109 | 109 |
| 110 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherPrefsObserver); | 110 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherPrefsObserver); |
| 111 }; | 111 }; |
| 112 | 112 |
| 113 } // namespace launcher | 113 } // namespace launcher |
| 114 } // namespace ash | 114 } // namespace ash |
| 115 | 115 |
| 116 #endif // CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ | 116 #endif // CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ |
| OLD | NEW |