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