| 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 Profile; | 18 class Profile; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class WebContents; | 21 class WebContents; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 class WindowController; | 25 class WindowController; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace gfx { | 28 namespace gfx { |
| 29 class Image; |
| 29 class Rect; | 30 class Rect; |
| 30 } | 31 } |
| 31 | 32 |
| 32 // Helper class for Panel, implementing WebContents hosting and Extension | 33 // Helper class for Panel, implementing WebContents hosting and Extension |
| 33 // delegates. Owned and used by Panel only. | 34 // delegates. Owned and used by Panel only. |
| 34 class PanelHost : public content::WebContentsDelegate, | 35 class PanelHost : public content::WebContentsDelegate, |
| 35 public content::WebContentsObserver, | 36 public content::WebContentsObserver, |
| 36 public ExtensionFunctionDispatcher::Delegate { | 37 public ExtensionFunctionDispatcher::Delegate { |
| 37 public: | 38 public: |
| 38 PanelHost(Panel* panel, Profile* profile); | 39 PanelHost(Panel* panel, Profile* profile); |
| 39 virtual ~PanelHost(); | 40 virtual ~PanelHost(); |
| 40 | 41 |
| 41 void Init(const GURL& url); | 42 void Init(const GURL& url); |
| 42 content::WebContents* web_contents() { return web_contents_.get(); } | 43 content::WebContents* web_contents() { return web_contents_.get(); } |
| 43 void DestroyWebContents(); | 44 void DestroyWebContents(); |
| 44 | 45 |
| 45 // Returns the icon for the current page. | 46 // Returns the icon for the current page. |
| 46 SkBitmap GetPageIcon() const; | 47 gfx::Image GetPageIcon() const; |
| 47 | 48 |
| 48 // content::WebContentsDelegate overrides. | 49 // content::WebContentsDelegate overrides. |
| 49 virtual void NavigationStateChanged(const content::WebContents* source, | 50 virtual void NavigationStateChanged(const content::WebContents* source, |
| 50 unsigned changed_flags) OVERRIDE; | 51 unsigned changed_flags) OVERRIDE; |
| 51 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; | 52 virtual void ActivateContents(content::WebContents* contents) OVERRIDE; |
| 52 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; | 53 virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; |
| 53 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; | 54 virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; |
| 54 virtual void CloseContents(content::WebContents* source) OVERRIDE; | 55 virtual void CloseContents(content::WebContents* source) OVERRIDE; |
| 55 virtual void MoveContents(content::WebContents* source, | 56 virtual void MoveContents(content::WebContents* source, |
| 56 const gfx::Rect& pos) OVERRIDE; | 57 const gfx::Rect& pos) OVERRIDE; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // The following factory is used to close the panel via the message loop. | 98 // The following factory is used to close the panel via the message loop. |
| 98 base::WeakPtrFactory<PanelHost> weak_factory_; | 99 base::WeakPtrFactory<PanelHost> weak_factory_; |
| 99 | 100 |
| 100 scoped_ptr<FaviconTabHelper> favicon_tab_helper_; | 101 scoped_ptr<FaviconTabHelper> favicon_tab_helper_; |
| 101 scoped_ptr<content::WebContents> web_contents_; | 102 scoped_ptr<content::WebContents> web_contents_; |
| 102 | 103 |
| 103 DISALLOW_COPY_AND_ASSIGN(PanelHost); | 104 DISALLOW_COPY_AND_ASSIGN(PanelHost); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 #endif // CHROME_BROWSER_UI_PANELS_PANEL_HOST_H_ | 107 #endif // CHROME_BROWSER_UI_PANELS_PANEL_HOST_H_ |
| OLD | NEW |