Added the |findupdate| event to the <webview> find API as described in: https://docs...
[chromium-blink-merge.git] / apps / app_window_contents.h
blobb5c691df4178108c65751f2fd281fe7593017609
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 CHROME_BROWSER_EXTENSIONS_APP_WINDOW_CONTENTS_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_WINDOW_CONTENTS_H_
8 #include <vector>
10 #include "apps/app_window.h"
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/extensions/extension_function_dispatcher.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/web_contents_observer.h"
17 class GURL;
19 namespace content {
20 class BrowserContext;
23 namespace extensions {
24 struct DraggableRegion;
27 namespace apps {
29 // AppWindowContents class specific to app windows. It maintains a
30 // WebContents instance and observes it for the purpose of passing
31 // messages to the extensions system.
32 class AppWindowContentsImpl : public AppWindowContents,
33 public content::NotificationObserver,
34 public content::WebContentsObserver,
35 public ExtensionFunctionDispatcher::Delegate {
36 public:
37 explicit AppWindowContentsImpl(AppWindow* host);
38 virtual ~AppWindowContentsImpl();
40 // AppWindowContents
41 virtual void Initialize(content::BrowserContext* context,
42 const GURL& url) OVERRIDE;
43 virtual void LoadContents(int32 creator_process_id) OVERRIDE;
44 virtual void NativeWindowChanged(NativeAppWindow* native_app_window) OVERRIDE;
45 virtual void NativeWindowClosed() OVERRIDE;
46 virtual content::WebContents* GetWebContents() const OVERRIDE;
48 private:
49 // content::NotificationObserver
50 virtual void Observe(int type,
51 const content::NotificationSource& source,
52 const content::NotificationDetails& details) OVERRIDE;
54 // content::WebContentsObserver
55 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
57 // ExtensionFunctionDispatcher::Delegate
58 virtual extensions::WindowController* GetExtensionWindowController() const
59 OVERRIDE;
60 virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
62 void OnRequest(const ExtensionHostMsg_Request_Params& params);
63 void UpdateDraggableRegions(
64 const std::vector<extensions::DraggableRegion>& regions);
65 void SuspendRenderViewHost(content::RenderViewHost* rvh);
67 AppWindow* host_; // This class is owned by |host_|
68 GURL url_;
69 content::NotificationRegistrar registrar_;
70 scoped_ptr<content::WebContents> web_contents_;
71 scoped_ptr<ExtensionFunctionDispatcher> extension_function_dispatcher_;
73 DISALLOW_COPY_AND_ASSIGN(AppWindowContentsImpl);
76 } // namespace apps
78 #endif // CHROME_BROWSER_EXTENSIONS_APP_WINDOW_CONTENTS_H_