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"
341320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci#include "extensions/browser/extension_registry_observer.h"
353551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)#include "ui/aura/window_observer.h"
363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
373551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class AppSyncUIState;
383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class Browser;
393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class BrowserShortcutLauncherItemController;
40424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)class BrowserStatusMonitor;
413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class ExtensionEnableFlow;
423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class GURL;
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class LauncherItemController;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Profile;
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class AppWindowLauncherController;
463551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)class TabContents;
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash {
49a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ShelfItemDelegateManager;
50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class ShelfModel;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace aura {
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Window;
555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
581320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucciclass BrowserContext;
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)  DISALLOW_COPY_AND_ASSIGN(ChromeLauncherControllerUserSwitchObserver);
82d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)};
83d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// ChromeLauncherController manages the launcher items needed for content
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// windows. Launcher items have a type, an optional app id, and a controller.
863551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// This incarnation groups running tabs/windows in application specific lists.
873551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// * Browser app windows have BrowserLauncherItemController, owned by the
883551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)//   BrowserView instance.
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)// * App windows have AppWindowLauncherItemController, owned by
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)//   AppWindowLauncherController.
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// * Shortcuts have no LauncherItemController.
92a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ChromeLauncherController : public ash::ShelfDelegate,
93f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                 public ash::ShelfModelObserver,
9468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ash::ShellObserver,
9568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ash::DisplayController::Observer,
961320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                 public extensions::ExtensionRegistryObserver,
9768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public extensions::AppIconLoader::Delegate,
9868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public PrefServiceSyncableObserver,
9968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public AppSyncUIStateObserver,
10068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ExtensionEnableFlowDelegate,
10168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                 public ash::ShelfLayoutManagerObserver {
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
1035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Indicates if a shelf item is incognito or not.
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum IncognitoState {
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    STATE_INCOGNITO,
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    STATE_NOT_INCOGNITO,
1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Used to update the state of non plaform apps, as web contents change.
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  enum AppState {
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_ACTIVE,
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_WINDOW_ACTIVE,
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_INACTIVE,
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    APP_STATE_REMOVED
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Mockable interface to get app ids from tabs.
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  class AppTabHelper {
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)   public:
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    virtual ~AppTabHelper() {}
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    // Returns the app id of the specified tab, or an empty string if there is
1234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // no app. All known profiles will be queried for this.
1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    virtual std::string GetAppID(content::WebContents* tab) = 0;
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Returns true if |id| is valid for the currently active profile.
1274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Used during restore to ignore no longer valid extensions.
1284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Note that already running applications are ignored by the restore
1294e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // process.
1304e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    virtual bool IsValidIDForCurrentUser(const std::string& id) = 0;
1314e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
1324e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    // Sets the currently active profile for the usage of |GetAppID|.
1334e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    virtual void SetCurrentUser(Profile* profile) = 0;
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
136f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ChromeLauncherController(Profile* profile, ash::ShelfModel* model);
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~ChromeLauncherController();
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Initializes this ChromeLauncherController.
1403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void Init();
1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Creates an instance.
1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  static ChromeLauncherController* CreateInstance(Profile* profile,
144f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                                                  ash::ShelfModel* model);
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the single ChromeLauncherController instance.
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static ChromeLauncherController* instance() { return instance_; }
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Creates a new app item on the shelf for |controller|.
1505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateAppLauncherItem(LauncherItemController* controller,
1515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                     const std::string& app_id,
1525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                     ash::ShelfItemStatus status);
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1543551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Updates the running status of an item. It will also update the status of
1555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // browsers shelf item if needed.
1565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetItemStatus(ash::ShelfID id, ash::ShelfItemStatus status);
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates the controller associated with id (which should be a shortcut).
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |controller| remains owned by caller.
1605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetItemController(ash::ShelfID id, LauncherItemController* controller);
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Closes or unpins the shelf item.
1635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void CloseLauncherItem(ash::ShelfID id);
1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Pins the specified id. Currently only supports platform apps.
1665d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Pin(ash::ShelfID id);
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Unpins the specified id, closing if not running.
1695d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Unpin(ash::ShelfID id);
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the item identified by |id| is pinned.
1725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsPinned(ash::ShelfID id);
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Pins/unpins the specified id.
1755d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void TogglePinned(ash::ShelfID id);
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the specified item can be pinned or unpinned. Only apps can
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // be pinned.
1795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsPinnable(ash::ShelfID id) const;
1802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
181cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Installs the specified id. Only valid if the id corresponds to an ephemeral
182cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // app.
183cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void Install(ash::ShelfID id);
184cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
185cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // Returns true if the specified item can be installed. Only true for
186cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  // ephemeral apps.
187cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool CanInstall(ash::ShelfID id);
188cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
1895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // If there is no shelf item in the shelf for application |app_id|, one
1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // gets created. The (existing or created) shelf items get then locked
1912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // against a users un-pinning removal.
1923551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void LockV1AppWithID(const std::string& app_id);
1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // A previously locked shelf item of type |app_id| gets unlocked. If the
1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // lock count reaches 0 and the item is not pinned it will go away.
1963551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void UnlockV1AppWithID(const std::string& app_id);
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Requests that the shelf item controller specified by |id| open a new
1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // instance of the app.  |event_flags| holds the flags of the event which
2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // triggered this command.
2015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Launch(ash::ShelfID id, int event_flags);
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Closes the specified item.
2045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void Close(ash::ShelfID id);
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the specified item is open.
2075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsOpen(ash::ShelfID id);
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the specified item is for a platform app.
2105d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool IsPlatformApp(ash::ShelfID id);
2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Opens a new instance of the application identified by |app_id|.
2135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Used by the app-list, and by pinned-app shelf items.
21468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void LaunchApp(const std::string& app_id,
21568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                 ash::LaunchSource source,
21668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                 int event_flags);
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If |app_id| is running, reactivates the app's most recently active window,
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // otherwise launches and activates the app.
2205d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Used by the app-list, and by pinned-app shelf items.
22168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void ActivateApp(const std::string& app_id,
22268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                   ash::LaunchSource source,
22368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                   int event_flags);
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the launch type of app for the specified id.
2265d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  extensions::LaunchType GetLaunchType(ash::ShelfID id);
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Set the image for a specific shelf item (e.g. when set by the app).
2295d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetLauncherItemImage(ash::ShelfID shelf_id, const gfx::ImageSkia& image);
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Find out if the given application |id| is a windowed app item and not a
2325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // pinned item in the shelf.
2333551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool IsWindowedAppInLauncher(const std::string& app_id);
2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Updates the launch type of the app for the specified id to |launch_type|.
2365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetLaunchType(ash::ShelfID id, extensions::LaunchType launch_type);
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the user is currently logged in as a guest.
2393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Makes virtual for unittest in LauncherContextMenuTest.
2403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual bool IsLoggedInAsGuest();
2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Invoked when user clicks on button in the shelf and there is no last
2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // used window (or CTRL is held with the click).
2443551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void CreateNewWindow();
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Invoked when the user clicks on button in the shelf to create a new
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // incognito window.
2483551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void CreateNewIncognitoWindow();
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates the pinned pref state. The pinned state consists of a list pref.
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Each item of the list is a dictionary. The key |kAppIDPath| gives the
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // id of the app.
2533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void PersistPinnedState();
2542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
255f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ash::ShelfModel* model();
2562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
257d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Accessor to the currently loaded profile. Note that in multi profile use
258d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // cases this might change over time.
2593551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  Profile* profile();
2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Gets the shelf auto-hide behavior on |root_window|.
2623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  ash::ShelfAutoHideBehavior GetShelfAutoHideBehavior(
2631e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      aura::Window* root_window) const;
2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns |true| if the user is allowed to modify the shelf auto-hide
2662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // behavior on |root_window|.
2671e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool CanUserModifyShelfAutoHideBehavior(aura::Window* root_window) const;
2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Toggles the shelf auto-hide behavior on |root_window|. Does nothing if the
2702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // user is not allowed to modify the auto-hide behavior.
2711e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void ToggleShelfAutoHideBehavior(aura::Window* root_window);
2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Notify the controller that the state of an non platform app's tabs
2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // have changed,
2753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void UpdateAppState(content::WebContents* contents, AppState app_state);
2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2775d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns ShelfID for |contents|. If |contents| is not an app or is not
278f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // pinned, returns the id of browser shrotcut.
2795d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID GetShelfIDForWebContents(content::WebContents* contents);
280f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Limits application refocusing to urls that match |url| for |id|.
2825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetRefocusURLPatternForTest(ash::ShelfID id, const GURL& url);
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the extension identified by |app_id|.
2853551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  const extensions::Extension* GetExtensionForAppID(
2863551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      const std::string& app_id) const;
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
288c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Activates a |window|. If |allow_minimize| is true and the system allows
289c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // it, the the window will get minimized instead.
2903551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void ActivateWindowOrMinimizeIfActive(ui::BaseWindow* window,
2913551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                                        bool allow_minimize);
2923551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
293a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // ash::ShelfDelegate overrides:
2945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnShelfCreated(ash::Shelf* shelf) OVERRIDE;
2955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void OnShelfDestroyed(ash::Shelf* shelf) OVERRIDE;
2965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual ash::ShelfID GetShelfIDForAppID(const std::string& app_id) OVERRIDE;
2975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual const std::string& GetAppIDForShelfID(ash::ShelfID id) OVERRIDE;
298424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual void PinAppWithID(const std::string& app_id) OVERRIDE;
299424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual bool IsAppPinned(const std::string& app_id) OVERRIDE;
30058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  virtual bool CanPin() const OVERRIDE;
301424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE;
302424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
303f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // ash::ShelfModelObserver overrides:
304f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfItemAdded(int index) OVERRIDE;
3055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void ShelfItemRemoved(int index, ash::ShelfID id) OVERRIDE;
306f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfItemMoved(int start_index, int target_index) OVERRIDE;
307f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfItemChanged(int index,
3085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                const ash::ShelfItem& old_item) OVERRIDE;
309f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void ShelfStatusChanged() OVERRIDE;
3103551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3113551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ash::ShellObserver overrides:
3121e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE;
3133551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3143551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ash::DisplayController::Observer overrides:
3153551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnDisplayConfigurationChanged() OVERRIDE;
3163551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3171320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  // ExtensionRegistryObserver overrides:
3181320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void OnExtensionLoaded(
3191320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      content::BrowserContext* browser_context,
3201320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const extensions::Extension* extension) OVERRIDE;
3211320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual void OnExtensionUnloaded(
3221320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      content::BrowserContext* browser_context,
3231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      const extensions::Extension* extension,
3241320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
3251320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
3263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // PrefServiceSyncableObserver overrides:
3273551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnIsSyncingChanged() OVERRIDE;
3283551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3293551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // AppSyncUIStateObserver overrides:
3303551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnAppSyncUIStatusChanged() OVERRIDE;
3313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3323551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ExtensionEnableFlowDelegate overrides:
3333551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void ExtensionEnableFlowFinished() OVERRIDE;
3343551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void ExtensionEnableFlowAborted(bool user_initiated) OVERRIDE;
3352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // extensions::AppIconLoader overrides:
3372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void SetAppImage(const std::string& app_id,
3383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                           const gfx::ImageSkia& image) OVERRIDE;
3392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
3403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // ash::ShelfLayoutManagerObserver overrides:
3413551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void OnAutoHideBehaviorChanged(
3421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)      aura::Window* root_window,
3433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      ash::ShelfAutoHideBehavior new_behavior) OVERRIDE;
3443551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
345d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Called when the active user has changed.
346d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void ActiveUserChanged(const std::string& user_email);
347d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
3481e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Called when a user got added to the session.
3491e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  void AdditionalUserAddedToSession(Profile* profile);
3501e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
3513551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the list of all running incarnations of this item.
3523551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // |event_flags| specifies the flags which were set by the event which
3533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // triggered this menu generation. It can be used to generate different lists.
3545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ChromeLauncherAppMenuItems GetApplicationList(const ash::ShelfItem& item,
3553551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                                                int event_flags);
3563551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3573551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the list of all tabs which belong to a certain application type.
3583551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  std::vector<content::WebContents*> GetV1ApplicationsFromAppId(
3593551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      std::string app_id);
3603551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3613551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Activates a specified shell application.
3623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void ActivateShellApp(const std::string& app_id, int index);
3633551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3643551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Checks if a given |web_contents| is known to be associated with an
3653551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // application of type |app_id|.
3663551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool IsWebContentHandledByApplication(content::WebContents* web_contents,
3673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)                                        const std::string& app_id);
3683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3693551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Check if the gMail app is loaded and it can handle the given web content.
3703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // This special treatment is required to address crbug.com/234268.
3713551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool ContentCanBeHandledByGmailApp(content::WebContents* web_contents);
3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3733551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the favicon for the application list entry for |web_contents|.
3743551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Note that for incognito windows the incognito icon will be returned.
3753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // If |web_contents| has not loaded, returns the default favicon.
3763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  gfx::Image GetAppListIcon(content::WebContents* web_contents) const;
3773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get the title for the applicatoin list entry for |web_contents|.
3793551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // If |web_contents| has not loaded, returns "Net Tab".
380a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  base::string16 GetAppListTitle(content::WebContents* web_contents) const;
3813551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
3823551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Returns the LauncherItemController of BrowserShortcut.
38358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)  BrowserShortcutLauncherItemController*
38458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)      GetBrowserShortcutLauncherItemController();
385424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
3865d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  LauncherItemController* GetLauncherItemController(const ash::ShelfID id);
3874e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
3881e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Returns true if |browser| is owned by the active user.
3891e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool IsBrowserFromActiveUser(Browser* browser);
3901e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
3915f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // Check if the shelf visibility (location, visibility) will change with a new
3925f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // user profile or not. However, since the full visibility calculation of the
3935f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // shelf cannot be performed here, this is only a probability used for
3945f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  // animation predictions.
3955f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  bool ShelfBoundsChangesProbablyWithUser(aura::Window* root_window,
3965f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                                          const std::string& user_id) const;
3975f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
3981e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // Access to the BrowserStatusMonitor for tests.
3991e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  BrowserStatusMonitor* browser_status_monitor_for_test() {
4001e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)    return browser_status_monitor_.get();
4011e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  }
4021e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
403a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Access to the AppWindowLauncherController for tests.
404a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  AppWindowLauncherController* app_window_controller_for_test() {
405a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)    return app_window_controller_.get();
406f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  }
407f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
4083551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) protected:
4095d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Creates a new app shortcut item and controller on the shelf at |index|.
4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Use kInsertItemAtEnd to add a shortcut as the last item.
4115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateAppShortcutLauncherItem(const std::string& app_id,
4125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                             int index);
4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Sets the AppTabHelper/AppIconLoader, taking ownership of the helper class.
4152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // These are intended for testing.
4163551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetAppTabHelperForTest(AppTabHelper* helper);
4173551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetAppIconLoaderForTest(extensions::AppIconLoader* loader);
4185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  const std::string& GetAppIdFromShelfIdForTest(ash::ShelfID id);
4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
420a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Sets the ash::ShelfItemDelegateManager only for unittests and doesn't
4214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // take an ownership of it.
422a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void SetShelfItemDelegateManagerForTest(
423a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      ash::ShelfItemDelegateManager* manager);
4244e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
4252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private:
4263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  friend class ChromeLauncherControllerTest;
4275d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  friend class ShelfAppBrowserTest;
4283551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  friend class LauncherPlatformAppBrowserTest;
4293551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4305d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  typedef std::map<ash::ShelfID, LauncherItemController*> IDToItemControllerMap;
4313551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  typedef std::map<content::WebContents*, std::string> WebContentsToAppIDMap;
4323551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Remembers / restores list of running applications.
4345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Note that this order will neither be stored in the preference nor will it
4355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // remember the order of closed applications since it is only temporary.
4365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void RememberUnpinnedRunningApplicationOrder();
4375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void RestoreUnpinnedRunningApplicationOrder(const std::string& user_id);
4385d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
4395d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Creates a new app shortcut item and controller on the shelf at |index|.
4403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Use kInsertItemAtEnd to add a shortcut as the last item.
4415d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateAppShortcutLauncherItemWithType(
4423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      const std::string& app_id,
4433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      int index,
4445d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      ash::ShelfItemType shelf_item_type);
4453551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4463551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Invoked when the associated browser or app is closed.
4475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void LauncherItemClosed(ash::ShelfID id);
4483551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4493551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Internal helpers for pinning and unpinning that handle both
4503551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // client-triggered and internal pinning operations.
4513551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void DoPinAppWithID(const std::string& app_id);
452424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  void DoUnpinAppWithID(const std::string& app_id);
4533551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Pin a running app with |shelf_id| internally to |index|. It returns
45568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // the index where the item was pinned.
4565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  int PinRunningAppInternal(int index, ash::ShelfID shelf_id);
45768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
45868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Unpin a locked application. This is an internal call which converts the
45968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // model type of the given app index from a shortcut into an unpinned running
46068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // app.
46168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void UnpinRunningAppInternal(int index);
46268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
4635d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Re-syncs shelf model with prefs::kPinnedLauncherApps.
4643551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void UpdateAppLaunchersFromPref();
4653551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4663551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Persists the shelf auto-hide behavior to prefs.
4673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior,
4681e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)                                     aura::Window* root_window);
4693551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Sets the shelf auto-hide behavior from prefs.
4713551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfAutoHideBehaviorFromPrefs();
4723551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4733551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Sets the shelf alignment from prefs.
4743551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfAlignmentFromPrefs();
4753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Sets both of auto-hide behavior and alignment from prefs.
4773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void SetShelfBehaviorsFromPrefs();
4783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4796d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#if defined(OS_CHROMEOS)
4806d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  // Sets whether the virtual keyboard is enabled from prefs.
4816d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  void SetVirtualKeyboardBehaviorFromPrefs();
4826d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#endif  // defined(OS_CHROMEOS)
4836d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)
484effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // Returns the shelf item status for the given |app_id|, which can be either
485effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // STATUS_ACTIVE (if the app is active), STATUS_RUNNING (if there is such an
486effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  // app) or STATUS_CLOSED.
487116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  ash::ShelfItemStatus GetAppState(const std::string& app_id);
4883551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4893551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Creates an app launcher to insert at |index|. Note that |index| may be
4903551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // adjusted by the model to meet ordering constraints.
4915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // The |shelf_item_type| will be set into the ShelfModel.
4925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID InsertAppLauncherItem(LauncherItemController* controller,
4935d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        const std::string& app_id,
4945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        ash::ShelfItemStatus status,
4955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        int index,
4965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                        ash::ShelfItemType shelf_item_type);
4973551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
4985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  bool HasItemController(ash::ShelfID id) const;
4993551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5003551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Enumerate all Web contents which match a given shortcut |controller|.
5013551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  std::vector<content::WebContents*> GetV1ApplicationsFromController(
5023551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      LauncherItemController* controller);
5033551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Create ShelfItem for Browser Shortcut.
5055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ash::ShelfID CreateBrowserShortcutLauncherItem();
5063551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5073551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Check if the given |web_contents| is in incognito mode.
50868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  bool IsIncognito(const content::WebContents* web_contents) const;
5093551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5103551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Update browser shortcut's index.
5113551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  void PersistChromeItemIndex(int index);
5123551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5133551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Get browser shortcut's index from pref.
5143551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  int GetChromeIconIndexFromPref() const;
5153551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
51668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Depending on the provided flags, move either the chrome icon, the app icon
51768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // or none to the given |target_index|. The provided |chrome_index| and
51868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // |app_list_index| locations will get adjusted within this call to finalize
51968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // the action and to make sure that the other item can still be moved
52068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // afterwards (index adjustments).
52168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  void MoveChromeOrApplistToFinalPosition(
52268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      bool is_chrome,
52368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      bool is_app_list,
52468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      int target_index,
52568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      int* chrome_index,
52668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)      int* app_list_index);
52768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
52868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Finds the index of where to insert the next item.
52968043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  int FindInsertionPoint(bool is_app_list);
53068043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
53168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Get the browser shortcut's index in the shelf using the current's systems
53268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // configuration of pinned and known (but not running) apps.
53368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  int GetChromeIconIndexForCreation();
53468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
53568043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  // Get the list of pinned programs from the preferences.
53668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  std::vector<std::string> GetListOfPinnedAppsAndBrowser();
53768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)
5383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Close all windowed V1 applications of a certain extension which was already
5393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // deleted.
5401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  void CloseWindowedAppsFromRemovedExtension(const std::string& app_id,
5411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci                                             const Profile* profile);
5423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
543a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Set ShelfItemDelegate |item_delegate| for |id| and take an ownership.
5444e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  // TODO(simon.hong81): Make this take a scoped_ptr of |item_delegate|.
5455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void SetShelfItemDelegate(ash::ShelfID id,
546a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                            ash::ShelfItemDelegate* item_delegate);
547424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
548d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Attach to a specific profile.
549d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void AttachProfile(Profile* proifile);
550d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
551d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // Forget the current profile to allow attaching to a new one.
552d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  void ReleaseProfile();
553d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
554f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Returns true if |app_id| is a Packaged App that has already launched on the
555f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // native desktop and, if so, executes it as a desktop shortcut to activate
556f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // desktop mode and send another OnLaunched event to the Extension.
557f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  bool LaunchedInNativeDesktop(const std::string& app_id);
5581e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
5595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static ChromeLauncherController* instance_;
5603551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
561f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  ash::ShelfModel* model_;
5623551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
563a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  ash::ShelfItemDelegateManager* item_delegate_manager_;
5644e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)
5653551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Profile used for prefs and loading extensions. This is NOT necessarily the
5663551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // profile new windows are created with.
5673551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  Profile* profile_;
5683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5693551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  IDToItemControllerMap id_to_item_controller_map_;
5703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5713551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Direct access to app_id for a web contents.
5723551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  WebContentsToAppIDMap web_contents_to_app_id_;
5733551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
574a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  // Used to track app windows.
575a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  scoped_ptr<AppWindowLauncherController> app_window_controller_;
5763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Used to get app info for tabs.
5783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  scoped_ptr<AppTabHelper> app_tab_helper_;
5793551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5803551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // Used to load the image for an app item.
5813551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  scoped_ptr<extensions::AppIconLoader> app_icon_loader_;
5823551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5833551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  PrefChangeRegistrar pref_change_registrar_;
5843551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5853551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  AppSyncUIState* app_sync_ui_state_;
5863551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5873551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  scoped_ptr<ExtensionEnableFlow> extension_enable_flow_;
5883551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
5895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Shelves that are currently being observed.
5905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  std::set<ash::Shelf*> shelves_;
5913551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
592424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  // The owned browser status monitor.
593424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  scoped_ptr<BrowserStatusMonitor> browser_status_monitor_;
594424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
595d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  // A special observer class to detect user switches.
596d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)  scoped_ptr<ChromeLauncherControllerUserSwitchObserver> user_switch_observer_;
597d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)
5983551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  // If true, incoming pinned state changes should be ignored.
5993551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  bool ignore_persist_pinned_state_change_;
6003551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
6011e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // True if each user has an own desktop.
6021e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool multi_profile_desktop_separation_;
6031e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)
6045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // The list of running & un-pinned applications for different users on hidden
6055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // desktops.
6065d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  typedef std::vector<std::string> RunningAppListIds;
6075d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  typedef std::map<std::string, RunningAppListIds> RunningAppListIdMap;
6085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  RunningAppListIdMap last_used_running_application_order_;
6095d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
6103551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ChromeLauncherController);
6115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
6125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_ASH_LAUNCHER_CHROME_LAUNCHER_CONTROLLER_H_
614