summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/launcher_page/launcher_page_api.h
blob: 1f5a0dce27c7309a8ae4da22c07fa1ada4f0c4d5 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_API_LAUNCHER_PAGE_LAUNCHER_PAGE_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_LAUNCHER_PAGE_LAUNCHER_PAGE_API_H_

#include "base/macros.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"

namespace app_list {
class AppListSyncableService;
class AppListModel;
}

namespace extensions {

class LauncherPageAPI : public BrowserContextKeyedAPI {
 public:
  explicit LauncherPageAPI(content::BrowserContext* context);
  ~LauncherPageAPI() override;

  app_list::AppListSyncableService* GetService() const;
  static BrowserContextKeyedAPIFactory<LauncherPageAPI>* GetFactoryInstance();

 private:
  friend class BrowserContextKeyedAPIFactory<LauncherPageAPI>;

  // BrowserContextKeyedAPI implementation.
  static const char* service_name() { return "LauncherPageAPI"; }

  static const bool kServiceHasOwnInstanceInIncognito = true;

  app_list::AppListSyncableService* service_;
};

class LauncherPagePushSubpageFunction : public UIThreadExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("launcherPage.pushSubpage",
                             LAUNCHERPAGE_PUSHSUBPAGE);

  LauncherPagePushSubpageFunction();

 protected:
  ~LauncherPagePushSubpageFunction() override {}

  ResponseAction Run() override;

 private:
  DISALLOW_COPY_AND_ASSIGN(LauncherPagePushSubpageFunction);
};

class LauncherPageShowFunction : public UIThreadExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("launcherPage.show", LAUNCHERPAGE_SHOW);

  LauncherPageShowFunction();

 protected:
  ~LauncherPageShowFunction() override {}

  ResponseAction Run() override;

 private:
  DISALLOW_COPY_AND_ASSIGN(LauncherPageShowFunction);
};

class LauncherPageHideFunction : public UIThreadExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("launcherPage.hide", LAUNCHERPAGE_HIDE);

  LauncherPageHideFunction();

 protected:
  ~LauncherPageHideFunction() override {}

  ResponseAction Run() override;

 private:
  DISALLOW_COPY_AND_ASSIGN(LauncherPageHideFunction);
};

class LauncherPageSetEnabledFunction : public UIThreadExtensionFunction {
 public:
  DECLARE_EXTENSION_FUNCTION("launcherPage.setEnabled",
                             LAUNCHERPAGE_SETENABLED);

  LauncherPageSetEnabledFunction();

 protected:
  ~LauncherPageSetEnabledFunction() override {}

  ResponseAction Run() override;

 private:
  DISALLOW_COPY_AND_ASSIGN(LauncherPageSetEnabledFunction);
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_LAUNCHER_PAGE_LAUNCHER_PAGE_API_H_