OLD | NEW |
| (Empty) |
1 // Copyright 2014 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_VIEWS_H_ | |
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "chrome/browser/ui/app_list/app_list_service_impl.h" | |
12 #include "chrome/browser/ui/app_list/app_list_shower_delegate.h" | |
13 #include "chrome/browser/ui/app_list/app_list_shower_views.h" | |
14 #include "ui/app_list/app_list_model.h" | |
15 | |
16 class AppListControllerDelegate; | |
17 | |
18 // AppListServiceViews manages a desktop app list that uses toolkit-views. | |
19 class AppListServiceViews : public AppListServiceImpl, | |
20 public AppListShowerDelegate { | |
21 public: | |
22 explicit AppListServiceViews( | |
23 std::unique_ptr<AppListControllerDelegate> controller_delegate); | |
24 ~AppListServiceViews() override; | |
25 | |
26 // Set |can_dismiss| to prevent the app list dismissing when losing focus. For | |
27 // example, while showing a window-modal dialog. | |
28 void set_can_dismiss(bool can_dismiss) { can_dismiss_ = can_dismiss; } | |
29 | |
30 AppListShower& shower() { return shower_; } | |
31 | |
32 // Called by the AppListControllerDelegate when it is told that the app list | |
33 // view must be destroyed. | |
34 virtual void OnViewBeingDestroyed(); | |
35 | |
36 // AppListService overrides: | |
37 void Init(Profile* initial_profile) override; | |
38 void ShowForProfile(Profile* requested_profile) override; | |
39 void ShowForAppInstall(Profile* profile, | |
40 const std::string& extension_id, | |
41 bool start_discovery_tracking) override; | |
42 void ShowForCustomLauncherPage(Profile* profile) override; | |
43 void HideCustomLauncherPage() override; | |
44 void DismissAppList() override; | |
45 bool IsAppListVisible() const override; | |
46 gfx::NativeWindow GetAppListWindow() override; | |
47 Profile* GetCurrentAppListProfile() override; | |
48 AppListControllerDelegate* GetControllerDelegate() override; | |
49 | |
50 // AppListServiceImpl overrides: | |
51 void CreateForProfile(Profile* requested_profile) override; | |
52 void DestroyAppList() override; | |
53 | |
54 // AppListShowerDelegate overrides: | |
55 AppListViewDelegate* GetViewDelegateForCreate() override; | |
56 | |
57 private: | |
58 // Switches to |state|, unless it is |INVALID_STATE| (in which case, opens on | |
59 // the default state). | |
60 void ShowForProfileInternal(Profile* profile, | |
61 app_list::AppListModel::State state); | |
62 | |
63 // Responsible for creating the app list and responding to profile changes. | |
64 AppListShower shower_; | |
65 | |
66 bool can_dismiss_; | |
67 std::unique_ptr<AppListControllerDelegate> controller_delegate_; | |
68 | |
69 DISALLOW_COPY_AND_ASSIGN(AppListServiceViews); | |
70 }; | |
71 | |
72 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_VIEWS_H_ | |
OLD | NEW |