| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_ |
| 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/public/browser/notification_observer.h" | 10 #include "content/public/browser/notification_observer.h" |
| 11 #include "content/public/browser/web_contents_observer.h" | 11 #include "content/public/browser/web_contents_observer.h" |
| 12 #include "extensions/browser/app_window/app_window.h" | 12 #include "extensions/browser/app_window/app_window.h" |
| 13 #include "extensions/browser/extension_function_dispatcher.h" | 13 #include "extensions/browser/extension_function_dispatcher.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class BrowserContext; | 17 class BrowserContext; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace extensions { | 20 namespace extensions { |
| 21 | 21 |
| 22 struct DraggableRegion; | |
| 23 | |
| 24 // AppWindowContents class specific to app windows. It maintains a | 22 // AppWindowContents class specific to app windows. It maintains a |
| 25 // WebContents instance and observes it for the purpose of passing | 23 // WebContents instance and observes it for the purpose of passing |
| 26 // messages to the extensions system. | 24 // messages to the extensions system. |
| 27 class AppWindowContentsImpl : public AppWindowContents, | 25 class AppWindowContentsImpl : public AppWindowContents, |
| 28 public content::WebContentsObserver, | 26 public content::WebContentsObserver, |
| 29 public ExtensionFunctionDispatcher::Delegate { | 27 public ExtensionFunctionDispatcher::Delegate { |
| 30 public: | 28 public: |
| 31 explicit AppWindowContentsImpl(AppWindow* host); | 29 explicit AppWindowContentsImpl(AppWindow* host); |
| 32 virtual ~AppWindowContentsImpl(); | 30 virtual ~AppWindowContentsImpl(); |
| 33 | 31 |
| 34 // AppWindowContents | 32 // AppWindowContents |
| 35 virtual void Initialize(content::BrowserContext* context, | 33 virtual void Initialize(content::BrowserContext* context, |
| 36 const GURL& url) OVERRIDE; | 34 const GURL& url) OVERRIDE; |
| 37 virtual void LoadContents(int32 creator_process_id) OVERRIDE; | 35 virtual void LoadContents(int32 creator_process_id) OVERRIDE; |
| 38 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE; | 36 virtual void NativeWindowChanged( |
| 37 native_app_window::NativeAppWindow* native_app_window) OVERRIDE; |
| 39 virtual void NativeWindowClosed() OVERRIDE; | 38 virtual void NativeWindowClosed() OVERRIDE; |
| 40 virtual void DispatchWindowShownForTests() const OVERRIDE; | 39 virtual void DispatchWindowShownForTests() const OVERRIDE; |
| 41 virtual content::WebContents* GetWebContents() const OVERRIDE; | 40 virtual content::WebContents* GetWebContents() const OVERRIDE; |
| 42 | 41 |
| 43 private: | 42 private: |
| 44 // content::WebContentsObserver | 43 // content::WebContentsObserver |
| 45 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 44 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 46 | 45 |
| 47 // ExtensionFunctionDispatcher::Delegate | 46 // ExtensionFunctionDispatcher::Delegate |
| 48 virtual WindowController* GetExtensionWindowController() const OVERRIDE; | 47 virtual WindowController* GetExtensionWindowController() const OVERRIDE; |
| 49 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; | 48 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE; |
| 50 | 49 |
| 51 void OnRequest(const ExtensionHostMsg_Request_Params& params); | 50 void OnRequest(const ExtensionHostMsg_Request_Params& params); |
| 52 void UpdateDraggableRegions(const std::vector<DraggableRegion>& regions); | 51 void UpdateDraggableRegions( |
| 52 const std::vector<native_app_window::DraggableRegion>& regions); |
| 53 void SuspendRenderViewHost(content::RenderViewHost* rvh); | 53 void SuspendRenderViewHost(content::RenderViewHost* rvh); |
| 54 | 54 |
| 55 AppWindow* host_; // This class is owned by |host_| | 55 AppWindow* host_; // This class is owned by |host_| |
| 56 GURL url_; | 56 GURL url_; |
| 57 scoped_ptr<content::WebContents> web_contents_; | 57 scoped_ptr<content::WebContents> web_contents_; |
| 58 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; | 58 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl); | 60 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace extensions | 63 } // namespace extensions |
| 64 | 64 |
| 65 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_ | 65 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_ |
| OLD | NEW |