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" |
| 10 #include "chrome/browser/tab_first_render_watcher.h" |
9 #include "ui/aura/desktop_observer.h" | 11 #include "ui/aura/desktop_observer.h" |
| 12 #include "ui/gfx/compositor/layer_animation_observer.h" |
10 #include "views/widget/widget_delegate.h" | 13 #include "views/widget/widget_delegate.h" |
11 | 14 |
12 class DOMView; | 15 class DOMView; |
13 | 16 |
14 namespace views { | 17 namespace views { |
15 class Widget; | 18 class Widget; |
16 } | 19 } |
17 | 20 |
18 class AppListWindow : public views::WidgetDelegate, | 21 class AppListWindow : public views::WidgetDelegate, |
19 public aura::DesktopObserver { | 22 public aura::DesktopObserver, |
| 23 public ui::LayerAnimationObserver, |
| 24 public TabFirstRenderWatcher::Delegate { |
20 public: | 25 public: |
21 // Show/hide app list window. | 26 // Show/hide app list window. |
22 static void SetVisible(bool visible); | 27 static void SetVisible(bool visible); |
23 | 28 |
24 // Whether app list window is visible (shown or being shown). | 29 // Whether app list window is visible (shown or being shown). |
25 static bool IsVisible(); | 30 static bool IsVisible(); |
26 | 31 |
27 private: | 32 private: |
28 AppListWindow(); | 33 AppListWindow(); |
29 virtual ~AppListWindow(); | 34 virtual ~AppListWindow(); |
30 | 35 |
31 // Overridden from views::WidgetDelegate: | 36 // views::WidgetDelegate overrides: |
32 virtual void DeleteDelegate() OVERRIDE; | 37 virtual void DeleteDelegate() OVERRIDE; |
33 virtual views::View* GetContentsView() OVERRIDE; | 38 virtual views::View* GetContentsView() OVERRIDE; |
34 virtual void WindowClosing() OVERRIDE; | 39 virtual void WindowClosing() OVERRIDE; |
35 virtual views::Widget* GetWidget() OVERRIDE; | 40 virtual views::Widget* GetWidget() OVERRIDE; |
36 virtual const views::Widget* GetWidget() const OVERRIDE; | 41 virtual const views::Widget* GetWidget() const OVERRIDE; |
37 | 42 |
38 // aura::DesktopObserver overrides: | 43 // aura::DesktopObserver overrides: |
39 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE; | 44 virtual void OnActiveWindowChanged(aura::Window* active) OVERRIDE; |
40 | 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: |
| 55 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; |
| 56 virtual void OnTabMainFrameLoaded() OVERRIDE; |
| 57 virtual void OnTabMainFrameFirstRender() OVERRIDE; |
| 58 |
41 // Initializes the window. | 59 // Initializes the window. |
42 void Init(); | 60 void Init(); |
43 | 61 |
44 // Shows/hides the window. | 62 // Shows/hides the window. |
45 void SetVisible(bool visible, bool animate); | 63 void DoSetVisible(bool visible); |
46 | |
47 bool is_visible() const { | |
48 return is_visible_; | |
49 } | |
50 | 64 |
51 // Current visible app list window. | 65 // Current visible app list window. |
52 static AppListWindow* instance_; | 66 static AppListWindow* instance_; |
53 | 67 |
54 views::Widget* widget_; | 68 views::Widget* widget_; |
55 DOMView* contents_; | 69 DOMView* contents_; |
56 bool is_visible_; | 70 bool is_visible_; |
57 | 71 |
| 72 // Monitors TabContents and set |content_rendered_| flag when it's rendered. |
| 73 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; |
| 74 |
| 75 // Flag of whether the web contents is rendered. Showing animation is |
| 76 // deferred until this flag is set to true. |
| 77 bool content_rendered_; |
| 78 |
58 DISALLOW_COPY_AND_ASSIGN(AppListWindow); | 79 DISALLOW_COPY_AND_ASSIGN(AppListWindow); |
59 }; | 80 }; |
60 | 81 |
61 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ | 82 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ |
OLD | NEW |