13551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
83551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include <list>
93551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include <map>
103551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include <set>
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
123551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include <vector>
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
143551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "ash/display/display_controller.h"
15a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ash/shelf/shelf_delegate.h"
16a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "ash/shelf/shelf_item_delegate.h"
175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/shelf/shelf_item_types.h"
183551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "ash/shelf/shelf_layout_manager_observer.h"
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ash/shelf/shelf_model_observer.h"
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ash/shelf/shelf_types.h"
213551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "ash/shell_observer.h"
223551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "base/basictypes.h"
233551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "base/compiler_specific.h"
243551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/memory/scoped_vector.h"
263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "base/prefs/pref_change_registrar.h"
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/extensions/app_icon_loader.h"
283551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "chrome/browser/prefs/pref_service_syncable_observer.h"
293551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "chrome/browser/ui/ash/app_sync_ui_state_observer.h"
303551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h"
3168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
323551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
33a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "chrome/common/extensions/extension_constants.h"
343551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "content/public/browser/notification_observer.h"
35f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "content/public/browser/notification_registrar.h"
363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "ui/aura/window_observer.h"
373551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class AppSyncUIState;
393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class Browser;
403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class BrowserShortcutLauncherItemController;
41424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class BrowserStatusMonitor;
423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class ExtensionEnableFlow;
433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class GURL;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class LauncherItemController;
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile;
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class AppWindowLauncherController;
473551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class TabContents;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash {
50a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ShelfItemDelegateManager;
51f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class ShelfModel;
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace aura {
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Window;
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebContents;
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
62a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)namespace extensions {
63a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class Extension;
64a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)}
65a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
6690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)namespace ui {
6790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)class BaseWindow;
6890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)}
6990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)
702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// A list of the elements which makes up a simple menu description.
712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef ScopedVector<ChromeLauncherAppMenuItem> ChromeLauncherAppMenuItems;
722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
73d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// A class which needs to be overwritten dependent on the used OS to moitor
74d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// user switching.
75d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)class ChromeLauncherControllerUserSwitchObserver {
76d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) public:
77d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  ChromeLauncherControllerUserSwitchObserver() {}
78d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  virtual ~ChromeLauncherControllerUserSwitchObserver() {}
79d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
80d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) private:
81d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
82d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerUserSwitchObserver);
83d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)};
84d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ChromeLauncherController manages the launcher items needed for content
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// windows. Launcher items have a type, an optional app id, and a controller.
873551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// This incarnation groups running tabs/windows in application specific lists.
883551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// * Browser app windows have BrowserLauncherItemController, owned by the
893551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)//   BrowserView instance.
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// * App windows have AppWindowLauncherItemController, owned by
91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)//   AppWindowLauncherController.
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Shortcuts have no LauncherItemController.
93a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ChromeLauncherController : public ash::ShelfDelegate,
94f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                 public ash::ShelfModelObserver,
9568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ash::ShellObserver,
9668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ash::DisplayController::Observer,
9768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public content::NotificationObserver,
9868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public extensions::AppIconLoader::Delegate,
9968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public PrefServiceSyncableObserver,
10068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public AppSyncUIStateObserver,
10168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ExtensionEnableFlowDelegate,
10268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ash::ShelfLayoutManagerObserver {
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Indicates if a shelf item is incognito or not.
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum IncognitoState {
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    STATE_INCOGNITO,
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    STATE_NOT_INCOGNITO,
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Used to update the state of non plaform apps, as web contents change.
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum AppState {
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_ACTIVE,
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_WINDOW_ACTIVE,
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_INACTIVE,
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_REMOVED
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Mockable interface to get app ids from tabs.
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  class AppTabHelper {
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ~AppTabHelper() {}
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Returns the app id of the specified tab, or an empty string if there is
1244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // no app. All known profiles will be queried for this.
1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    virtual std::string GetAppID(content::WebContents* tab) = 0;
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Returns true if |id| is valid for the currently active profile.
1284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Used during restore to ignore no longer valid extensions.
1294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Note that already running applications are ignored by the restore
1304e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // process.
1314e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    virtual bool IsValidIDForCurrentUser(const std::string& id) = 0;
1324e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
1334e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Sets the currently active profile for the usage of |GetAppID|.
1344e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    virtual void SetCurrentUser(Profile* profile) = 0;
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
137f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ChromeLauncherController(Profile* profile, ash::ShelfModel* model);
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~ChromeLauncherController();
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Initializes this ChromeLauncherController.
1413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void Init();
1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Creates an instance.
1442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static ChromeLauncherController* CreateInstance(Profile* profile,
145f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                                  ash::ShelfModel* model);
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the single ChromeLauncherController instance.
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static ChromeLauncherController* instance() { return instance_; }
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Creates a new app item on the shelf for |controller|.
1515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller,
1525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                     const std::string& app_id,
1535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                     ash::ShelfItemStatus status);
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1553551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Updates the running status of an item. It will also update the status of
1565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // browsers shelf item if needed.
1575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status);
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates the controller associated with id (which should be a shortcut).
1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |controller| remains owned by caller.
1615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetItemController(ash::ShelfID id, LauncherItemController* controller);
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Closes or unpins the shelf item.
1645d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void CloseLauncherItem(ash::ShelfID id);
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Pins the specified id. Currently only supports platform apps.
1675d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Pin(ash::ShelfID id);
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Unpins the specified id, closing if not running.
1705d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Unpin(ash::ShelfID id);
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the item identified by |id| is pinned.
1735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsPinned(ash::ShelfID id);
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Pins/unpins the specified id.
1765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void TogglePinned(ash::ShelfID id);
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the specified item can be pinned or unpinned. Only apps can
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be pinned.
1805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsPinnable(ash::ShelfID id) const;
1812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
182cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Installs the specified id. Only valid if the id corresponds to an ephemeral
183cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // app.
184cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void Install(ash::ShelfID id);
185cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
186cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Returns true if the specified item can be installed. Only true for
187cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // ephemeral apps.
188cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool CanInstall(ash::ShelfID id);
189cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // If there is no shelf item in the shelf for application |app_id|, one
1915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // gets created. The (existing or created) shelf items get then locked
1922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // against a users un-pinning removal.
1933551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void LockV1AppWithID(const std::string& app_id);
1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // A previously locked shelf item of type |app_id| gets unlocked. If the
1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // lock count reaches 0 and the item is not pinned it will go away.
1973551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void UnlockV1AppWithID(const std::string& app_id);
1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Requests that the shelf item controller specified by |id| open a new
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // instance of the app.  |event_flags| holds the flags of the event which
2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // triggered this command.
2025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Launch(ash::ShelfID id, int event_flags);
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Closes the specified item.
2055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Close(ash::ShelfID id);
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the specified item is open.
2085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsOpen(ash::ShelfID id);
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the specified item is for a platform app.
2115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsPlatformApp(ash::ShelfID id);
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Opens a new instance of the application identified by |app_id|.
2145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Used by the app-list, and by pinned-app shelf items.
21568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void LaunchApp(const std::string& app_id,
21668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                 ash::LaunchSource source,
21768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                 int event_flags);
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If |app_id| is running, reactivates the app's most recently active window,
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // otherwise launches and activates the app.
2215d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Used by the app-list, and by pinned-app shelf items.
22268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void ActivateApp(const std::string& app_id,
22368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                   ash::LaunchSource source,
22468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                   int event_flags);
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the launch type of app for the specified id.
2275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  extensions::LaunchType GetLaunchType(ash::ShelfID id);
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Set the image for a specific shelf item (e.g. when set by the app).
2305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetLauncherItemImage(ash::ShelfID shelf_id, const gfx::ImageSkia& image);
2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2323551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Find out if the given application |id| is a windowed app item and not a
2335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // pinned item in the shelf.
2343551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool IsWindowedAppInLauncher(const std::string& app_id);
2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
236a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Updates the launch type of the app for the specified id to |launch_type|.
2375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetLaunchType(ash::ShelfID id, extensions::LaunchType launch_type);
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the user is currently logged in as a guest.
2403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Makes virtual for unittest in LauncherContextMenuTest.
2413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual bool IsLoggedInAsGuest();
2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2435d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Invoked when user clicks on button in the shelf and there is no last
2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // used window (or CTRL is held with the click).
2453551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void CreateNewWindow();
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Invoked when the user clicks on button in the shelf to create a new
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // incognito window.
2493551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void CreateNewIncognitoWindow();
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates the pinned pref state. The pinned state consists of a list pref.
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Each item of the list is a dictionary. The key |kAppIDPath| gives the
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // id of the app.
2543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void PersistPinnedState();
2552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
256f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ash::ShelfModel* model();
2572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
258d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Accessor to the currently loaded profile. Note that in multi profile use
259d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // cases this might change over time.
2603551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  Profile* profile();
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Gets the shelf auto-hide behavior on |root_window|.
2633551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  ash::ShelfAutoHideBehavior GetShelfAutoHideBehavior(
2641e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      aura::Window* root_window) const;
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns |true| if the user is allowed to modify the shelf auto-hide
2672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // behavior on |root_window|.
2681e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool CanUserModifyShelfAutoHideBehavior(aura::Window* root_window) const;
2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Toggles the shelf auto-hide behavior on |root_window|. Does nothing if the
2712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // user is not allowed to modify the auto-hide behavior.
2721e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void ToggleShelfAutoHideBehavior(aura::Window* root_window);
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notify the controller that the state of an non platform app's tabs
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // have changed,
2763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void UpdateAppState(content::WebContents* contents, AppState app_state);
2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2785d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns ShelfID for |contents|. If |contents| is not an app or is not
279f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // pinned, returns the id of browser shrotcut.
2805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents);
281f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Limits application refocusing to urls that match |url| for |id|.
2835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetRefocusURLPatternForTest(ash::ShelfID id, const GURL& url);
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the extension identified by |app_id|.
2863551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  const extensions::Extension* GetExtensionForAppID(
2873551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      const std::string& app_id) const;
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
289c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Activates a |window|. If |allow_minimize| is true and the system allows
290c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // it, the the window will get minimized instead.
2913551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window,
2923551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                                        bool allow_minimize);
2933551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
294a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // ash::ShelfDelegate overrides:
2955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnShelfCreated(ash::Shelf* shelf) OVERRIDE;
2965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnShelfDestroyed(ash::Shelf* shelf) OVERRIDE;
2975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual ash::ShelfID GetShelfIDForAppID(const std::string& app_id) OVERRIDE;
2985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual const std::string& GetAppIDForShelfID(ash::ShelfID id) OVERRIDE;
299424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual void PinAppWithID(const std::string& app_id) OVERRIDE;
300424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual bool IsAppPinned(const std::string& app_id) OVERRIDE;
30158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual bool CanPin() const OVERRIDE;
302424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE;
303424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
304f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // ash::ShelfModelObserver overrides:
305f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfItemAdded(int index) OVERRIDE;
3065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void ShelfItemRemoved(int index, ash::ShelfID id) OVERRIDE;
307f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfItemMoved(int start_index, int target_index) OVERRIDE;
308f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfItemChanged(int index,
3095d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                const ash::ShelfItem& old_item) OVERRIDE;
310f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfStatusChanged() OVERRIDE;
3113551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3123551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // content::NotificationObserver overrides:
3133551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void Observe(int type,
3143551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                       const content::NotificationSource& source,
3153551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                       const content::NotificationDetails& details) OVERRIDE;
3163551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3173551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ash::ShellObserver overrides:
3181e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE;
3193551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3203551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ash::DisplayController::Observer overrides:
3213551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnDisplayConfigurationChanged() OVERRIDE;
3223551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3233551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // PrefServiceSyncableObserver overrides:
3243551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnIsSyncingChanged() OVERRIDE;
3253551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // AppSyncUIStateObserver overrides:
3273551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnAppSyncUIStatusChanged() OVERRIDE;
3283551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3293551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ExtensionEnableFlowDelegate overrides:
3303551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void ExtensionEnableFlowFinished() OVERRIDE;
3313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE;
3322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // extensions::AppIconLoader overrides:
3342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void SetAppImage(const std::string& app_id,
3353551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                           const gfx::ImageSkia& image) OVERRIDE;
3362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3373551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ash::ShelfLayoutManagerObserver overrides:
3383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnAutoHideBehaviorChanged(
3391e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      aura::Window* root_window,
3403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      ash::ShelfAutoHideBehavior new_behavior) OVERRIDE;
3413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
342d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Called when the active user has changed.
343d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void ActiveUserChanged(const std::string& user_email);
344d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
3451e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Called when a user got added to the session.
3461e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void AdditionalUserAddedToSession(Profile* profile);
3471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
3483551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the list of all running incarnations of this item.
3493551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // |event_flags| specifies the flags which were set by the event which
3503551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // triggered this menu generation. It can be used to generate different lists.
3515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ChromeLauncherAppMenuItems GetApplicationList(const ash::ShelfItem& item,
3523551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                                                int event_flags);
3533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the list of all tabs which belong to a certain application type.
3553551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  std::vector<content::WebContents*> GetV1ApplicationsFromAppId(
3563551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      std::string app_id);
3573551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3583551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Activates a specified shell application.
3593551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void ActivateShellApp(const std::string& app_id, int index);
3603551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3613551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Checks if a given |web_contents| is known to be associated with an
3623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // application of type |app_id|.
3633551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool IsWebContentHandledByApplication(content::WebContents* web_contents,
3643551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                                        const std::string& app_id);
3653551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3663551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Check if the gMail app is loaded and it can handle the given web content.
3673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // This special treatment is required to address crbug.com/234268.
3683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool ContentCanBeHandledByGmailApp(content::WebContents* web_contents);
3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the favicon for the application list entry for |web_contents|.
3713551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Note that for incognito windows the incognito icon will be returned.
3723551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // If |web_contents| has not loaded, returns the default favicon.
3733551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  gfx::Image GetAppListIcon(content::WebContents* web_contents) const;
3743551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the title for the applicatoin list entry for |web_contents|.
3763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // If |web_contents| has not loaded, returns "Net Tab".
377a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  base::string16 GetAppListTitle(content::WebContents* web_contents) const;
3783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3793551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Returns the LauncherItemController of BrowserShortcut.
38058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  BrowserShortcutLauncherItemController*
38158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      GetBrowserShortcutLauncherItemController();
382424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
3835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  LauncherItemController* GetLauncherItemController(const ash::ShelfID id);
3844e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
3851e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Returns true if |browser| is owned by the active user.
3861e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool IsBrowserFromActiveUser(Browser* browser);
3871e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
3881e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Access to the BrowserStatusMonitor for tests.
3891e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  BrowserStatusMonitor* browser_status_monitor_for_test() {
3901e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    return browser_status_monitor_.get();
3911e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  }
3921e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
393a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Access to the AppWindowLauncherController for tests.
394a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  AppWindowLauncherController* app_window_controller_for_test() {
395a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return app_window_controller_.get();
396f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  }
397f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
3983551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) protected:
3995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Creates a new app shortcut item and controller on the shelf at |index|.
4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Use kInsertItemAtEnd to add a shortcut as the last item.
4015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateAppShortcutLauncherItem(const std::string& app_id,
4025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                             int index);
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class.
4052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // These are intended for testing.
4063551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetAppTabHelperForTest(AppTabHelper* helper);
4073551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetAppIconLoaderForTest(extensions::AppIconLoader* loader);
4085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id);
4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
410a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Sets the ash::ShelfItemDelegateManager only for unittests and doesn't
4114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // take an ownership of it.
412a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void SetShelfItemDelegateManagerForTest(
413a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      ash::ShelfItemDelegateManager* manager);
4144e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
4152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private:
4163551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  friend class ChromeLauncherControllerTest;
4175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  friend class ShelfAppBrowserTest;
4183551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  friend class LauncherPlatformAppBrowserTest;
4193551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap;
4213551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap;
4223551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Remembers / restores list of running applications.
4245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Note that this order will neither be stored in the preference nor will it
4255d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // remember the order of closed applications since it is only temporary.
4265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void RememberUnpinnedRunningApplicationOrder();
4275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id);
4285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
4295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Creates a new app shortcut item and controller on the shelf at |index|.
4303551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Use kInsertItemAtEnd to add a shortcut as the last item.
4315d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateAppShortcutLauncherItemWithType(
4323551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      const std::string& app_id,
4333551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      int index,
4345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      ash::ShelfItemType shelf_item_type);
4353551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Invoked when the associated browser or app is closed.
4375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void LauncherItemClosed(ash::ShelfID id);
4383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Internal helpers for pinning and unpinning that handle both
4403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // client-triggered and internal pinning operations.
4413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void DoPinAppWithID(const std::string& app_id);
442424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  void DoUnpinAppWithID(const std::string& app_id);
4433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Pin a running app with |shelf_id| internally to |index|. It returns
44568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // the index where the item was pinned.
4465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  int PinRunningAppInternal(int index, ash::ShelfID shelf_id);
44768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
44868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Unpin a locked application. This is an internal call which converts the
44968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // model type of the given app index from a shortcut into an unpinned running
45068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // app.
45168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void UnpinRunningAppInternal(int index);
45268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
4535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Re-syncs shelf model with prefs::kPinnedLauncherApps.
4543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void UpdateAppLaunchersFromPref();
4553551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4563551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Persists the shelf auto-hide behavior to prefs.
4573551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior,
4581e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                                     aura::Window* root_window);
4593551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4603551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Sets the shelf auto-hide behavior from prefs.
4613551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfAutoHideBehaviorFromPrefs();
4623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4633551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Sets the shelf alignment from prefs.
4643551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfAlignmentFromPrefs();
4653551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4663551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Sets both of auto-hide behavior and alignment from prefs.
4673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfBehaviorsFromPrefs();
4683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4696d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#if defined(OS_CHROMEOS)
4706d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // Sets whether the virtual keyboard is enabled from prefs.
4716d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  void SetVirtualKeyboardBehaviorFromPrefs();
4726d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#endif  // defined(OS_CHROMEOS)
4736d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
474effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Returns the shelf item status for the given |app_id|, which can be either
475effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // STATUS_ACTIVE (if the app is active), STATUS_RUNNING (if there is such an
476effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // app) or STATUS_CLOSED.
477effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  ash::ShelfItemStatus GetAppState(const::std::string& app_id);
4783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4793551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Creates an app launcher to insert at |index|. Note that |index| may be
4803551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // adjusted by the model to meet ordering constraints.
4815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // The |shelf_item_type| will be set into the ShelfModel.
4825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID InsertAppLauncherItem(LauncherItemController* controller,
4835d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        const std::string& app_id,
4845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        ash::ShelfItemStatus status,
4855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        int index,
4865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        ash::ShelfItemType shelf_item_type);
4873551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool HasItemController(ash::ShelfID id) const;
4893551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4903551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Enumerate all Web contents which match a given shortcut |controller|.
4913551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  std::vector<content::WebContents*> GetV1ApplicationsFromController(
4923551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      LauncherItemController* controller);
4933551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Create ShelfItem for Browser Shortcut.
4955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateBrowserShortcutLauncherItem();
4963551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4973551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Check if the given |web_contents| is in incognito mode.
49868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  bool IsIncognito(const content::WebContents* web_contents) const;
4993551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5003551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Update browser shortcut's index.
5013551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void PersistChromeItemIndex(int index);
5023551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5033551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get browser shortcut's index from pref.
5043551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  int GetChromeIconIndexFromPref() const;
5053551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
50668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Depending on the provided flags, move either the chrome icon, the app icon
50768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // or none to the given |target_index|. The provided |chrome_index| and
50868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // |app_list_index| locations will get adjusted within this call to finalize
50968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // the action and to make sure that the other item can still be moved
51068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // afterwards (index adjustments).
51168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void MoveChromeOrApplistToFinalPosition(
51268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      bool is_chrome,
51368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      bool is_app_list,
51468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      int target_index,
51568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      int* chrome_index,
51668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      int* app_list_index);
51768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
51868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Finds the index of where to insert the next item.
51968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  int FindInsertionPoint(bool is_app_list);
52068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
52168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Get the browser shortcut's index in the shelf using the current's systems
52268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // configuration of pinned and known (but not running) apps.
52368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  int GetChromeIconIndexForCreation();
52468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
52568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Get the list of pinned programs from the preferences.
52668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  std::vector<std::string> GetListOfPinnedAppsAndBrowser();
52768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
5283551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Close all windowed V1 applications of a certain extension which was already
5293551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // deleted.
5303551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void CloseWindowedAppsFromRemovedExtension(const std::string& app_id);
5313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
532a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Set ShelfItemDelegate |item_delegate| for |id| and take an ownership.
5334e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|.
5345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetShelfItemDelegate(ash::ShelfID id,
535a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                            ash::ShelfItemDelegate* item_delegate);
536424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
537d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Attach to a specific profile.
538d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void AttachProfile(Profile* proifile);
539d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
540d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Forget the current profile to allow attaching to a new one.
541d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void ReleaseProfile();
542d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
543f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Returns true if |app_id| is a Packaged App that has already launched on the
544f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // native desktop and, if so, executes it as a desktop shortcut to activate
545f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // desktop mode and send another OnLaunched event to the Extension.
546f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool LaunchedInNativeDesktop(const std::string& app_id);
5471e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
5485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static ChromeLauncherController* instance_;
5493551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
550f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ash::ShelfModel* model_;
5513551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
552a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  ash::ShelfItemDelegateManager* item_delegate_manager_;
5534e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
5543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Profile used for prefs and loading extensions. This is NOT necessarily the
5553551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // profile new windows are created with.
5563551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  Profile* profile_;
5573551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5583551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  IDToItemControllerMap id_to_item_controller_map_;
5593551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5603551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Direct access to app_id for a web contents.
5613551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  WebContentsToAppIDMap web_contents_to_app_id_;
5623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
563a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Used to track app windows.
564a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_ptr<AppWindowLauncherController> app_window_controller_;
5653551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5663551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Used to get app info for tabs.
5673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  scoped_ptr<AppTabHelper> app_tab_helper_;
5683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5693551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Used to load the image for an app item.
5703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  scoped_ptr<extensions::AppIconLoader> app_icon_loader_;
5713551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5723551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  content::NotificationRegistrar notification_registrar_;
5733551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5743551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  PrefChangeRegistrar pref_change_registrar_;
5753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  AppSyncUIState* app_sync_ui_state_;
5773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  scoped_ptr<ExtensionEnableFlow> extension_enable_flow_;
5793551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Shelves that are currently being observed.
5815d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  std::set<ash::Shelf*> shelves_;
5823551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
583424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // The owned browser status monitor.
584424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  scoped_ptr<BrowserStatusMonitor> browser_status_monitor_;
585424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
586d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // A special observer class to detect user switches.
587d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_;
588d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
5893551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // If true, incoming pinned state changes should be ignored.
5903551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool ignore_persist_pinned_state_change_;
5913551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5921e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // True if each user has an own desktop.
5931e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool multi_profile_desktop_separation_;
5941e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
5955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // The list of running & un-pinned applications for different users on hidden
5965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // desktops.
5975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  typedef std::vector<std::string> RunningAppListIds;
5985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap;
5995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  RunningAppListIdMap last_used_running_application_order_;
6005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
6013551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController);
6025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
6035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
605