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

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

Issue 17846010: <webview>: Move contentload event from content to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_loadstop
Patch Set: Merge with ToT Created 7 years, 5 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
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 409
410 // We would like the guest to report changes to frame names so that we can 410 // We would like the guest to report changes to frame names so that we can
411 // update the BrowserPlugin's corresponding 'name' attribute. 411 // update the BrowserPlugin's corresponding 'name' attribute.
412 // TODO(fsamuel): Remove this once http://crbug.com/169110 is addressed. 412 // TODO(fsamuel): Remove this once http://crbug.com/169110 is addressed.
413 renderer_prefs->report_frame_name_changes = true; 413 renderer_prefs->report_frame_name_changes = true;
414 // Navigation is disabled in Chrome Apps. We want to make sure guest-initiated 414 // Navigation is disabled in Chrome Apps. We want to make sure guest-initiated
415 // navigations still continue to function inside the app. 415 // navigations still continue to function inside the app.
416 renderer_prefs->browser_handles_all_top_level_requests = false; 416 renderer_prefs->browser_handles_all_top_level_requests = false;
417 417
418 notification_registrar_.Add( 418 notification_registrar_.Add(
419 this, NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
420 Source<WebContents>(GetWebContents()));
421
422 notification_registrar_.Add(
423 this, NOTIFICATION_RESOURCE_RECEIVED_REDIRECT, 419 this, NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
424 Source<WebContents>(GetWebContents())); 420 Source<WebContents>(GetWebContents()));
425 421
426 // Listen to embedder visibility changes so that the guest is in a 'shown' 422 // Listen to embedder visibility changes so that the guest is in a 'shown'
427 // state if both the embedder is visible and the BrowserPlugin is marked as 423 // state if both the embedder is visible and the BrowserPlugin is marked as
428 // visible. 424 // visible.
429 notification_registrar_.Add( 425 notification_registrar_.Add(
430 this, NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, 426 this, NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
431 Source<WebContents>(embedder_web_contents_)); 427 Source<WebContents>(embedder_web_contents_));
432 428
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) { 511 gfx::Rect BrowserPluginGuest::ToGuestRect(const gfx::Rect& bounds) {
516 gfx::Rect guest_rect(bounds); 512 gfx::Rect guest_rect(bounds);
517 guest_rect.Offset(guest_window_rect_.OffsetFromOrigin()); 513 guest_rect.Offset(guest_window_rect_.OffsetFromOrigin());
518 return guest_rect; 514 return guest_rect;
519 } 515 }
520 516
521 void BrowserPluginGuest::Observe(int type, 517 void BrowserPluginGuest::Observe(int type,
522 const NotificationSource& source, 518 const NotificationSource& source,
523 const NotificationDetails& details) { 519 const NotificationDetails& details) {
524 switch (type) { 520 switch (type) {
525 case NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
526 DCHECK_EQ(Source<WebContents>(source).ptr(), GetWebContents());
527 LoadHandlerCalled();
528 break;
529 }
530 case NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: { 521 case NOTIFICATION_RESOURCE_RECEIVED_REDIRECT: {
531 DCHECK_EQ(Source<WebContents>(source).ptr(), GetWebContents()); 522 DCHECK_EQ(Source<WebContents>(source).ptr(), GetWebContents());
532 ResourceRedirectDetails* resource_redirect_details = 523 ResourceRedirectDetails* resource_redirect_details =
533 Details<ResourceRedirectDetails>(details).ptr(); 524 Details<ResourceRedirectDetails>(details).ptr();
534 bool is_top_level = 525 bool is_top_level =
535 resource_redirect_details->resource_type == ResourceType::MAIN_FRAME; 526 resource_redirect_details->resource_type == ResourceType::MAIN_FRAME;
536 LoadRedirect(resource_redirect_details->url, 527 LoadRedirect(resource_redirect_details->url,
537 resource_redirect_details->new_url, 528 resource_redirect_details->new_url,
538 is_top_level); 529 is_top_level);
539 break; 530 break;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 // As a result, we must save all these IPCs until attachment and then 804 // As a result, we must save all these IPCs until attachment and then
814 // forward them so that the embedder gets a chance to see and process 805 // forward them so that the embedder gets a chance to see and process
815 // the load events. 806 // the load events.
816 pending_messages_.push(msg); 807 pending_messages_.push(msg);
817 return; 808 return;
818 } 809 }
819 msg->set_routing_id(embedder_web_contents_->GetRoutingID()); 810 msg->set_routing_id(embedder_web_contents_->GetRoutingID());
820 embedder_web_contents_->Send(msg); 811 embedder_web_contents_->Send(msg);
821 } 812 }
822 813
823 void BrowserPluginGuest::LoadHandlerCalled() {
824 SendMessageToEmbedder(new BrowserPluginMsg_LoadHandlerCalled(instance_id()));
825 }
826
827 void BrowserPluginGuest::DragSourceEndedAt(int client_x, int client_y, 814 void BrowserPluginGuest::DragSourceEndedAt(int client_x, int client_y,
828 int screen_x, int screen_y, WebKit::WebDragOperation operation) { 815 int screen_x, int screen_y, WebKit::WebDragOperation operation) {
829 web_contents()->GetRenderViewHost()->DragSourceEndedAt(client_x, client_y, 816 web_contents()->GetRenderViewHost()->DragSourceEndedAt(client_x, client_y,
830 screen_x, screen_y, operation); 817 screen_x, screen_y, operation);
831 } 818 }
832 819
833 void BrowserPluginGuest::DragSourceMovedTo(int client_x, int client_y, 820 void BrowserPluginGuest::DragSourceMovedTo(int client_x, int client_y,
834 int screen_x, int screen_y) { 821 int screen_x, int screen_y) {
835 web_contents()->GetRenderViewHost()->DragSourceMovedTo(client_x, client_y, 822 web_contents()->GetRenderViewHost()->DragSourceMovedTo(client_x, client_y,
836 screen_x, screen_y); 823 screen_x, screen_y);
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 base::Value::CreateStringValue(request_method)); 1586 base::Value::CreateStringValue(request_method));
1600 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); 1587 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url));
1601 1588
1602 SendMessageToEmbedder( 1589 SendMessageToEmbedder(
1603 new BrowserPluginMsg_RequestPermission(instance_id(), 1590 new BrowserPluginMsg_RequestPermission(instance_id(),
1604 BrowserPluginPermissionTypeDownload, permission_request_id, 1591 BrowserPluginPermissionTypeDownload, permission_request_id,
1605 request_info)); 1592 request_info));
1606 } 1593 }
1607 1594
1608 } // namespace content 1595 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698