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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h

Issue 2055553004: arc: Support pinned apps across Arc-enabled and Arc-disabled platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased, comments addressed, removed item_pinned_by_policy Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
index 23dca46642d4499bb2fb3d95a31359a1986c6c0c..253f29a87e1f99bb745205a684a275398bfa0660 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h
@@ -24,6 +24,7 @@
#include "build/build_config.h"
#include "chrome/browser/ui/app_icon_loader.h"
#include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
+#include "chrome/browser/ui/app_list/app_list_syncable_service.h"
#include "chrome/browser/ui/ash/app_sync_ui_state_observer.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
@@ -45,9 +46,11 @@ class AppWindowLauncherController;
class TabContents;
namespace ash {
-class ChromeLauncherPrefsObserver;
class ShelfItemDelegateManager;
class ShelfModel;
+namespace launcher {
+class ChromeLauncherPrefsObserver;
+}
}
namespace aura {
@@ -87,7 +90,8 @@ class ChromeLauncherController
public AppIconLoaderDelegate,
public AppSyncUIStateObserver,
public LauncherAppUpdater::Delegate,
- public ash::ShelfItemDelegateManagerObserver {
+ public ash::ShelfItemDelegateManagerObserver,
+ public app_list::AppListSyncableService::Observer {
public:
// Used to update the state of non plaform apps, as web contents change.
enum AppState {
@@ -193,11 +197,6 @@ class ChromeLauncherController
// Updates the launch type of the app for the specified id to |launch_type|.
void SetLaunchType(ash::ShelfID id, extensions::LaunchType launch_type);
- // Updates the pinned pref state. The pinned state consists of a list pref.
- // Each item of the list is a dictionary. The key |kAppIDPath| gives the
- // id of the app.
- void PersistPinnedState();
-
// Accessor to the currently loaded profile. Note that in multi profile use
// cases this might change over time.
Profile* profile();
@@ -268,6 +267,9 @@ class ChromeLauncherController
void OnAppImageUpdated(const std::string& app_id,
const gfx::ImageSkia& image) override;
+ // app_list::AppListSyncableService::Observer:
+ void OnSyncModelUpdated() override;
+
// Called when the active user has changed.
void ActiveUserChanged(const std::string& user_email);
@@ -397,7 +399,10 @@ class ChromeLauncherController
// app.
void UnpinRunningAppInternal(int index);
- // Re-syncs shelf model with prefs::kPinnedLauncherApps.
+ // Updates pin position for the item specified by |id| in sync model.
+ void SyncPinPosition(ash::ShelfID id);
+
+ // Re-syncs shelf model.
void UpdateAppLaunchersFromPref();
// Sets the shelf auto-hide behavior from prefs.
@@ -436,23 +441,8 @@ class ChromeLauncherController
// Check if the given |web_contents| is in incognito mode.
bool IsIncognito(const content::WebContents* web_contents) const;
- // Update browser shortcut's index.
- void PersistChromeItemIndex(int index);
-
- // Depending on the provided flags, move either the chrome icon, the app icon
- // or none to the given |target_index|. The provided |chrome_index| and
- // |app_list_index| locations will get adjusted within this call to finalize
- // the action and to make sure that the other item can still be moved
- // afterwards (index adjustments).
- void MoveChromeOrApplistToFinalPosition(
- bool is_chrome,
- bool is_app_list,
- int target_index,
- int* chrome_index,
- int* app_list_index);
-
// Finds the index of where to insert the next item.
- int FindInsertionPoint(bool is_app_list);
+ int FindInsertionPoint();
// Get the browser shortcut's index in the shelf using the current's systems
// configuration of pinned and known (but not running) apps.
@@ -480,7 +470,7 @@ class ChromeLauncherController
ash::ShelfModel* model_;
- ash::ShelfItemDelegateManager* item_delegate_manager_;
+ ash::ShelfItemDelegateManager* item_delegate_manager_ = nullptr;
// Profile used for prefs and loading extensions. This is NOT necessarily the
// profile new windows are created with.
@@ -507,7 +497,7 @@ class ChromeLauncherController
PrefChangeRegistrar pref_change_registrar_;
- AppSyncUIState* app_sync_ui_state_;
+ AppSyncUIState* app_sync_ui_state_ = nullptr;
// The owned browser status monitor.
std::unique_ptr<BrowserStatusMonitor> browser_status_monitor_;
@@ -516,12 +506,12 @@ class ChromeLauncherController
std::unique_ptr<ChromeLauncherControllerUserSwitchObserver>
user_switch_observer_;
- std::unique_ptr<ash::ChromeLauncherPrefsObserver> prefs_observer_;
+ std::unique_ptr<ash::launcher::ChromeLauncherPrefsObserver> prefs_observer_;
std::unique_ptr<ArcAppDeferredLauncherController> arc_deferred_launcher_;
// If true, incoming pinned state changes should be ignored.
- bool ignore_persist_pinned_state_change_;
+ bool ignore_persist_pinned_state_change_ = false;
// The list of running & un-pinned applications for different users on hidden
// desktops.

Powered by Google App Engine
This is Rietveld 408576698