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 void OnWindowReady() override
;
39 content::WebContents
* GetWebContents() const override
;
40 WindowController
* GetWindowController() const override
;
43 // content::WebContentsObserver
44 bool OnMessageReceived(const IPC::Message
& message
) override
;
45 void ReadyToCommitNavigation(content::NavigationHandle
* handle
) override
;
47 void UpdateDraggableRegions(const std::vector
<DraggableRegion
>& regions
);
48 void SuspendRenderFrameHost(content::RenderFrameHost
* rfh
);
50 AppWindow
* host_
; // This class is owned by |host_|
52 scoped_ptr
<content::WebContents
> web_contents_
;
53 bool is_blocking_requests_
;
54 bool is_window_ready_
;
56 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl
);
59 } // namespace extensions
61 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_