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

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: Added tests Created 6 years, 6 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..78a4d8fcab0d3c60c87795456e91e428af80764d 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,41 @@
#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;
+};
+
+class AppViewGuest : public GuestView<AppViewGuest>,
+ public extensions::ExtensionFunctionDispatcher::Delegate {
public:
static const char Type[];
+ static bool CompletePendingRequest(
+ const GURL& url,
+ int guest_instance_id,
+ content::BrowserContext* browser_context,
+ 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 +47,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_

Powered by Google App Engine
This is Rietveld 408576698