Add a UsbService::Observer function for cleanup actions.
[chromium-blink-merge.git] / extensions / browser / app_window / app_window_contents.h
blobab07ca6a369ae6541971d0ed5e232daa33872e79
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/notification_observer.h"
11 #include "content/public/browser/web_contents_observer.h"
12 #include "extensions/browser/app_window/app_window.h"
13 #include "extensions/browser/extension_function_dispatcher.h"
14 #include "url/gurl.h"
16 namespace content {
17 class BrowserContext;
20 namespace extensions {
22 struct DraggableRegion;
24 // AppWindowContents class specific to app windows. It maintains a
25 // WebContents instance and observes it for the purpose of passing
26 // messages to the extensions system.
27 class AppWindowContentsImpl : public AppWindowContents,
28 public content::WebContentsObserver,
29 public ExtensionFunctionDispatcher::Delegate {
30 public:
31 explicit AppWindowContentsImpl(AppWindow* host);
32 ~AppWindowContentsImpl() override;
34 // AppWindowContents
35 void Initialize(content::BrowserContext* context, const GURL& url) override;
36 void LoadContents(int32 creator_process_id) override;
37 void NativeWindowChanged(NativeAppWindow* native_app_window) override;
38 void NativeWindowClosed() override;
39 void DispatchWindowShownForTests() const override;
40 content::WebContents* GetWebContents() const override;
42 private:
43 // content::WebContentsObserver
44 bool OnMessageReceived(const IPC::Message& message) override;
46 // ExtensionFunctionDispatcher::Delegate
47 WindowController* GetExtensionWindowController() const override;
48 content::WebContents* GetAssociatedWebContents() const override;
50 void OnRequest(const ExtensionHostMsg_Request_Params& params);
51 void UpdateDraggableRegions(const std::vector<DraggableRegion>& regions);
52 void SuspendRenderViewHost(content::RenderViewHost* rvh);
54 AppWindow* host_; // This class is owned by |host_|
55 GURL url_;
56 scoped_ptr<content::WebContents> web_contents_;
57 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
59 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl);
62 } // namespace extensions
64 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CONTENTS_H_