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

Side by Side Diff: chrome/browser/ui/ash/launcher/launcher_arc_app_updater.cc

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 | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h" 5 #include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h"
6 6
7 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
8
7 LauncherArcAppUpdater::LauncherArcAppUpdater( 9 LauncherArcAppUpdater::LauncherArcAppUpdater(
8 Delegate* delegate, 10 Delegate* delegate,
9 content::BrowserContext* browser_context) 11 content::BrowserContext* browser_context)
10 : LauncherAppUpdater(delegate, browser_context) { 12 : LauncherAppUpdater(delegate, browser_context) {
11 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context); 13 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context);
12 DCHECK(prefs); 14 DCHECK(prefs);
13 prefs->AddObserver(this); 15 prefs->AddObserver(this);
14 } 16 }
15 17
16 LauncherArcAppUpdater::~LauncherArcAppUpdater() { 18 LauncherArcAppUpdater::~LauncherArcAppUpdater() {
17 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context()); 19 ArcAppListPrefs* prefs = ArcAppListPrefs::Get(browser_context());
18 DCHECK(prefs); 20 DCHECK(prefs);
19 prefs->RemoveObserver(this); 21 prefs->RemoveObserver(this);
20 } 22 }
21 23
22 void LauncherArcAppUpdater::OnAppRegistered( 24 void LauncherArcAppUpdater::OnAppRegistered(
23 const std::string& app_id, 25 const std::string& app_id,
24 const ArcAppListPrefs::AppInfo& app_info) { 26 const ArcAppListPrefs::AppInfo& app_info) {
25 delegate()->OnAppInstalled(browser_context(), app_id); 27 delegate()->OnAppInstalled(browser_context(), app_id);
26 } 28 }
27 29
28 void LauncherArcAppUpdater::OnAppRemoved(const std::string& app_id) { 30 void LauncherArcAppUpdater::OnAppRemoved(const std::string& app_id) {
31 // ChromeLauncherController generally removes items from the sync model when
32 // they are removed from the shelf model, but that should not happen when ARC
33 // apps are disabled due to ARC itself being disabled. The app entries should
34 // remain in the sync model for other synced devices that do support ARC, and
35 // to restore the respective shelf items if ARC is re-enabled on this device.
36 ChromeLauncherController::ScopedPinSyncDisabler scoped_pin_sync_disabler =
37 ChromeLauncherController::instance()->GetScopedPinSyncDisabler();
29 delegate()->OnAppUninstalledPrepared(browser_context(), app_id); 38 delegate()->OnAppUninstalledPrepared(browser_context(), app_id);
30 delegate()->OnAppUninstalled(browser_context(), app_id); 39 delegate()->OnAppUninstalled(browser_context(), app_id);
31 } 40 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698