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 EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/public/browser/web_contents_observer.h"
11 #include "extensions/browser/app_window/app_window.h"
16 class RenderFrameHost
;
19 namespace extensions
{
21 struct DraggableRegion
;
23 // AppWindowContents class specific to app windows. It maintains a
24 // WebContents instance and observes it for the purpose of passing
25 // messages to the extensions system.
26 class AppWindowContentsImpl
: public AppWindowContents
,
27 public content::WebContentsObserver
{
29 explicit AppWindowContentsImpl(AppWindow
* host
);
30 ~AppWindowContentsImpl() override
;
33 void Initialize(content::BrowserContext
* context
, const GURL
& url
) override
;
34 void LoadContents(int32 creator_process_id
) override
;
35 void NativeWindowChanged(NativeAppWindow
* native_app_window
) override
;
36 void NativeWindowClosed() override
;
37 void DispatchWindowShownForTests() const override
;
38 content::WebContents
* GetWebContents() const override
;
39 WindowController
* GetWindowController() const override
;
42 // content::WebContentsObserver
43 bool OnMessageReceived(const IPC::Message
& message
) override
;
45 void UpdateDraggableRegions(const std::vector
<DraggableRegion
>& regions
);
46 void SuspendRenderFrameHost(content::RenderFrameHost
* rfh
);
48 AppWindow
* host_
; // This class is owned by |host_|
50 scoped_ptr
<content::WebContents
> web_contents_
;
52 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl
);
55 } // namespace extensions
57 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_