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( |
27 static void SetVisible(bool visible); | 24 const aura_shell::ShellDelegate::SetWidgetCallback& callback); |
28 | |
29 // Whether app list window is visible (shown or being shown). | |
30 static bool IsVisible(); | |
31 | 25 |
32 private: | 26 private: |
33 AppListWindow(); | |
34 virtual ~AppListWindow(); | 27 virtual ~AppListWindow(); |
35 | 28 |
36 // views::WidgetDelegate overrides: | 29 // views::WidgetDelegate overrides: |
37 virtual void DeleteDelegate() OVERRIDE; | 30 virtual void DeleteDelegate() OVERRIDE; |
38 virtual views::View* GetContentsView() OVERRIDE; | 31 virtual views::View* GetContentsView() OVERRIDE; |
39 virtual void WindowClosing() OVERRIDE; | |
40 virtual views::Widget* GetWidget() OVERRIDE; | 32 virtual views::Widget* GetWidget() OVERRIDE; |
41 virtual const views::Widget* GetWidget() const OVERRIDE; | 33 virtual const views::Widget* GetWidget() const OVERRIDE; |
42 | 34 |
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: | 35 // TabFirstRenderWatcher::Delegate implementation: |
55 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; | 36 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; |
56 virtual void OnTabMainFrameLoaded() OVERRIDE; | 37 virtual void OnTabMainFrameLoaded() OVERRIDE; |
57 virtual void OnTabMainFrameFirstRender() OVERRIDE; | 38 virtual void OnTabMainFrameFirstRender() OVERRIDE; |
58 | 39 |
59 // Initializes the window. | 40 // Initializes the window. |
60 void Init(); | 41 void Init(); |
61 | 42 |
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_; | 43 views::Widget* widget_; |
69 DOMView* contents_; | 44 DOMView* contents_; |
70 bool is_visible_; | |
71 | 45 |
72 // Monitors TabContents and set |content_rendered_| flag when it's rendered. | 46 // Monitors TabContents and set |content_rendered_| flag when it's rendered. |
73 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; | 47 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; |
74 | 48 |
75 // Flag of whether the web contents is rendered. Showing animation is | 49 // Callback to set app list widget when it's ready. |
76 // deferred until this flag is set to true. | 50 aura_shell::ShellDelegate::SetWidgetCallback callback_; |
77 bool content_rendered_; | |
78 | 51 |
79 DISALLOW_COPY_AND_ASSIGN(AppListWindow); | 52 DISALLOW_COPY_AND_ASSIGN(AppListWindow); |
80 }; | 53 }; |
81 | 54 |
82 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ | 55 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ |
OLD | NEW |