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

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: Merge with ToT 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
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/browser/browser_plugin_guest_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 58f6fb877b0f7fb5d943702b6ffb9d8fefd6a879..cf552cfb5b986b79860394600774ee91a7ffffab 100644
--- a/content/public/browser/browser_plugin_guest_delegate.h
+++ b/content/public/browser/browser_plugin_guest_delegate.h
@@ -10,9 +10,9 @@
#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 "third_party/skia/include/core/SkColor.h"
+#include "ui/base/window_open_disposition.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/size.h"
#include "url/gurl.h"
@@ -26,6 +26,7 @@ struct ColorSuggestion;
struct ContextMenuParams;
struct FileChooserParams;
struct NativeWebKeyboardEvent;
+struct OpenURLParams;
// Objects implement this interface to get notified about changes in the guest
// WebContents and to provide necessary functionality.
@@ -34,6 +35,8 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
virtual ~BrowserPluginGuestDelegate() {}
// Add a message to the console.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void AddMessageToConsole(int32 level,
const base::string16& message,
int32 line_no,
@@ -41,19 +44,18 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Request the delegate to close this guest, and do whatever cleanup it needs
// to do.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void Close() {}
// 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.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void GuestProcessGone(base::TerminationStatus status) {}
// Informs the delegate that the embedder has been destroyed.
@@ -61,12 +63,16 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Informs the delegate of a reply to the find request specified by
// |request_id|.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void FindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {}
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}
// Requests setting the zoom level to the provided |zoom_level|.
@@ -74,47 +80,22 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
virtual bool IsDragAndDropEnabled();
- // 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).
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void LoadProgressed(double progress) {}
// Notification that the guest is no longer hung.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void RendererResponsive() {}
// Notification that the guest is hung.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
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) {}
@@ -124,12 +105,16 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// request is denied, a call should be made to |callback| with an empty list
// of devices. |request| has the details of the request (e.g. which of audio
// and/or video devices are requested, and lists of available devices).
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void RequestMediaAccessPermission(
const MediaStreamRequest& request,
const MediaResponseCallback& callback);
// Asks the delegate if the given guest can download.
// Invoking the |callback| synchronously is OK.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void CanDownload(const std::string& request_method,
const GURL& url,
const base::Callback<void(bool)>& callback);
@@ -143,23 +128,83 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate {
// Returns a pointer to a service to manage JavaScript dialogs. May return
// NULL in which case dialogs aren't shown.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual JavaScriptDialogManager* GetJavaScriptDialogManager();
// Called when color chooser should open. Returns the opened color chooser.
// Returns NULL if we failed to open the color chooser (e.g. when there is a
// ColorChooserDialog already open on Windows). Ownership of the returned
// pointer is transferred to the caller.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual ColorChooser* OpenColorChooser(
WebContents* web_contents,
SkColor color,
const std::vector<ColorSuggestion>& suggestions);
// Called when a file selection is to be done.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
virtual void RunFileChooser(WebContents* web_contents,
const FileChooserParams& params) {}
// Returns true if the context menu operation was handled by the delegate.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
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.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
+ 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.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
+ 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.
+ // TODO(fsamuel): Delete this once BrowserPluginGuest is no longer a
+ // WebContentsDelegate.
+ 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) {}
};
} // namespace content
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/browser/browser_plugin_guest_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698