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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 301303003: GuestView: Move Disable Drag and Drop Out to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@change_browser_plugin_guest_delegate_lifetime
Patch Set: Addressed Istiaque's comments Created 6 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( 408 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
409 int64 frame_id, 409 int64 frame_id,
410 const base::string16& frame_unique_name, 410 const base::string16& frame_unique_name,
411 bool is_main_frame, 411 bool is_main_frame,
412 const GURL& url, 412 const GURL& url,
413 PageTransition transition_type, 413 PageTransition transition_type,
414 RenderViewHost* render_view_host) { 414 RenderViewHost* render_view_host) {
415 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate")); 415 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate"));
416 } 416 }
417 417
418 void BrowserPluginGuest::DidStopLoading(RenderViewHost* render_view_host) {
419 bool enable_dragdrop = delegate_ && delegate_->IsDragAndDropEnabled();
420 if (!enable_dragdrop) {
421 // Initiating a drag from inside a guest is currently not supported without
422 // the kEnableBrowserPluginDragDrop flag on a linux platform. So inject some
423 // JS to disable it. http://crbug.com/161112
424 const char script[] = "window.addEventListener('dragstart', function() { "
425 " window.event.preventDefault(); "
426 "});";
427 render_view_host->GetMainFrame()->ExecuteJavaScript(
428 base::ASCIIToUTF16(script));
429 }
430 }
431
432 void BrowserPluginGuest::RenderViewReady() { 418 void BrowserPluginGuest::RenderViewReady() {
433 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); 419 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost();
434 // TODO(fsamuel): Investigate whether it's possible to update state earlier 420 // TODO(fsamuel): Investigate whether it's possible to update state earlier
435 // here (see http://crbug.com/158151). 421 // here (see http://crbug.com/158151).
436 Send(new InputMsg_SetFocus(routing_id(), focused_)); 422 Send(new InputMsg_SetFocus(routing_id(), focused_));
437 UpdateVisibility(); 423 UpdateVisibility();
438 if (auto_size_enabled_) 424 if (auto_size_enabled_)
439 rvh->EnableAutoResize(min_auto_size_, max_auto_size_); 425 rvh->EnableAutoResize(min_auto_size_, max_auto_size_);
440 else 426 else
441 rvh->DisableAutoResize(full_size_); 427 rvh->DisableAutoResize(full_size_);
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 void BrowserPluginGuest::OnImeCompositionRangeChanged( 935 void BrowserPluginGuest::OnImeCompositionRangeChanged(
950 const gfx::Range& range, 936 const gfx::Range& range,
951 const std::vector<gfx::Rect>& character_bounds) { 937 const std::vector<gfx::Rect>& character_bounds) {
952 static_cast<RenderWidgetHostViewBase*>( 938 static_cast<RenderWidgetHostViewBase*>(
953 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 939 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
954 range, character_bounds); 940 range, character_bounds);
955 } 941 }
956 #endif 942 #endif
957 943
958 } // namespace content 944 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698