app_list_service_win.h revision f8ee788a64d60abd8f2d742a5fdedde054ecd910
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/callback.h"
9#include "base/memory/scoped_ptr.h"
10#include "chrome/browser/ui/app_list/app_list_service_views.h"
11
12class ActivationTrackerWin;
13
14template <typename T> struct DefaultSingletonTraits;
15
16class AppListServiceWin : public AppListServiceViews {
17 public:
18  virtual ~AppListServiceWin();
19
20  static AppListServiceWin* GetInstance();
21
22  // AppListService overrides:
23  virtual void SetAppListNextPaintCallback(void (*callback)()) OVERRIDE;
24  virtual void HandleFirstRun() OVERRIDE;
25  virtual void Init(Profile* initial_profile) OVERRIDE;
26  virtual void ShowForProfile(Profile* requested_profile) OVERRIDE;
27  virtual void CreateShortcut() OVERRIDE;
28
29 private:
30  friend struct DefaultSingletonTraits<AppListServiceWin>;
31
32  // AppListServiceViews overrides:
33  virtual void OnViewBeingDestroyed();
34
35  // AppListShowerDelegate overrides:
36  virtual void OnViewCreated() OVERRIDE;
37  virtual void OnViewDismissed() OVERRIDE;
38  virtual void MoveNearCursor(app_list::AppListView* view) OVERRIDE;
39
40  AppListServiceWin();
41
42  bool IsWarmupNeeded();
43  void ScheduleWarmup();
44
45  // Loads the profile last used with the app list and populates the view from
46  // it without showing it so that the next show is faster. Does nothing if the
47  // view already exists, or another profile is in the middle of being loaded to
48  // be shown.
49  void LoadProfileForWarmup();
50  void OnLoadProfileForWarmup(Profile* initial_profile);
51
52  bool enable_app_list_on_next_init_;
53  scoped_ptr<ActivationTrackerWin> activation_tracker_;
54
55  base::Closure next_paint_callback_;
56
57  DISALLOW_COPY_AND_ASSIGN(AppListServiceWin);
58};
59
60#endif  // CHROME_BROWSER_UI_VIEWS_APP_LIST_WIN_APP_LIST_SERVICE_WIN_H_
61