| Index: chrome/browser/guest_view/web_view/web_view_guest.cc
|
| diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc
|
| index 981e16626e6b37000aa396729277e901b29a915c..0247aba33fed4f600f855d19f2a3acecacbb3609 100644
|
| --- a/chrome/browser/guest_view/web_view/web_view_guest.cc
|
| +++ b/chrome/browser/guest_view/web_view/web_view_guest.cc
|
| @@ -177,7 +177,6 @@ WebViewGuest::WebViewGuest(int guest_instance_id,
|
| : GuestView<WebViewGuest>(guest_instance_id,
|
| guest_web_contents,
|
| embedder_extension_id),
|
| - WebContentsObserver(guest_web_contents),
|
| script_executor_(new extensions::ScriptExecutor(guest_web_contents,
|
| &script_observers_)),
|
| pending_context_menu_request_id_(0),
|
| @@ -334,24 +333,22 @@ void WebViewGuest::Attach(WebContents* embedder_web_contents,
|
| AddWebViewToExtensionRendererState();
|
| }
|
|
|
| -bool WebViewGuest::HandleContextMenu(
|
| - const content::ContextMenuParams& params) {
|
| - ContextMenuDelegate* menu_delegate =
|
| - ContextMenuDelegate::FromWebContents(guest_web_contents());
|
| - DCHECK(menu_delegate);
|
| -
|
| - pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params);
|
| -
|
| - // Pass it to embedder.
|
| - int request_id = ++pending_context_menu_request_id_;
|
| - scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
|
| - scoped_ptr<base::ListValue> items =
|
| - MenuModelToValue(pending_menu_->menu_model());
|
| - args->Set(webview::kContextMenuItems, items.release());
|
| - args->SetInteger(webview::kRequestId, request_id);
|
| - DispatchEvent(new GuestViewBase::Event(webview::kEventContextMenu,
|
| - args.Pass()));
|
| - return true;
|
| +void WebViewGuest::EmbedderDestroyed() {
|
| + // TODO(fsamuel): WebRequest event listeners for <webview> should survive
|
| + // reparenting of a <webview> within a single embedder. Right now, we keep
|
| + // around the browser state for the listener for the lifetime of the embedder.
|
| + // Ideally, the lifetime of the listeners should match the lifetime of the
|
| + // <webview> DOM node. Once http://crbug.com/156219 is resolved we can move
|
| + // the call to RemoveWebViewEventListenersOnIOThread back to
|
| + // WebViewGuest::WebContentsDestroyed.
|
| + content::BrowserThread::PostTask(
|
| + content::BrowserThread::IO,
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &RemoveWebViewEventListenersOnIOThread,
|
| + browser_context(), embedder_extension_id(),
|
| + embedder_render_process_id(),
|
| + view_instance_id()));
|
| }
|
|
|
| bool WebViewGuest::AddMessageToConsole(WebContents* source,
|
| @@ -401,24 +398,6 @@ void WebViewGuest::DidAttach() {
|
| }
|
| }
|
|
|
| -void WebViewGuest::EmbedderDestroyed() {
|
| - // TODO(fsamuel): WebRequest event listeners for <webview> should survive
|
| - // reparenting of a <webview> within a single embedder. Right now, we keep
|
| - // around the browser state for the listener for the lifetime of the embedder.
|
| - // Ideally, the lifetime of the listeners should match the lifetime of the
|
| - // <webview> DOM node. Once http://crbug.com/156219 is resolved we can move
|
| - // the call to RemoveWebViewEventListenersOnIOThread back to
|
| - // WebViewGuest::WebContentsDestroyed.
|
| - content::BrowserThread::PostTask(
|
| - content::BrowserThread::IO,
|
| - FROM_HERE,
|
| - base::Bind(
|
| - &RemoveWebViewEventListenersOnIOThread,
|
| - browser_context(), embedder_extension_id(),
|
| - embedder_render_process_id(),
|
| - view_instance_id()));
|
| -}
|
| -
|
| void WebViewGuest::FindReply(WebContents* source,
|
| int request_id,
|
| int number_of_matches,
|
| @@ -429,6 +408,26 @@ void WebViewGuest::FindReply(WebContents* source,
|
| active_match_ordinal, final_update);
|
| }
|
|
|
| +bool WebViewGuest::HandleContextMenu(
|
| + const content::ContextMenuParams& params) {
|
| + ContextMenuDelegate* menu_delegate =
|
| + ContextMenuDelegate::FromWebContents(guest_web_contents());
|
| + DCHECK(menu_delegate);
|
| +
|
| + pending_menu_ = menu_delegate->BuildMenu(guest_web_contents(), params);
|
| +
|
| + // Pass it to embedder.
|
| + int request_id = ++pending_context_menu_request_id_;
|
| + scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
|
| + scoped_ptr<base::ListValue> items =
|
| + MenuModelToValue(pending_menu_->menu_model());
|
| + args->Set(webview::kContextMenuItems, items.release());
|
| + args->SetInteger(webview::kRequestId, request_id);
|
| + DispatchEvent(new GuestViewBase::Event(webview::kEventContextMenu,
|
| + args.Pass()));
|
| + return true;
|
| +}
|
| +
|
| void WebViewGuest::HandleKeyboardEvent(
|
| WebContents* source,
|
| const content::NativeWebKeyboardEvent& event) {
|
| @@ -883,6 +882,7 @@ void WebViewGuest::WebContentsDestroyed() {
|
| embedder_extension_id(), view_instance_id()));
|
|
|
| RemoveWebViewFromExtensionRendererState(web_contents());
|
| + GuestViewBase::WebContentsDestroyed();
|
| }
|
|
|
| void WebViewGuest::UserAgentOverrideSet(const std::string& user_agent) {
|
|
|