| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/tab_first_render_watcher.h" | 10 #include "chrome/browser/tab_first_render_watcher.h" |
| 11 #include "ui/aura/desktop_observer.h" | 11 #include "ui/aura_shell/shell_delegate.h" |
| 12 #include "ui/gfx/compositor/layer_animation_observer.h" | |
| 13 #include "views/widget/widget_delegate.h" | 12 #include "views/widget/widget_delegate.h" |
| 14 | 13 |
| 15 class DOMView; | 14 class DOMView; |
| 16 | 15 |
| 17 namespace views { | 16 namespace views { |
| 18 class Widget; | 17 class Widget; |
| 19 } | 18 } |
| 20 | 19 |
| 21 class AppListWindow : public views::WidgetDelegate, | 20 class AppListWindow : public views::WidgetDelegate, |
| 22 public aura::DesktopObserver, | |
| 23 public ui::LayerAnimationObserver, | |
| 24 public TabFirstRenderWatcher::Delegate { | 21 public TabFirstRenderWatcher::Delegate { |
| 25 public: | 22 public: |
| 26 // Show/hide app list window. | 23 explicit AppListWindow(const aura_shell::SetWidgetCallback& callback); |
| 27 static void SetVisible(bool visible); | |
| 28 | |
| 29 // Whether app list window is visible (shown or being shown). | |
| 30 static bool IsVisible(); | |
| 31 | 24 |
| 32 private: | 25 private: |
| 33 AppListWindow(); | |
| 34 virtual ~AppListWindow(); | 26 virtual ~AppListWindow(); |
| 35 | 27 |
| 36 // views::WidgetDelegate overrides: | 28 // views::WidgetDelegate overrides: |
| 37 virtual void DeleteDelegate() OVERRIDE; | 29 virtual void DeleteDelegate() OVERRIDE; |
| 38 virtual views::View* GetContentsView() OVERRIDE; | 30 virtual views::View* GetContentsView() OVERRIDE; |
| 39 virtual void WindowClosing() OVERRIDE; | |
| 40 virtual views::Widget* GetWidget() OVERRIDE; | 31 virtual views::Widget* GetWidget() OVERRIDE; |
| 41 virtual const views::Widget* GetWidget() const OVERRIDE; | 32 virtual const views::Widget* GetWidget() const OVERRIDE; |
| 42 | 33 |
| 43 // aura::DesktopObserver overrides: | |
| 44 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE; | |
| 45 | |
| 46 // ui::LayerAnimationObserver overrides: | |
| 47 virtual void OnLayerAnimationEnded( | |
| 48 const ui::LayerAnimationSequence* sequence) OVERRIDE; | |
| 49 virtual void OnLayerAnimationAborted( | |
| 50 const ui::LayerAnimationSequence* sequence) OVERRIDE; | |
| 51 virtual void OnLayerAnimationScheduled( | |
| 52 const ui::LayerAnimationSequence* sequence) OVERRIDE; | |
| 53 | |
| 54 // TabFirstRenderWatcher::Delegate implementation: | 34 // TabFirstRenderWatcher::Delegate implementation: |
| 55 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; | 35 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; |
| 56 virtual void OnTabMainFrameLoaded() OVERRIDE; | 36 virtual void OnTabMainFrameLoaded() OVERRIDE; |
| 57 virtual void OnTabMainFrameFirstRender() OVERRIDE; | 37 virtual void OnTabMainFrameFirstRender() OVERRIDE; |
| 58 | 38 |
| 59 // Initializes the window. | 39 // Initializes the window. |
| 60 void Init(); | 40 void Init(); |
| 61 | 41 |
| 62 // Shows/hides the window. | |
| 63 void DoSetVisible(bool visible); | |
| 64 | |
| 65 // Current visible app list window. | |
| 66 static AppListWindow* instance_; | |
| 67 | |
| 68 views::Widget* widget_; | 42 views::Widget* widget_; |
| 69 DOMView* contents_; | 43 DOMView* contents_; |
| 70 bool is_visible_; | |
| 71 | 44 |
| 72 // Monitors TabContents and set |content_rendered_| flag when it's rendered. | 45 // Monitors TabContents and set |content_rendered_| flag when it's rendered. |
| 73 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; | 46 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; |
| 74 | 47 |
| 75 // Flag of whether the web contents is rendered. Showing animation is | 48 // Callback to set app list widget when it's ready. |
| 76 // deferred until this flag is set to true. | 49 aura_shell::SetWidgetCallback callback_; |
| 77 bool content_rendered_; | |
| 78 | 50 |
| 79 DISALLOW_COPY_AND_ASSIGN(AppListWindow); | 51 DISALLOW_COPY_AND_ASSIGN(AppListWindow); |
| 80 }; | 52 }; |
| 81 | 53 |
| 82 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ | 54 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ |
| OLD | NEW |