OLD | NEW |
(Empty) | |
| 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_APP_LIST_APP_LIST_SHOWER_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "chrome/browser/ui/app_list/app_list.h" |
| 10 #include "chrome/browser/ui/app_list/app_list_factory.h" |
| 11 #include "ui/app_list/pagination_model.h" |
| 12 #include "ui/gfx/native_widget_types.h" |
| 13 |
| 14 namespace app_list { |
| 15 class AppListModel; |
| 16 } |
| 17 |
| 18 class AppListShowerUnitTest; |
| 19 class Profile; |
| 20 class ScopedKeepAlive; |
| 21 |
| 22 // Creates and shows an AppList as needed for non-Ash desktops. It is owned |
| 23 // by AppListService. |
| 24 class AppListShower { |
| 25 public: |
| 26 AppListShower(scoped_ptr<AppListFactory> factory, |
| 27 AppListService* service); |
| 28 ~AppListShower(); |
| 29 |
| 30 void set_can_close(bool can_close) { |
| 31 can_close_app_list_ = can_close; |
| 32 } |
| 33 |
| 34 void ShowForProfile(Profile* requested_profile); |
| 35 gfx::NativeWindow GetWindow(); |
| 36 |
| 37 AppList* app_list() { return app_list_.get(); } |
| 38 Profile* profile() const { return profile_; } |
| 39 |
| 40 // Create or recreate, and initialize |app_list_| from |requested_profile|. |
| 41 void CreateViewForProfile(Profile* requested_profile); |
| 42 |
| 43 void DismissAppList(); |
| 44 void HandleViewBeingDestroyed(); |
| 45 bool IsAppListVisible() const; |
| 46 void WarmupForProfile(Profile* profile); |
| 47 bool HasView() const; |
| 48 |
| 49 private: |
| 50 friend class ::AppListShowerUnitTest; |
| 51 |
| 52 void ResetKeepAlive(); |
| 53 |
| 54 scoped_ptr<AppListFactory> factory_; |
| 55 scoped_ptr<ScopedKeepAlive> keep_alive_; |
| 56 scoped_ptr<AppList> app_list_; |
| 57 AppListService* service_; // Weak ptr, owns this. |
| 58 Profile* profile_; |
| 59 bool can_close_app_list_; |
| 60 |
| 61 // Used to keep the browser process alive while the app list is visible. |
| 62 |
| 63 DISALLOW_COPY_AND_ASSIGN(AppListShower); |
| 64 }; |
| 65 |
| 66 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_H_ |
OLD | NEW |