OLD | NEW |
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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( | 406 void BrowserPluginGuest::DidCommitProvisionalLoadForFrame( |
407 int64 frame_id, | 407 int64 frame_id, |
408 const base::string16& frame_unique_name, | 408 const base::string16& frame_unique_name, |
409 bool is_main_frame, | 409 bool is_main_frame, |
410 const GURL& url, | 410 const GURL& url, |
411 PageTransition transition_type, | 411 PageTransition transition_type, |
412 RenderViewHost* render_view_host) { | 412 RenderViewHost* render_view_host) { |
413 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate")); | 413 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.DidNavigate")); |
414 } | 414 } |
415 | 415 |
416 void BrowserPluginGuest::DidStopLoading(RenderViewHost* render_view_host) { | |
417 bool enable_dragdrop = delegate_ && delegate_->IsDragAndDropEnabled(); | |
418 if (!enable_dragdrop) { | |
419 // Initiating a drag from inside a guest is currently not supported without | |
420 // the kEnableBrowserPluginDragDrop flag on a linux platform. So inject some | |
421 // JS to disable it. http://crbug.com/161112 | |
422 const char script[] = "window.addEventListener('dragstart', function() { " | |
423 " window.event.preventDefault(); " | |
424 "});"; | |
425 render_view_host->GetMainFrame()->ExecuteJavaScript( | |
426 base::ASCIIToUTF16(script)); | |
427 } | |
428 } | |
429 | |
430 void BrowserPluginGuest::RenderViewReady() { | 416 void BrowserPluginGuest::RenderViewReady() { |
431 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); | 417 RenderViewHost* rvh = GetWebContents()->GetRenderViewHost(); |
432 // The guest RenderView should always live in a guest process. | 418 // The guest RenderView should always live in a guest process. |
433 CHECK(rvh->GetProcess()->IsGuest()); | 419 CHECK(rvh->GetProcess()->IsGuest()); |
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_); |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |