OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PANELS_PANEL_HOST_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_HOST_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_HOST_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_HOST_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 10 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
11 #include "content/public/browser/web_contents_delegate.h" | 11 #include "content/public/browser/web_contents_delegate.h" |
12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
13 #include "content/public/common/page_zoom.h" | 13 #include "content/public/common/page_zoom.h" |
14 | 14 |
15 class FaviconTabHelper; | 15 class FaviconTabHelper; |
16 class GURL; | 16 class GURL; |
17 class Panel; | 17 class Panel; |
18 class PrefsTabHelper; | 18 class PrefsTabHelper; |
19 class Profile; | 19 class Profile; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class WebContents; | 22 class WebContents; |
23 } | 23 } |
24 | 24 |
25 namespace extensions { | 25 namespace extensions { |
26 class WindowController; | 26 class WindowController; |
27 } | 27 } |
28 | 28 |
29 namespace gfx { | 29 namespace gfx { |
| 30 class Image; |
30 class Rect; | 31 class Rect; |
31 } | 32 } |
32 | 33 |
33 // Helper class for Panel, implementing WebContents hosting and Extension | 34 // Helper class for Panel, implementing WebContents hosting and Extension |
34 // delegates. Owned and used by Panel only. | 35 // delegates. Owned and used by Panel only. |
35 class PanelHost : public content::WebContentsDelegate, | 36 class PanelHost : public content::WebContentsDelegate, |
36 public content::WebContentsObserver, | 37 public content::WebContentsObserver, |
37 public ExtensionFunctionDispatcher::Delegate { | 38 public ExtensionFunctionDispatcher::Delegate { |
38 public: | 39 public: |
39 PanelHost(Panel* panel, Profile* profile); | 40 PanelHost(Panel* panel, Profile* profile); |
40 virtual ~PanelHost(); | 41 virtual ~PanelHost(); |
41 | 42 |
42 void Init(const GURL& url); | 43 void Init(const GURL& url); |
43 content::WebContents* web_contents() { return web_contents_.get(); } | 44 content::WebContents* web_contents() { return web_contents_.get(); } |
44 void DestroyWebContents(); | 45 void DestroyWebContents(); |
45 | 46 |
46 // Returns the icon for the current page. | 47 // Returns the icon for the current page. |
47 SkBitmap GetPageIcon() const; | 48 gfx::Image GetPageIcon() const; |
48 | 49 |
49 // content::WebContentsDelegate overrides. | 50 // content::WebContentsDelegate overrides. |
50 virtual void NavigationStateChanged(const content::WebContents* source, | 51 virtual void NavigationStateChanged(const content::WebContents* source, |
51 unsigned changed_flags) OVERRIDE; | 52 unsigned changed_flags) OVERRIDE; |
52 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; | 53 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; |
53 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; | 54 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; |
54 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; | 55 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; |
55 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 56 virtual void CloseContents(content::WebContents* source) OVERRIDE; |
56 virtual void MoveContents(content::WebContents* source, | 57 virtual void MoveContents(content::WebContents* source, |
57 const gfx::Rect& pos) OVERRIDE; | 58 const gfx::Rect& pos) OVERRIDE; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 base::WeakPtrFactory<PanelHost> weak_factory_; | 101 base::WeakPtrFactory<PanelHost> weak_factory_; |
101 | 102 |
102 scoped_ptr<PrefsTabHelper> prefs_tab_helper_; | 103 scoped_ptr<PrefsTabHelper> prefs_tab_helper_; |
103 scoped_ptr<FaviconTabHelper> favicon_tab_helper_; | 104 scoped_ptr<FaviconTabHelper> favicon_tab_helper_; |
104 scoped_ptr<content::WebContents> web_contents_; | 105 scoped_ptr<content::WebContents> web_contents_; |
105 | 106 |
106 DISALLOW_COPY_AND_ASSIGN(PanelHost); | 107 DISALLOW_COPY_AND_ASSIGN(PanelHost); |
107 }; | 108 }; |
108 | 109 |
109 #endif // CHROME_BROWSER_UI_PANELS_PANEL_HOST_H_ | 110 #endif // CHROME_BROWSER_UI_PANELS_PANEL_HOST_H_ |
OLD | NEW |