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 { |
James Cook
2017/05/04 16:38:49
Hey, while you're here can you take this file out
msw
2017/05/04 19:05:57
I 100% agree, but I'll do it in a followup, this C
James Cook
2017/05/04 19:45:08
SGTM
| |
29 | |
30 class AppLaunchId; | |
31 | |
32 namespace launcher { | 29 namespace launcher { |
33 | 30 |
34 // Path within the dictionary entries in the prefs::kPinnedLauncherApps list | 31 // Path within the dictionary entries in the prefs::kPinnedLauncherApps list |
35 // specifying the extension ID of the app to be pinned by that entry. | 32 // specifying the extension ID of the app to be pinned by that entry. |
36 extern const char kPinnedAppsPrefAppIDPath[]; | 33 extern const char kPinnedAppsPrefAppIDPath[]; |
37 | 34 |
38 extern const char kPinnedAppsPrefPinnedByPolicy[]; | 35 extern const char kPinnedAppsPrefPinnedByPolicy[]; |
39 | 36 |
40 // Value used as a placeholder in the list of pinned applications. | 37 // 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. | 38 // This is NOT a valid extension identifier so pre-M31 versions ignore it. |
(...skipping 18 matching lines...) Expand all Loading... | |
60 int64_t display_id, | 57 int64_t display_id, |
61 ShelfAutoHideBehavior behavior); | 58 ShelfAutoHideBehavior behavior); |
62 | 59 |
63 // Get or set the shelf alignment preference for a particular display. | 60 // Get or set the shelf alignment preference for a particular display. |
64 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id); | 61 ShelfAlignment GetShelfAlignmentPref(PrefService* prefs, int64_t display_id); |
65 void SetShelfAlignmentPref(PrefService* prefs, | 62 void SetShelfAlignmentPref(PrefService* prefs, |
66 int64_t display_id, | 63 int64_t display_id, |
67 ShelfAlignment alignment); | 64 ShelfAlignment alignment); |
68 | 65 |
69 // Get the list of pinned apps from preferences. | 66 // Get the list of pinned apps from preferences. |
70 std::vector<AppLaunchId> GetPinnedAppsFromPrefs( | 67 std::vector<ShelfID> GetPinnedAppsFromPrefs(const PrefService* prefs, |
71 const PrefService* prefs, | 68 LauncherControllerHelper* helper); |
72 LauncherControllerHelper* helper); | |
73 | 69 |
74 // Removes information about pin position from sync model for the app. Note, | 70 // Removes information about pin position from sync model for the app. |
75 // |app_launch_id| with non-empty launch_id is not supported. | 71 // Note, |shelf_id| with non-empty launch_id is not supported. |
76 void RemovePinPosition(Profile* profile, const AppLaunchId& app_launch_id); | 72 void RemovePinPosition(Profile* profile, const ShelfID& shelf_id); |
77 | 73 |
78 // Updates information about pin position in sync model for the app | 74 // Updates information about pin position in sync model for the app |shelf_id|. |
79 // |app_launch_id|. |app_launch_id_before| optionally specifies an app that | 75 // |shelf_id_before| optionally specifies an app that exists right before the |
80 // exists right before the target app. |app_launch_ids_after| optionally | 76 // target app. |shelf_ids_after| optionally specifies sorted by position apps |
81 // specifies sorted by position apps that exist right after the target app. | 77 // that exist right after the target app. |
82 // Note, |app_launch_id| with non-empty launch_id is not supported. | 78 // Note, |shelf_id| with non-empty launch_id is not supported. |
83 void SetPinPosition(Profile* profile, | 79 void SetPinPosition(Profile* profile, |
84 const AppLaunchId& app_launch_id, | 80 const ShelfID& shelf_id, |
85 const AppLaunchId& app_launch_id_before, | 81 const ShelfID& shelf_id_before, |
86 const std::vector<AppLaunchId>& app_launch_ids_after); | 82 const std::vector<ShelfID>& shelf_ids_after); |
87 | 83 |
88 // Used to propagate remote preferences to local during the first run. | 84 // Used to propagate remote preferences to local during the first run. |
89 class ChromeLauncherPrefsObserver | 85 class ChromeLauncherPrefsObserver |
90 : public sync_preferences::PrefServiceSyncableObserver { | 86 : public sync_preferences::PrefServiceSyncableObserver { |
91 public: | 87 public: |
92 // Creates and returns an instance of ChromeLauncherPrefsObserver if the | 88 // Creates and returns an instance of ChromeLauncherPrefsObserver if the |
93 // profile prefs do not contain all the necessary local settings for the | 89 // profile prefs do not contain all the necessary local settings for the |
94 // shelf. If the local settings are present, returns null. | 90 // shelf. If the local settings are present, returns null. |
95 static std::unique_ptr<ChromeLauncherPrefsObserver> CreateIfNecessary( | 91 static std::unique_ptr<ChromeLauncherPrefsObserver> CreateIfNecessary( |
96 Profile* profile); | 92 Profile* profile); |
(...skipping 10 matching lines...) Expand all Loading... | |
107 // Profile prefs. Not owned. | 103 // Profile prefs. Not owned. |
108 sync_preferences::PrefServiceSyncable* prefs_; | 104 sync_preferences::PrefServiceSyncable* prefs_; |
109 | 105 |
110 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherPrefsObserver); | 106 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherPrefsObserver); |
111 }; | 107 }; |
112 | 108 |
113 } // namespace launcher | 109 } // namespace launcher |
114 } // namespace ash | 110 } // namespace ash |
115 | 111 |
116 #endif // CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ | 112 #endif // CHROME_BROWSER_UI_ASH_CHROME_LAUNCHER_PREFS_H_ |
OLD | NEW |