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
3 // found in the LICENSE file.
5 #ifndef APPS_APP_WINDOW_CONTENTS_H_
6 #define APPS_APP_WINDOW_CONTENTS_H_
8 #include "apps/app_window.h"
9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/web_contents_observer.h"
13 #include "extensions/browser/extension_function_dispatcher.h"
20 namespace extensions
{
21 struct DraggableRegion
;
26 // AppWindowContents class specific to app windows. It maintains a
27 // WebContents instance and observes it for the purpose of passing
28 // messages to the extensions system.
29 class AppWindowContentsImpl
30 : public AppWindowContents
,
31 public content::WebContentsObserver
,
32 public extensions::ExtensionFunctionDispatcher::Delegate
{
34 explicit AppWindowContentsImpl(AppWindow
* host
);
35 virtual ~AppWindowContentsImpl();
38 virtual void Initialize(content::BrowserContext
* context
,
39 const GURL
& url
) OVERRIDE
;
40 virtual void LoadContents(int32 creator_process_id
) OVERRIDE
;
41 virtual void NativeWindowChanged(NativeAppWindow
* native_app_window
) OVERRIDE
;
42 virtual void NativeWindowClosed() OVERRIDE
;
43 virtual void DispatchWindowShownForTests() const OVERRIDE
;
44 virtual content::WebContents
* GetWebContents() const OVERRIDE
;
47 // content::WebContentsObserver
48 virtual bool OnMessageReceived(const IPC::Message
& message
) OVERRIDE
;
50 // extensions::ExtensionFunctionDispatcher::Delegate
51 virtual extensions::WindowController
* GetExtensionWindowController() const
53 virtual content::WebContents
* GetAssociatedWebContents() const OVERRIDE
;
55 void OnRequest(const ExtensionHostMsg_Request_Params
& params
);
56 void UpdateDraggableRegions(
57 const std::vector
<extensions::DraggableRegion
>& regions
);
58 void SuspendRenderViewHost(content::RenderViewHost
* rvh
);
60 AppWindow
* host_
; // This class is owned by |host_|
62 scoped_ptr
<content::WebContents
> web_contents_
;
63 scoped_ptr
<extensions::ExtensionFunctionDispatcher
>
64 extension_function_dispatcher_
;
66 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl
);
71 #endif // APPS_APP_WINDOW_CONTENTS_H_