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

Unified Diff: content/public/browser/browser_plugin_guest_delegate.h

Issue 272573005: <webview>: Move NewWindow API to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_rename
Patch Set: Addressed Istiaque's comments Created 6 years, 7 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: content/public/browser/browser_plugin_guest_delegate.h
diff --git a/content/public/browser/browser_plugin_guest_delegate.h b/content/public/browser/browser_plugin_guest_delegate.h
index 6df0ef19a5f22e5ac6b21792d7c1fb7a29787c16..e179fa826196eaa853384c72ee349c591d37204f 100644
--- a/content/public/browser/browser_plugin_guest_delegate.h
+++ b/content/public/browser/browser_plugin_guest_delegate.h
@@ -10,8 +10,8 @@
#include "base/strings/string16.h"
#include "base/values.h"
#include "content/common/content_export.h"
-#include "content/public/common/browser_plugin_permission_type.h"
#include "content/public/common/media_stream_request.h"
+#include "ui/base/window_open_disposition.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/size.h"
#include "url/gurl.h"
@@ -19,9 +19,10 @@
namespace content {
class JavaScriptDialogManager;
+class WebContents;
struct ContextMenuParams;
struct NativeWebKeyboardEvent;
-class WebContents;
+struct OpenURLParams;
// Objects implement this interface to get notified about changes in the guest
// WebContents and to provide necessary functionality.
@@ -42,11 +43,6 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Notification that the embedder has completed attachment.
virtual void DidAttach() {}
- // Returns the opener for this guest.
- // TODO(fsamuel): Remove this once the New Window API is migrated outside of
- // the content layer.
- virtual WebContents* GetOpener() const;
-
// Informs the delegate that the guest render process is gone. |status|
// indicates whether the guest was killed, crashed, or was terminated
// gracefully.
@@ -73,12 +69,6 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Returns whether the user agent for the guest is being overridden.
virtual bool IsOverridingUserAgent() const;
- // Notification that a load in the guest resulted in abort. Note that |url|
- // may be invalid.
- virtual void LoadAbort(bool is_top_level,
- const GURL& url,
- const std::string& error_type) {}
-
// Notification that the page has made some progress loading. |progress| is a
// value between 0.0 (nothing loaded) and 1.0 (page loaded completely).
virtual void LoadProgressed(double progress) {}
@@ -89,28 +79,6 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Notification that the guest is hung.
virtual void RendererUnresponsive() {}
- typedef base::Callback<void(bool /* allow */,
- const std::string& /* user_input */)>
- PermissionResponseCallback;
-
- // Request permission from the delegate to perform an action of the provided
- // |permission_type|. Details of the permission request are found in
- // |request_info|. A |callback| is provided to make the decision.
- virtual void RequestPermission(
- BrowserPluginPermissionType permission_type,
- const base::DictionaryValue& request_info,
- const PermissionResponseCallback& callback,
- bool allowed_by_default) {}
-
- // Requests resolution of a potentially relative URL.
- virtual GURL ResolveURL(const std::string& src);
-
- // Informs the delegate of the WebContents that created delegate's associated
- // WebContents.
- // TODO(fsamuel): Remove this once the New Window API is migrated outside of
- // the content layer.
- virtual void SetOpener(WebContents* opener) {}
-
// Notifies that the content size of the guest has changed in autosize mode.
virtual void SizeChanged(const gfx::Size& old_size,
const gfx::Size& new_size) {}
@@ -143,6 +111,52 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Returns true if the context menu operation was handled by the delegate.
virtual bool HandleContextMenu(const ContextMenuParams& params);
+
+ // Request navigating the guest to the provided |src| URL.
+ virtual void NavigateGuest(const std::string& src) {}
+
+ // Requests that the delegate destroy itself along with its associated
+ // WebContents.
+ virtual void Destroy() {}
+
+ // Creates a new tab with the already-created WebContents |new_contents|.
+ // The window for the added contents should be reparented correctly when this
+ // method returns. If |disposition| is NEW_POPUP, |initial_pos| should hold
+ // the initial position. If |was_blocked| is non-NULL, then |*was_blocked|
+ // will be set to true if the popup gets blocked, and left unchanged
+ // otherwise.
+ virtual void AddNewContents(WebContents* source,
+ WebContents* new_contents,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture,
+ bool* was_blocked) {}
+
+ // Opens a new URL inside the passed in WebContents (if source is 0 open
+ // in the current front-most tab), unless |disposition| indicates the url
+ // should be opened in a new tab or window.
+ //
+ // A NULL source indicates the current tab (callers should probably use
+ // OpenURL() for these cases which does it for you).
+ //
+ // Returns the WebContents the URL is opened in, or NULL if the URL wasn't
+ // opened immediately.
+ virtual WebContents* OpenURLFromTab(WebContents* source,
+ const OpenURLParams& params);
+
+ // Notifies the delegate about the creation of a new WebContents. This
+ // typically happens when popups are created.
+ virtual void WebContentsCreated(WebContents* source_contents,
+ int opener_render_frame_id,
+ const base::string16& frame_name,
+ const GURL& target_url,
+ WebContents* new_contents) {}
+
+ // Registers a |callback| with the delegate that the delegate would call when
+ // it is about to be destroyed.
+ typedef base::Callback<void(WebContents*)> DestructionCallback;
+ virtual void RegisterDestructionCallback(
+ const DestructionCallback& callback) {}
jam 2014/05/13 21:38:25 can you comment which of these methods (and also t
Fady Samuel 2014/05/15 20:02:57 I've commented on the ones which will definitely b
};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698