OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_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/app_launch_id.h" | 12 #include "ash/public/cpp/app_launch_id.h" |
13 #include "ash/public/cpp/shelf_item.h" | 13 #include "ash/public/cpp/shelf_item.h" |
14 #include "ash/public/interfaces/shelf.mojom.h" | 14 #include "ash/public/interfaces/shelf.mojom.h" |
15 #include "base/auto_reset.h" | |
15 #include "chrome/browser/ui/app_icon_loader.h" | 16 #include "chrome/browser/ui/app_icon_loader.h" |
16 #include "chrome/browser/ui/app_icon_loader_delegate.h" | 17 #include "chrome/browser/ui/app_icon_loader_delegate.h" |
17 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 18 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
18 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 19 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
19 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" | 20 #include "chrome/browser/ui/ash/launcher/settings_window_observer.h" |
20 #include "mojo/public/cpp/bindings/associated_binding.h" | 21 #include "mojo/public/cpp/bindings/associated_binding.h" |
21 | 22 |
22 class AccountId; | 23 class AccountId; |
23 class ArcAppDeferredLauncherController; | 24 class ArcAppDeferredLauncherController; |
24 class BrowserShortcutLauncherItemController; | 25 class BrowserShortcutLauncherItemController; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 // Get the launch ID for a given shelf ID. | 226 // Get the launch ID for a given shelf ID. |
226 virtual const std::string& GetLaunchIDForShelfID(ash::ShelfID id) = 0; | 227 virtual const std::string& GetLaunchIDForShelfID(ash::ShelfID id) = 0; |
227 | 228 |
228 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); | 229 AppIconLoader* GetAppIconLoaderForApp(const std::string& app_id); |
229 | 230 |
230 // Sets the shelf auto-hide and/or alignment behavior from prefs. | 231 // Sets the shelf auto-hide and/or alignment behavior from prefs. |
231 void SetShelfAutoHideBehaviorFromPrefs(); | 232 void SetShelfAutoHideBehaviorFromPrefs(); |
232 void SetShelfAlignmentFromPrefs(); | 233 void SetShelfAlignmentFromPrefs(); |
233 void SetShelfBehaviorsFromPrefs(); | 234 void SetShelfBehaviorsFromPrefs(); |
234 | 235 |
236 bool should_sync_pin_changes() const { return should_sync_pin_changes_; } | |
237 | |
238 // Temporarily prevent pinned shelf item changes from updating the sync model. | |
239 std::unique_ptr<base::AutoReset<bool>> DoNotSyncPinChanges(); | |
James Cook
2017/03/29 23:23:56
hrm. I like the idea of returning a RAII-style "lo
msw
2017/03/30 00:33:29
Elliot suggests adding move semantics to AutoReset
James Cook
2017/03/30 02:05:28
I think "using" is fine for now.
optional name id
msw
2017/03/30 02:22:11
Done.
| |
240 | |
235 // Sets LauncherControllerHelper or AppIconLoader for test, taking ownership. | 241 // Sets LauncherControllerHelper or AppIconLoader for test, taking ownership. |
236 void SetLauncherControllerHelperForTest( | 242 void SetLauncherControllerHelperForTest( |
237 std::unique_ptr<LauncherControllerHelper> helper); | 243 std::unique_ptr<LauncherControllerHelper> helper); |
238 void SetAppIconLoadersForTest( | 244 void SetAppIconLoadersForTest( |
239 std::vector<std::unique_ptr<AppIconLoader>>& loaders); | 245 std::vector<std::unique_ptr<AppIconLoader>>& loaders); |
240 | 246 |
241 void SetProfileForTest(Profile* profile); | 247 void SetProfileForTest(Profile* profile); |
242 | 248 |
243 protected: | 249 protected: |
244 ChromeLauncherController(); | 250 ChromeLauncherController(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 | 287 |
282 // Ash's mojom::ShelfController used to change shelf state. | 288 // Ash's mojom::ShelfController used to change shelf state. |
283 ash::mojom::ShelfControllerPtr shelf_controller_; | 289 ash::mojom::ShelfControllerPtr shelf_controller_; |
284 | 290 |
285 // The binding this instance uses to implment mojom::ShelfObserver | 291 // The binding this instance uses to implment mojom::ShelfObserver |
286 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; | 292 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; |
287 | 293 |
288 // True when setting a shelf pref in response to an observer notification. | 294 // True when setting a shelf pref in response to an observer notification. |
289 bool updating_shelf_pref_from_observer_ = false; | 295 bool updating_shelf_pref_from_observer_ = false; |
290 | 296 |
297 // When true, changes to pinned shelf items should update the sync model. | |
298 bool should_sync_pin_changes_ = true; | |
299 | |
291 // Used to get app info for tabs. | 300 // Used to get app info for tabs. |
292 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_; | 301 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_; |
293 | 302 |
294 // An observer that manages the shelf title and icon for settings windows. | 303 // An observer that manages the shelf title and icon for settings windows. |
295 SettingsWindowObserver settings_window_observer_; | 304 SettingsWindowObserver settings_window_observer_; |
296 | 305 |
297 // Used to load the images for app items. | 306 // Used to load the images for app items. |
298 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; | 307 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; |
299 | 308 |
300 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); | 309 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); |
301 }; | 310 }; |
302 | 311 |
303 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ | 312 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ |
OLD | NEW |