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.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 AppListUI::Delegate { | |
22 public: | 26 public: |
23 explicit AppListWindow( | 27 AppListWindow(const gfx::Rect& bounds, |
sky
2011/11/30 21:50:21
nit: wrap this to next line so that this param and
xiyuan
2011/11/30 22:26:34
Done.
| |
24 const aura_shell::ShellDelegate::SetWidgetCallback& callback); | 28 const aura_shell::ShellDelegate::SetWidgetCallback& callback); |
25 | 29 |
26 private: | 30 private: |
27 virtual ~AppListWindow(); | 31 virtual ~AppListWindow(); |
28 | 32 |
29 // views::WidgetDelegate overrides: | 33 // views::WidgetDelegate overrides: |
30 virtual void DeleteDelegate() OVERRIDE; | 34 virtual void DeleteDelegate() OVERRIDE; |
31 virtual views::View* GetContentsView() OVERRIDE; | 35 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
32 virtual views::Widget* GetWidget() OVERRIDE; | 36 virtual views::Widget* GetWidget() OVERRIDE; |
33 virtual const views::Widget* GetWidget() const OVERRIDE; | 37 virtual const views::Widget* GetWidget() const OVERRIDE; |
34 | 38 |
39 // TabContentsDelegate implementation: | |
40 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; | |
41 virtual void HandleKeyboardEvent( | |
42 const NativeWebKeyboardEvent& event) OVERRIDE; | |
43 virtual bool IsPopupOrPanel(const TabContents* source) const OVERRIDE; | |
44 virtual bool TakeFocus(bool reverse) OVERRIDE; | |
45 | |
35 // TabFirstRenderWatcher::Delegate implementation: | 46 // TabFirstRenderWatcher::Delegate implementation: |
36 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; | 47 virtual void OnRenderHostCreated(RenderViewHost* host) OVERRIDE; |
37 virtual void OnTabMainFrameLoaded() OVERRIDE; | 48 virtual void OnTabMainFrameLoaded() OVERRIDE; |
38 virtual void OnTabMainFrameFirstRender() OVERRIDE; | 49 virtual void OnTabMainFrameFirstRender() OVERRIDE; |
39 | 50 |
51 // AppListUI::Delegate implementation: | |
52 virtual void Close() OVERRIDE; | |
53 virtual void OnAppsLoaded() OVERRIDE; | |
54 | |
40 // Initializes the window. | 55 // Initializes the window. |
41 void Init(); | 56 void Init(const gfx::Rect& bounds); |
57 | |
58 // Check and fire set widget callback if we are ready. | |
59 void SetWidgetIfReady(); | |
42 | 60 |
43 views::Widget* widget_; | 61 views::Widget* widget_; |
44 DOMView* contents_; | 62 DOMView* contents_; |
45 | 63 |
46 // Monitors TabContents and set |content_rendered_| flag when it's rendered. | 64 // Monitors TabContents and set |content_rendered_| flag when it's rendered. |
47 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; | 65 scoped_ptr<TabFirstRenderWatcher> tab_watcher_; |
48 | 66 |
49 // Callback to set app list widget when it's ready. | 67 // Callback to set app list widget when it's ready. |
50 aura_shell::ShellDelegate::SetWidgetCallback callback_; | 68 aura_shell::ShellDelegate::SetWidgetCallback callback_; |
51 | 69 |
70 bool content_rendered_; | |
sky
2011/11/30 21:50:21
nit: add description
xiyuan
2011/11/30 22:26:34
Done.
| |
71 bool apps_loaded_; | |
72 | |
52 DISALLOW_COPY_AND_ASSIGN(AppListWindow); | 73 DISALLOW_COPY_AND_ASSIGN(AppListWindow); |
53 }; | 74 }; |
54 | 75 |
55 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ | 76 #endif // CHROME_BROWSER_UI_VIEWS_AURA_APP_LIST_WINDOW_H_ |
OLD | NEW |