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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h

Issue 2769323002: mash: Update shelf pin prefs in ShelfModelObserver overrides. (Closed)
Patch Set: Use ScopedPinSyncDisabler name suggestion. Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 using ScopedPinSyncDisabler = std::unique_ptr<base::AutoReset<bool>>;
240 ScopedPinSyncDisabler GetScopedPinSyncDisabler();
241
235 // Sets LauncherControllerHelper or AppIconLoader for test, taking ownership. 242 // Sets LauncherControllerHelper or AppIconLoader for test, taking ownership.
236 void SetLauncherControllerHelperForTest( 243 void SetLauncherControllerHelperForTest(
237 std::unique_ptr<LauncherControllerHelper> helper); 244 std::unique_ptr<LauncherControllerHelper> helper);
238 void SetAppIconLoadersForTest( 245 void SetAppIconLoadersForTest(
239 std::vector<std::unique_ptr<AppIconLoader>>& loaders); 246 std::vector<std::unique_ptr<AppIconLoader>>& loaders);
240 247
241 void SetProfileForTest(Profile* profile); 248 void SetProfileForTest(Profile* profile);
242 249
243 protected: 250 protected:
244 ChromeLauncherController(); 251 ChromeLauncherController();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 288
282 // Ash's mojom::ShelfController used to change shelf state. 289 // Ash's mojom::ShelfController used to change shelf state.
283 ash::mojom::ShelfControllerPtr shelf_controller_; 290 ash::mojom::ShelfControllerPtr shelf_controller_;
284 291
285 // The binding this instance uses to implment mojom::ShelfObserver 292 // The binding this instance uses to implment mojom::ShelfObserver
286 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_; 293 mojo::AssociatedBinding<ash::mojom::ShelfObserver> observer_binding_;
287 294
288 // True when setting a shelf pref in response to an observer notification. 295 // True when setting a shelf pref in response to an observer notification.
289 bool updating_shelf_pref_from_observer_ = false; 296 bool updating_shelf_pref_from_observer_ = false;
290 297
298 // When true, changes to pinned shelf items should update the sync model.
299 bool should_sync_pin_changes_ = true;
300
291 // Used to get app info for tabs. 301 // Used to get app info for tabs.
292 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_; 302 std::unique_ptr<LauncherControllerHelper> launcher_controller_helper_;
293 303
294 // An observer that manages the shelf title and icon for settings windows. 304 // An observer that manages the shelf title and icon for settings windows.
295 SettingsWindowObserver settings_window_observer_; 305 SettingsWindowObserver settings_window_observer_;
296 306
297 // Used to load the images for app items. 307 // Used to load the images for app items.
298 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_; 308 std::vector<std::unique_ptr<AppIconLoader>> app_icon_loaders_;
299 309
300 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController); 310 DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController);
301 }; 311 };
302 312
303 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_ 313 #endif // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698