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_SHOWER_VIEWS_H_
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/native_widget_types.h"
15 class AppListShowerDelegate
;
16 class AppListShowerUnitTest
;
18 class ScopedKeepAlive
;
20 // Creates and shows an AppList as needed for non-Ash desktops. It is owned by
21 // AppListServiceViews.
24 explicit AppListShower(AppListShowerDelegate
* delegate
);
25 virtual ~AppListShower();
27 void ShowForCurrentProfile();
28 gfx::NativeWindow
GetWindow();
30 app_list::AppListView
* app_list() { return app_list_
; }
31 Profile
* profile() const { return profile_
; }
33 // Create or recreate, and initialize |app_list_| from |requested_profile|.
34 void CreateViewForProfile(Profile
* requested_profile
);
36 void DismissAppList();
38 // Virtual functions mocked out in tests.
39 virtual void HandleViewBeingDestroyed();
40 virtual bool IsAppListVisible() const;
41 void WarmupForProfile(Profile
* profile
);
42 virtual bool HasView() const;
45 virtual app_list::AppListView
* MakeViewForCurrentProfile();
46 virtual void UpdateViewForNewProfile();
48 // Shows the app list, activates it, and ensures the taskbar icon is updated.
53 friend class ::AppListShowerUnitTest
;
55 void ResetKeepAliveSoon();
56 void ResetKeepAlive();
58 AppListShowerDelegate
* delegate_
; // Weak. Owns this.
60 // The profile currently shown by |app_list_|.
63 // The view, once created. Owned by native widget.
64 app_list::AppListView
* app_list_
;
66 // Used to keep the browser process alive while the app list is visible.
67 scoped_ptr
<ScopedKeepAlive
> keep_alive_
;
69 bool window_icon_updated_
;
71 DISALLOW_COPY_AND_ASSIGN(AppListShower
);
74 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_