- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / app_list / win / app_list_service_win.h
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_VIEWS_APP_LIST_WIN_APP_LIST_SERVICE_WIN_H_
6 #define CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_SERVICE_WIN_H_
7
8 #include "base/memory/singleton.h"
9 #include "chrome/browser/ui/app_list/app_list_service_impl.h"
10
11 namespace app_list{
12 class AppListModel;
13 }
14
15 class AppListShower;
16
17 // Exposes methods required by the AppListServiceTestApi on Windows.
18 // TODO(tapted): Remove testing methods once they can access the implementation
19 // from the test api.
20 class AppListServiceWin : public AppListServiceImpl {
21  public:
22   AppListServiceWin();
23   virtual ~AppListServiceWin();
24
25   app_list::AppListModel* GetAppListModelForTesting();
26
27   static AppListServiceWin* GetInstance();
28   void set_can_close(bool can_close);
29   void OnAppListClosing();
30
31   // AppListService overrides:
32   virtual void SetAppListNextPaintCallback(
33       const base::Closure& callback) OVERRIDE;
34   virtual void HandleFirstRun() OVERRIDE;
35   virtual void Init(Profile* initial_profile) OVERRIDE;
36   virtual void CreateForProfile(Profile* requested_profile) OVERRIDE;
37   virtual void ShowForProfile(Profile* requested_profile) OVERRIDE;
38   virtual void DismissAppList() OVERRIDE;
39   virtual bool IsAppListVisible() const OVERRIDE;
40   virtual gfx::NativeWindow GetAppListWindow() OVERRIDE;
41   virtual Profile* GetCurrentAppListProfile() OVERRIDE;
42   virtual AppListControllerDelegate* CreateControllerDelegate() OVERRIDE;
43
44   // AppListServiceImpl overrides:
45   virtual void CreateShortcut() OVERRIDE;
46
47  private:
48   friend struct DefaultSingletonTraits<AppListServiceWin>;
49
50   bool IsWarmupNeeded();
51   void ScheduleWarmup();
52
53   // Loads the profile last used with the app list and populates the view from
54   // it without showing it so that the next show is faster. Does nothing if the
55   // view already exists, or another profile is in the middle of being loaded to
56   // be shown.
57   void LoadProfileForWarmup();
58   void OnLoadProfileForWarmup(Profile* initial_profile);
59
60   // Responsible for putting views on the screen.
61   scoped_ptr<AppListShower> shower_;
62
63   bool enable_app_list_on_next_init_;
64
65   base::WeakPtrFactory<AppListServiceWin> weak_factory_;
66
67   DISALLOW_COPY_AND_ASSIGN(AppListServiceWin);
68 };
69
70 namespace chrome {
71
72 AppListService* GetAppListServiceWin();
73
74 }  // namespace chrome
75
76 #endif  // CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_SERVICE_WIN_H_