| Index: chrome/browser/guest_view/web_view/web_view_guest.h
|
| diff --git a/chrome/browser/guest_view/web_view/web_view_guest.h b/chrome/browser/guest_view/web_view/web_view_guest.h
|
| index 2814dc5e4731b399c96c32415797f84dcbfe7b7f..ee86f63b03ac6e950ad9540914f03f061d77a7ac 100644
|
| --- a/chrome/browser/guest_view/web_view/web_view_guest.h
|
| +++ b/chrome/browser/guest_view/web_view/web_view_guest.h
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/guest_view/guest_view.h"
|
| #include "chrome/browser/guest_view/web_view/javascript_dialog_helper.h"
|
| #include "chrome/browser/guest_view/web_view/web_view_find_helper.h"
|
| +#include "chrome/browser/guest_view/web_view/web_view_permission_types.h"
|
| #include "chrome/common/extensions/api/webview.h"
|
| #include "content/public/browser/javascript_dialog_manager.h"
|
| #include "content/public/browser/notification_registrar.h"
|
| @@ -46,9 +47,9 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
| public content::NotificationObserver,
|
| public content::WebContentsObserver {
|
| public:
|
| - WebViewGuest(content::WebContents* guest_web_contents,
|
| - const std::string& embedder_extension_id,
|
| - const base::WeakPtr<GuestViewBase>& opener);
|
| + WebViewGuest(int guest_instance_id,
|
| + content::WebContents* guest_web_contents,
|
| + const std::string& embedder_extension_id);
|
|
|
| // Returns guestview::kInstanceIDNone if |contents| does not correspond to a
|
| // WebViewGuest.
|
| @@ -88,18 +89,8 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
| virtual void HandleKeyboardEvent(
|
| const content::NativeWebKeyboardEvent& event) OVERRIDE;
|
| virtual bool IsDragAndDropEnabled() OVERRIDE;
|
| - virtual bool IsOverridingUserAgent() const OVERRIDE;
|
| - virtual void LoadAbort(bool is_top_level,
|
| - const GURL& url,
|
| - const std::string& error_type) OVERRIDE;
|
| virtual void RendererResponsive() OVERRIDE;
|
| virtual void RendererUnresponsive() OVERRIDE;
|
| - virtual void RequestPermission(
|
| - BrowserPluginPermissionType permission_type,
|
| - const base::DictionaryValue& request_info,
|
| - const PermissionResponseCallback& callback,
|
| - bool allowed_by_default) OVERRIDE;
|
| - virtual GURL ResolveURL(const std::string& src) OVERRIDE;
|
| virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size)
|
| OVERRIDE;
|
| virtual void RequestMediaAccessPermission(
|
| @@ -121,6 +112,22 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
| virtual void RunFileChooser(
|
| content::WebContents* web_contents,
|
| const content::FileChooserParams& params) OVERRIDE;
|
| + virtual void NavigateGuest(const std::string& src) OVERRIDE;
|
| + virtual void Destroy() OVERRIDE;
|
| + virtual void AddNewContents(content::WebContents* source,
|
| + content::WebContents* new_contents,
|
| + WindowOpenDisposition disposition,
|
| + const gfx::Rect& initial_pos,
|
| + bool user_gesture,
|
| + bool* was_blocked) OVERRIDE;
|
| + virtual content::WebContents* OpenURLFromTab(
|
| + content::WebContents* source,
|
| + const content::OpenURLParams& params) OVERRIDE;
|
| + virtual void WebContentsCreated(content::WebContents* source_contents,
|
| + int opener_render_frame_id,
|
| + const base::string16& frame_name,
|
| + const GURL& target_url,
|
| + content::WebContents* new_contents) OVERRIDE;
|
|
|
| // NotificationObserver implementation.
|
| virtual void Observe(int type,
|
| @@ -148,6 +155,15 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
| // Reload the guest.
|
| void Reload();
|
|
|
| + typedef base::Callback<void(bool /* allow */,
|
| + const std::string& /* user_input */)>
|
| + PermissionResponseCallback;
|
| + int RequestPermission(
|
| + WebViewPermissionType permission_type,
|
| + const base::DictionaryValue& request_info,
|
| + const PermissionResponseCallback& callback,
|
| + bool allowed_by_default);
|
| +
|
| // Requests Geolocation Permission from the embedder.
|
| void RequestGeolocationPermission(int bridge_id,
|
| const GURL& requesting_frame,
|
| @@ -179,6 +195,10 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
| bool allow,
|
| const std::string& user_input);
|
|
|
| + void OnWebViewNewWindowResponse(int new_window_instance_id,
|
| + bool allow,
|
| + const std::string& user_input);
|
| +
|
| enum PermissionResponseAction {
|
| DENY,
|
| ALLOW,
|
| @@ -226,11 +246,11 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
| // A map to store the callback for a request keyed by the request's id.
|
| struct PermissionResponseInfo {
|
| PermissionResponseCallback callback;
|
| - BrowserPluginPermissionType permission_type;
|
| + WebViewPermissionType permission_type;
|
| bool allowed_by_default;
|
| PermissionResponseInfo();
|
| PermissionResponseInfo(const PermissionResponseCallback& callback,
|
| - BrowserPluginPermissionType permission_type,
|
| + WebViewPermissionType permission_type,
|
| bool allowed_by_default);
|
| ~PermissionResponseInfo();
|
| };
|
| @@ -299,11 +319,33 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
| // provided |bridge_id|. It returns the request ID of the geolocation request.
|
| int RemoveBridgeID(int bridge_id);
|
|
|
| - int RequestPermissionInternal(
|
| - BrowserPluginPermissionType permission_type,
|
| - const base::DictionaryValue& request_info,
|
| - const PermissionResponseCallback& callback,
|
| - bool allowed_by_default);
|
| + void LoadURLWithParams(const GURL& url,
|
| + const content::Referrer& referrer,
|
| + content::PageTransition transition_type,
|
| + content::WebContents* web_contents);
|
| +
|
| + void RequestNewWindowPermission(
|
| + WindowOpenDisposition disposition,
|
| + const gfx::Rect& initial_bounds,
|
| + bool user_gesture,
|
| + content::WebContents* new_contents);
|
| +
|
| + // Destroy unattached new windows that have been opened by this
|
| + // WebViewGuest.
|
| + void DestroyUnattachedWindows();
|
| +
|
| + // Requests resolution of a potentially relative URL.
|
| + GURL ResolveURL(const std::string& src);
|
| +
|
| + // Notification that a load in the guest resulted in abort. Note that |url|
|
| + // may be invalid.
|
| + void LoadAbort(bool is_top_level,
|
| + const GURL& url,
|
| + const std::string& error_type);
|
| +
|
| +
|
| + // Creates a new guest window owned by this WebViewGuest.
|
| + WebViewGuest* CreateNewGuestWindow(const content::OpenURLParams& params);
|
|
|
| bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event);
|
|
|
| @@ -361,6 +403,19 @@ class WebViewGuest : public GuestView<WebViewGuest>,
|
|
|
| std::map<int, int> bridge_id_to_request_id_map_;
|
|
|
| + // Tracks the name, and target URL of the new window. Once the first
|
| + // navigation commits, we no longer track this information.
|
| + struct NewWindowInfo {
|
| + GURL url;
|
| + std::string name;
|
| + NewWindowInfo(const GURL& url, const std::string& name) :
|
| + url(url),
|
| + name(name) {}
|
| + };
|
| +
|
| + typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap;
|
| + PendingWindowMap pending_new_windows_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(WebViewGuest);
|
| };
|
|
|
|
|