summaryrefslogtreecommitdiffstats
path: root/ash/launcher/launcher_delegate.h
blob: 3766ca331b157f3b14e53597095ef9ddb777c94a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_LAUNCHER_LAUNCHER_DELEGATE_H_
#define ASH_LAUNCHER_LAUNCHER_DELEGATE_H_

#include "ash/ash_export.h"
#include "ash/launcher/launcher_types.h"

namespace aura {
class Window;
}

namespace ash {
class Launcher;

// Delegate for the Launcher.
class ASH_EXPORT LauncherDelegate {
 public:
  // Launcher owns the delegate.
  virtual ~LauncherDelegate() {}

  // Returns the id of the item associated with the specified window, or 0 if
  // there isn't one.
  // Note: Windows of tabbed browsers will return the |LauncherID| of the
  // currently active tab or selected tab.
  // TODO(simon.hong81): Remove this and handle in LauncherItemDelegateManager.
  virtual LauncherID GetIDByWindow(aura::Window* window) = 0;

  // Callback used to allow delegate to perform initialization actions that
  // depend on the Launcher being in a known state.
  virtual void OnLauncherCreated(Launcher* launcher) = 0;

  // Callback used to inform the delegate that a specific launcher no longer
  // exists.
  virtual void OnLauncherDestroyed(Launcher* launcher) = 0;

  // Get the launcher ID from an application ID.
  virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) = 0;

  // Get the application ID for a given launcher ID.
  virtual const std::string& GetAppIDForLauncherID(LauncherID id) = 0;

  // Pins an app with |app_id| to launcher. A running instance will get pinned.
  // In case there is no running instance a new launcher item is created and
  // pinned.
  virtual void PinAppWithID(const std::string& app_id) = 0;

  // Check if the app with |app_id_| is pinned to the launcher.
  virtual bool IsAppPinned(const std::string& app_id) = 0;

  // Checks whether the user is allowed to pin/unpin apps. Pinning may be
  // disallowed by policy in case there is a pre-defined set of pinned apps.
  virtual bool CanPin() const = 0;

  // Unpins app item with |app_id|.
  virtual void UnpinAppWithID(const std::string& app_id) = 0;
};

}  // namespace ash

#endif  // ASH_LAUNCHER_LAUNCHER_DELEGATE_H_