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