app_list_service.h revision 1e9bf3e0803691d0a228da41fc608347b6db4340
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_
6#define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_
7
8#include <string>
9
10#include "base/basictypes.h"
11#include "base/callback_forward.h"
12#include "base/compiler_specific.h"
13#include "chrome/browser/ui/host_desktop.h"
14#include "ui/gfx/native_widget_types.h"
15
16class AppListControllerDelegate;
17class CommandLine;
18class PrefRegistrySimple;
19class Profile;
20
21namespace base {
22class FilePath;
23}
24
25namespace gfx {
26class ImageSkia;
27}
28
29class AppListService {
30 public:
31  // Get the AppListService for the current platform and specified
32  // |desktop_type|.
33  static AppListService* Get(chrome::HostDesktopType desktop_type);
34
35  // Call Init for all AppListService instances on this platform.
36  static void InitAll(Profile* initial_profile);
37
38  static void RegisterPrefs(PrefRegistrySimple* registry);
39
40  static void RecordShowTimings(const CommandLine& command_line);
41
42  // Indicates that |callback| should be called next time the app list is
43  // painted.
44  virtual void SetAppListNextPaintCallback(const base::Closure& callback) = 0;
45
46  // Perform Chrome first run logic. This is executed before Chrome's threads
47  // have been created.
48  virtual void HandleFirstRun() = 0;
49
50  virtual base::FilePath GetProfilePath(
51      const base::FilePath& user_data_dir) = 0;
52  virtual void SetProfilePath(const base::FilePath& profile_path) = 0;
53
54  // Show the app list for the profile configured in the user data dir for the
55  // current browser process.
56  virtual void Show() = 0;
57
58  // Create the app list UI, and maintain its state, but do not show it.
59  virtual void CreateForProfile(Profile* requested_profile) = 0;
60
61  // Show the app list for the given profile. If it differs from the profile the
62  // app list is currently showing, repopulate the app list and save the new
63  // profile to local prefs as the default app list profile.
64  virtual void ShowForProfile(Profile* requested_profile) = 0;
65
66  // Dismiss the app list.
67  virtual void DismissAppList() = 0;
68
69  // Get the profile the app list is currently showing.
70  virtual Profile* GetCurrentAppListProfile() = 0;
71
72  // Returns true if the app list is visible.
73  virtual bool IsAppListVisible() const = 0;
74
75  // Enable the app list. What this does specifically will depend on the host
76  // operating system and shell.
77  virtual void EnableAppList(Profile* initial_profile) = 0;
78
79  // Get the window the app list is in, or NULL if the app list isn't visible.
80  virtual gfx::NativeWindow GetAppListWindow() = 0;
81
82  // Creates a platform specific AppListControllerDelegate.
83  virtual AppListControllerDelegate* CreateControllerDelegate() = 0;
84
85 protected:
86  AppListService() {}
87  virtual ~AppListService() {}
88
89  // Do any once off initialization needed for the app list.
90  virtual void Init(Profile* initial_profile) = 0;
91
92 private:
93  DISALLOW_COPY_AND_ASSIGN(AppListService);
94};
95
96#endif  // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_
97