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 "chrome/browser/ui/webui/aura/app_list_ui_delegate.h" |
| 12 #include "content/browser/tab_contents/tab_contents_delegate.h" |
11 #include "ui/aura_shell/shell_delegate.h" | 13 #include "ui/aura_shell/shell_delegate.h" |
12 #include "ui/views/widget/widget_delegate.h" | 14 #include "ui/views/widget/widget_delegate.h" |
13 | 15 |
14 class DOMView; | 16 class DOMView; |
15 | 17 |
16 namespace views { | 18 namespace views { |
17 class Widget; | 19 class Widget; |
18 } | 20 } |
19 | 21 |
20 class AppListWindow : public views::WidgetDelegate, | 22 class AppListWindow : public views::WidgetDelegate, |
21 public TabFirstRenderWatcher::Delegate { | 23 public TabContentsDelegate, |
| 24 public TabFirstRenderWatcher::Delegate, |
| 25 public AppListUIDelegate { |
22 public: | 26 public: |
23 explicit AppListWindow( | 27 AppListWindow( |
| 28 const gfx::Rect& bounds, |
24 const aura_shell::ShellDelegate::SetWidgetCallback& callback); | 29 const aura_shell::ShellDelegate::SetWidgetCallback& callback); |
25 | 30 |
26 private: | 31 private: |
27 virtual ~AppListWindow(); | 32 virtual ~AppListWindow(); |
28 | 33 |
29 // views::WidgetDelegate overrides: | 34 // views::WidgetDelegate overrides: |
30 virtual void DeleteDelegate() OVERRIDE; | 35 virtual void DeleteDelegate() OVERRIDE; |
31 virtual views::View* GetContentsView() OVERRIDE; | 36 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
32 virtual views::Widget* GetWidget() OVERRIDE; | 37 virtual views::Widget* GetWidget() OVERRIDE; |
33 virtual const views::Widget* GetWidget() const OVERRIDE; | 38 virtual const views::Widget* GetWidget() const OVERRIDE; |
34 | 39 |
| 40 // TabContentsDelegate implementation: |
| 41 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; |
| 42 virtual void HandleKeyboardEvent( |
| 43 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 44 virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; |
| 45 virtual bool TakeFocus(bool reverse) OVERRIDE; |
| 46 |
35 // TabFirstRenderWatcher::Delegate implementation: | 47 // TabFirstRenderWatcher::Delegate implementation: |
36 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; | 48 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; |
37 virtual void OnTabMainFrameLoaded() OVERRIDE; | 49 virtual void OnTabMainFrameLoaded() OVERRIDE; |
38 virtual void OnTabMainFrameFirstRender() OVERRIDE; | 50 virtual void OnTabMainFrameFirstRender() OVERRIDE; |
39 | 51 |
| 52 // AppListUIDelegate implementation: |
| 53 virtual void Close() OVERRIDE; |
| 54 virtual void OnAppsLoaded() OVERRIDE; |
| 55 |
40 // Initializes the window. | 56 // Initializes the window. |
41 void Init(); | 57 void Init(const gfx::Rect& bounds); |
| 58 |
| 59 // Check and fire set widget callback if we are ready. |
| 60 void SetWidgetIfReady(); |
42 | 61 |
43 views::Widget* widget_; | 62 views::Widget* widget_; |
44 DOMView* contents_; | 63 DOMView* contents_; |
45 | 64 |
46 // Monitors TabContents and set |content_rendered_| flag when it's rendered. | 65 // Monitors TabContents and set |content_rendered_| flag when it's rendered. |
47 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; | 66 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; |
48 | 67 |
49 // Callback to set app list widget when it's ready. | 68 // Callback to set app list widget when it's ready. |
50 aura_shell::ShellDelegate::SetWidgetCallback callback_; | 69 aura_shell::ShellDelegate::SetWidgetCallback callback_; |
51 | 70 |
| 71 // True if webui is rendered. |
| 72 bool content_rendered_; |
| 73 |
| 74 // True if apps info is loaded by webui. |
| 75 bool apps_loaded_; |
| 76 |
52 DISALLOW_COPY_AND_ASSIGN(AppListWindow); | 77 DISALLOW_COPY_AND_ASSIGN(AppListWindow); |
53 }; | 78 }; |
54 | 79 |
55 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ | 80 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ |
OLD | NEW |