Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1478)

Unified Diff: chrome/browser/guest_view/app_view/app_view_guest.h

Issue 354483004: Implement <appview> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_view_skeleton
Patch Set: Fixed formatting Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/guest_view/app_view/app_view_guest.h
diff --git a/chrome/browser/guest_view/app_view/app_view_guest.h b/chrome/browser/guest_view/app_view/app_view_guest.h
index 33e01972b56ece5c51f86d39e3f6111217251f59..f239019cedfb4ee216dc539893ff84ad1be007fc 100644
--- a/chrome/browser/guest_view/app_view/app_view_guest.h
+++ b/chrome/browser/guest_view/app_view/app_view_guest.h
@@ -5,15 +5,47 @@
#ifndef CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
#define CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
+#include "base/id_map.h"
#include "chrome/browser/guest_view/guest_view.h"
+#include "extensions/browser/extension_function_dispatcher.h"
-class AppViewGuest : public GuestView<AppViewGuest> {
+namespace extensions {
+class Extension;
+class ExtensionHost;
+};
+
+// An AppViewGuest provides the browser-side implementation of <appview> API.
+// AppViewGuest is created on attachment. That is, when a guest WEbContnets is
+// associated with a particular embedder WebContents. This happens on calls to
+// the connect API.
+class AppViewGuest : public GuestView<AppViewGuest>,
+ public extensions::ExtensionFunctionDispatcher::Delegate {
public:
static const char Type[];
+ // Completes the creation of a WebContents associated with the provided
+ // |guest_extensions_id|.
+ static bool CompletePendingRequest(
+ content::BrowserContext* browser_context,
+ const GURL& url,
+ int guest_instance_id,
+ const std::string& guest_extension_id);
+
AppViewGuest(content::BrowserContext* browser_context,
int guest_instance_id);
+ // ExtensionFunctionDispatcher::Delegate implementation.
+ virtual extensions::WindowController* GetExtensionWindowController() const
+ OVERRIDE;
+ virtual content::WebContents* GetAssociatedWebContents() const OVERRIDE;
+
+ // content::WebContentsObserver implementation.
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ // content::WebContentsDelegate implementation.
+ virtual bool HandleContextMenu(
+ const content::ContextMenuParams& params) OVERRIDE;
+
// GuestViewBase implementation.
virtual void CreateWebContents(
const std::string& embedder_extension_id,
@@ -21,9 +53,30 @@ class AppViewGuest : public GuestView<AppViewGuest> {
const base::DictionaryValue& create_params,
const WebContentsCreatedCallback& callback) OVERRIDE;
virtual void DidAttachToEmbedder() OVERRIDE;
+ virtual void DidInitialize() OVERRIDE;
private:
virtual ~AppViewGuest();
+
+ void OnRequest(const ExtensionHostMsg_Request_Params& params);
+
+ void CompleteCreateWebContents(const GURL& url,
+ const extensions::Extension* guest_extension,
+ const WebContentsCreatedCallback& callback);
+
+ void LaunchAppAndFireEvent(const WebContentsCreatedCallback& callback,
+ extensions::ExtensionHost* extension_host);
+
+ GURL url_;
+ std::string guest_extension_id_;
+ scoped_ptr<extensions::ExtensionFunctionDispatcher>
+ extension_function_dispatcher_;
+
+ // This is used to ensure pending tasks will not fire after this object is
+ // destroyed.
+ base::WeakPtrFactory<AppViewGuest> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppViewGuest);
};
#endif // CHROME_BROWSER_GUEST_VIEW_APP_VIEW_APP_VIEW_GUEST_H_
« no previous file with comments | « chrome/browser/guest_view/app_view/app_view_constants.cc ('k') | chrome/browser/guest_view/app_view/app_view_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698