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