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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 295083002: BrowserPluginGuest is no longer a WebContentsDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@make_context_menu_easier_to_refactor
Patch Set: Fixed focus after crash 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/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 565934220b29e48e46f5d7d3552b672454e4132d..82e10d033d91555c15370b636f10418087c452e5 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -113,19 +113,6 @@ BrowserPluginGuest::BrowserPluginGuest(
last_can_compose_inline_(true),
weak_ptr_factory_(this) {
DCHECK(web_contents);
- web_contents->SetDelegate(this);
-}
-
-bool BrowserPluginGuest::AddMessageToConsole(WebContents* source,
- int32 level,
- const base::string16& message,
- int32 line_no,
- const base::string16& source_id) {
- if (!delegate_)
- return false;
-
- delegate_->AddMessageToConsole(level, message, line_no, source_id);
- return true;
}
void BrowserPluginGuest::WillDestroy(WebContents* web_contents) {
@@ -368,76 +355,6 @@ void BrowserPluginGuest::EmbedderVisibilityChanged(bool visible) {
UpdateVisibility();
}
-void BrowserPluginGuest::AddNewContents(WebContents* source,
- WebContents* new_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture,
- bool* was_blocked) {
- if (!delegate_)
- return;
-
- delegate_->AddNewContents(source, new_contents, disposition,
- initial_pos, user_gesture, was_blocked);
-}
-
-void BrowserPluginGuest::CanDownload(
- RenderViewHost* render_view_host,
- const GURL& url,
- const std::string& request_method,
- const base::Callback<void(bool)>& callback) {
- if (!delegate_ || !url.is_valid()) {
- callback.Run(false);
- return;
- }
-
- delegate_->CanDownload(request_method, url, callback);
-}
-
-void BrowserPluginGuest::LoadProgressChanged(WebContents* contents,
- double progress) {
- if (delegate_)
- delegate_->LoadProgressed(progress);
-}
-
-void BrowserPluginGuest::CloseContents(WebContents* source) {
- if (!delegate_)
- return;
-
- delegate_->Close();
-}
-
-JavaScriptDialogManager* BrowserPluginGuest::GetJavaScriptDialogManager() {
- if (!delegate_)
- return NULL;
- return delegate_->GetJavaScriptDialogManager();
-}
-
-ColorChooser* BrowserPluginGuest::OpenColorChooser(
- WebContents* web_contents,
- SkColor color,
- const std::vector<ColorSuggestion>& suggestions) {
- if (!delegate_)
- return NULL;
- return delegate_->OpenColorChooser(web_contents, color, suggestions);
-}
-
-bool BrowserPluginGuest::HandleContextMenu(const ContextMenuParams& params) {
- if (!delegate_)
- return false;
-
- return delegate_->HandleContextMenu(params);
-}
-
-void BrowserPluginGuest::HandleKeyboardEvent(
- WebContents* source,
- const NativeWebKeyboardEvent& event) {
- if (!delegate_)
- return;
-
- delegate_->HandleKeyboardEvent(event);
-}
-
void BrowserPluginGuest::SetZoom(double zoom_factor) {
if (delegate_)
delegate_->SetZoom(zoom_factor);
@@ -448,70 +365,6 @@ void BrowserPluginGuest::PointerLockPermissionResponse(bool allow) {
new BrowserPluginMsg_SetMouseLock(instance_id(), allow));
}
-void BrowserPluginGuest::FindReply(WebContents* contents,
- int request_id,
- int number_of_matches,
- const gfx::Rect& selection_rect,
- int active_match_ordinal,
- bool final_update) {
- if (!delegate_)
- return;
-
- // |selection_rect| is updated to incorporate embedder coordinates.
- delegate_->FindReply(request_id, number_of_matches,
- ToGuestRect(selection_rect),
- active_match_ordinal, final_update);
-}
-
-WebContents* BrowserPluginGuest::OpenURLFromTab(WebContents* source,
- const OpenURLParams& params) {
- if (!delegate_)
- return NULL;
- return delegate_->OpenURLFromTab(source, params);
-}
-
-void BrowserPluginGuest::WebContentsCreated(WebContents* source_contents,
- int opener_render_frame_id,
- const base::string16& frame_name,
- const GURL& target_url,
- WebContents* new_contents) {
- if (!delegate_)
- return;
-
- delegate_->WebContentsCreated(source_contents,
- opener_render_frame_id,
- frame_name,
- target_url,
- new_contents);
-}
-
-void BrowserPluginGuest::RendererUnresponsive(WebContents* source) {
- RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Hung"));
- if (!delegate_)
- return;
- delegate_->RendererUnresponsive();
-}
-
-void BrowserPluginGuest::RendererResponsive(WebContents* source) {
- RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Responsive"));
- if (!delegate_)
- return;
- delegate_->RendererResponsive();
-}
-
-void BrowserPluginGuest::RunFileChooser(WebContents* web_contents,
- const FileChooserParams& params) {
- if (!delegate_)
- return;
- delegate_->RunFileChooser(web_contents, params);
-}
-
-bool BrowserPluginGuest::ShouldFocusPageAfterCrash() {
- // Rather than managing focus in WebContentsImpl::RenderViewReady, we will
- // manage the focus ourselves.
- return false;
-}
-
WebContentsImpl* BrowserPluginGuest::GetWebContents() const {
return static_cast<WebContentsImpl*>(web_contents());
}
@@ -1074,28 +927,6 @@ void BrowserPluginGuest::OnTakeFocus(bool reverse) {
new BrowserPluginMsg_AdvanceFocus(instance_id(), reverse));
}
-void BrowserPluginGuest::RequestMediaAccessPermission(
- WebContents* web_contents,
- const MediaStreamRequest& request,
- const MediaResponseCallback& callback) {
- if (!delegate_) {
- callback.Run(MediaStreamDevices(),
- MEDIA_DEVICE_INVALID_STATE,
- scoped_ptr<MediaStreamUI>());
- return;
- }
-
- delegate_->RequestMediaAccessPermission(request, callback);
-}
-
-bool BrowserPluginGuest::PreHandleGestureEvent(
- WebContents* source, const blink::WebGestureEvent& event) {
- if (!delegate_)
- return false;
-
- return delegate_->PreHandleGestureEvent(source, event);
-}
-
void BrowserPluginGuest::OnUpdateRect(
const ViewHostMsg_UpdateRect_Params& params) {
BrowserPluginMsg_UpdateRect_Params relay_params;

Powered by Google App Engine
This is Rietveld 408576698