| 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_VIEWS_H_ | |
| 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "ui/app_list/pagination_model.h" | |
| 10 #include "ui/gfx/native_widget_types.h" | |
| 11 | |
| 12 namespace app_list { | |
| 13 class AppListView; | |
| 14 } | |
| 15 | |
| 16 class AppListShowerDelegate; | |
| 17 class AppListShowerUnitTest; | |
| 18 class Profile; | |
| 19 class ScopedKeepAlive; | |
| 20 | |
| 21 // Creates and shows an AppList as needed for non-Ash desktops. It is owned by | |
| 22 // AppListServiceViews. | |
| 23 class AppListShower { | |
| 24 public: | |
| 25 explicit AppListShower(AppListShowerDelegate* delegate); | |
| 26 virtual ~AppListShower(); | |
| 27 | |
| 28 void ShowForProfile(Profile* requested_profile); | |
| 29 gfx::NativeWindow GetWindow(); | |
| 30 | |
| 31 app_list::AppListView* app_list() { return app_list_; } | |
| 32 Profile* profile() const { return profile_; } | |
| 33 | |
| 34 // Create or recreate, and initialize |app_list_| from |requested_profile|. | |
| 35 void CreateViewForProfile(Profile* requested_profile); | |
| 36 | |
| 37 void DismissAppList(); | |
| 38 | |
| 39 // Virtual functions mocked out in tests. | |
| 40 virtual void HandleViewBeingDestroyed(); | |
| 41 virtual bool IsAppListVisible() const; | |
| 42 void WarmupForProfile(Profile* profile); | |
| 43 virtual bool HasView() const; | |
| 44 | |
| 45 protected: | |
| 46 virtual app_list::AppListView* MakeViewForCurrentProfile(); | |
| 47 virtual void UpdateViewForNewProfile(); | |
| 48 | |
| 49 // Shows the app list, activates it, and ensures the taskbar icon is updated. | |
| 50 virtual void Show(); | |
| 51 virtual void Hide(); | |
| 52 | |
| 53 private: | |
| 54 friend class ::AppListShowerUnitTest; | |
| 55 | |
| 56 void ResetKeepAlive(); | |
| 57 | |
| 58 AppListShowerDelegate* delegate_; // Weak. Owns this. | |
| 59 | |
| 60 // The profile currently shown by |app_list_|. | |
| 61 Profile* profile_; | |
| 62 | |
| 63 // The view, once created. Owned by native widget. | |
| 64 app_list::AppListView* app_list_; | |
| 65 | |
| 66 // Used to keep the browser process alive while the app list is visible. | |
| 67 scoped_ptr<ScopedKeepAlive> keep_alive_; | |
| 68 | |
| 69 bool window_icon_updated_; | |
| 70 app_list::PaginationModel pagination_model_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(AppListShower); | |
| 73 }; | |
| 74 | |
| 75 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SHOWER_VIEWS_H_ | |
| OLD | NEW |