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

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

Issue 11312179: C++ readability review for lazyboy@ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync @tott Created 7 years, 1 month 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 | Annotate | Revision Log
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/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // static 57 // static
58 BrowserPluginHostFactory* BrowserPluginGuest::factory_ = NULL; 58 BrowserPluginHostFactory* BrowserPluginGuest::factory_ = NULL;
59 59
60 // Parent class for the various types of permission requests, each of which 60 // Parent class for the various types of permission requests, each of which
61 // should be able to handle the response to their permission request. 61 // should be able to handle the response to their permission request.
62 class BrowserPluginGuest::PermissionRequest : 62 class BrowserPluginGuest::PermissionRequest :
63 public base::RefCounted<BrowserPluginGuest::PermissionRequest> { 63 public base::RefCounted<BrowserPluginGuest::PermissionRequest> {
64 public: 64 public:
65 virtual void Respond(bool should_allow, const std::string& user_input) = 0; 65 virtual void Respond(bool should_allow, const std::string& user_input) = 0;
66 virtual bool AllowedByDefault() const { 66 virtual bool AllowedByDefault() const {
67 return false; 67 return false;
68 } 68 }
69 protected: 69 protected:
70 PermissionRequest() { 70 PermissionRequest() {
71 RecordAction(UserMetricsAction("BrowserPlugin.Guest.PermissionRequest")); 71 RecordAction(UserMetricsAction("BrowserPlugin.Guest.PermissionRequest"));
72 } 72 }
73 virtual ~PermissionRequest() {} 73 virtual ~PermissionRequest() {}
74 // Friend RefCounted so that the dtor can be non-public. 74 // Friend RefCounted so that the dtor can be non-public.
75 friend class base::RefCounted<BrowserPluginGuest::PermissionRequest>; 75 friend class base::RefCounted<BrowserPluginGuest::PermissionRequest>;
76 }; 76 };
77 77
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 RenderViewHost* render_view_host, 291 RenderViewHost* render_view_host,
292 int url_request_id) { 292 int url_request_id) {
293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
294 294
295 int render_process_id = render_view_host->GetProcess()->GetID(); 295 int render_process_id = render_view_host->GetProcess()->GetID();
296 GlobalRequestID global_id(render_process_id, url_request_id); 296 GlobalRequestID global_id(render_process_id, url_request_id);
297 net::URLRequest* url_request = 297 net::URLRequest* url_request =
298 ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id); 298 ResourceDispatcherHostImpl::Get()->GetURLRequest(global_id);
299 if (url_request) 299 if (url_request)
300 return url_request->url().possibly_invalid_spec(); 300 return url_request->url().possibly_invalid_spec();
301 return std::string(); 301 return "";
302 } 302 }
303 303
304 } // namespace 304 } // namespace
305 305
306 class BrowserPluginGuest::EmbedderWebContentsObserver 306 class BrowserPluginGuest::EmbedderWebContentsObserver
307 : public WebContentsObserver { 307 : public WebContentsObserver {
308 public: 308 public:
309 explicit EmbedderWebContentsObserver(BrowserPluginGuest* guest) 309 explicit EmbedderWebContentsObserver(BrowserPluginGuest* guest)
310 : WebContentsObserver(guest->embedder_web_contents()), 310 : WebContentsObserver(guest->embedder_web_contents()),
311 browser_plugin_guest_(guest) { 311 browser_plugin_guest_(guest) {
(...skipping 16 matching lines...) Expand all
328 } 328 }
329 329
330 private: 330 private:
331 BrowserPluginGuest* browser_plugin_guest_; 331 BrowserPluginGuest* browser_plugin_guest_;
332 332
333 DISALLOW_COPY_AND_ASSIGN(EmbedderWebContentsObserver); 333 DISALLOW_COPY_AND_ASSIGN(EmbedderWebContentsObserver);
334 }; 334 };
335 335
336 BrowserPluginGuest::BrowserPluginGuest( 336 BrowserPluginGuest::BrowserPluginGuest(
337 int instance_id, 337 int instance_id,
338 bool has_render_view,
338 WebContentsImpl* web_contents, 339 WebContentsImpl* web_contents,
339 BrowserPluginGuest* opener, 340 BrowserPluginGuest* opener)
340 bool has_render_view)
341 : WebContentsObserver(web_contents), 341 : WebContentsObserver(web_contents),
342 weak_ptr_factory_(this), 342 weak_ptr_factory_(this),
343 embedder_web_contents_(NULL), 343 embedder_web_contents_(NULL),
344 instance_id_(instance_id), 344 instance_id_(instance_id),
345 damage_buffer_sequence_id_(0), 345 damage_buffer_sequence_id_(0),
346 damage_buffer_size_(0), 346 damage_buffer_size_(0),
347 damage_buffer_scale_factor_(1.0f), 347 damage_buffer_scale_factor_(1.0f),
348 guest_device_scale_factor_(1.0f), 348 guest_device_scale_factor_(1.0f),
349 guest_hang_timeout_( 349 guest_hang_timeout_(
350 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 350 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
(...skipping 30 matching lines...) Expand all
381 // pending_new_windows_ set. To avoid mutating the set while iterating, we 381 // pending_new_windows_ set. To avoid mutating the set while iterating, we
382 // create a copy of the pending new windows set and iterate over the copy. 382 // create a copy of the pending new windows set and iterate over the copy.
383 PendingWindowMap pending_new_windows(pending_new_windows_); 383 PendingWindowMap pending_new_windows(pending_new_windows_);
384 // Clean up unattached new windows opened by this guest. 384 // Clean up unattached new windows opened by this guest.
385 for (PendingWindowMap::const_iterator it = pending_new_windows.begin(); 385 for (PendingWindowMap::const_iterator it = pending_new_windows.begin();
386 it != pending_new_windows.end(); ++it) { 386 it != pending_new_windows.end(); ++it) {
387 it->first->Destroy(); 387 it->first->Destroy();
388 } 388 }
389 // All pending windows should be removed from the set after Destroy() is 389 // All pending windows should be removed from the set after Destroy() is
390 // called on all of them. 390 // called on all of them.
391 DCHECK_EQ(0ul, pending_new_windows_.size()); 391 DCHECK(pending_new_windows_.empty());
392 } 392 }
393 393
394 void BrowserPluginGuest::LoadURLWithParams(WebContents* web_contents, 394 void BrowserPluginGuest::LoadURLWithParams(const GURL& url,
395 const GURL& url,
396 const Referrer& referrer, 395 const Referrer& referrer,
397 PageTransition transition_type) { 396 PageTransition transition_type,
397 WebContents* web_contents) {
398 NavigationController::LoadURLParams load_url_params(url); 398 NavigationController::LoadURLParams load_url_params(url);
399 load_url_params.referrer = referrer; 399 load_url_params.referrer = referrer;
400 load_url_params.transition_type = transition_type; 400 load_url_params.transition_type = transition_type;
401 load_url_params.extra_headers = std::string(); 401 load_url_params.extra_headers = std::string();
402 if (delegate_ && delegate_->IsOverridingUserAgent()) { 402 if (delegate_ && delegate_->IsOverridingUserAgent()) {
403 load_url_params.override_user_agent = 403 load_url_params.override_user_agent =
404 NavigationController::UA_OVERRIDE_TRUE; 404 NavigationController::UA_OVERRIDE_TRUE;
405 } 405 }
406 web_contents->GetController().LoadURLWithParams(load_url_params); 406 web_contents->GetController().LoadURLWithParams(load_url_params);
407 } 407 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 GetWebContents()->GetBrowserPluginGuestManager()->CreateGuest( 471 GetWebContents()->GetBrowserPluginGuestManager()->CreateGuest(
472 GetWebContents()->GetSiteInstance(), instance_id, 472 GetWebContents()->GetSiteInstance(), instance_id,
473 attach_params, extra_params.Pass()); 473 attach_params, extra_params.Pass());
474 new_guest->opener_ = AsWeakPtr(); 474 new_guest->opener_ = AsWeakPtr();
475 475
476 // Take ownership of |new_guest|. 476 // Take ownership of |new_guest|.
477 pending_new_windows_.insert( 477 pending_new_windows_.insert(
478 std::make_pair(new_guest, NewWindowInfo(params.url, std::string()))); 478 std::make_pair(new_guest, NewWindowInfo(params.url, std::string())));
479 479
480 // Request permission to show the new window. 480 // Request permission to show the new window.
481 RequestNewWindowPermission( 481 RequestNewWindowPermission(params.disposition, gfx::Rect(),
482 new_guest->GetWebContents(), 482 params.user_gesture, new_guest->GetWebContents());
483 params.disposition,
484 gfx::Rect(),
485 params.user_gesture);
486 483
487 return new_guest; 484 return new_guest;
488 } 485 }
489 486
490 void BrowserPluginGuest::EmbedderDestroyed() { 487 void BrowserPluginGuest::EmbedderDestroyed() {
491 embedder_web_contents_ = NULL; 488 embedder_web_contents_ = NULL;
492 if (delegate_) 489 if (delegate_)
493 delegate_->EmbedderDestroyed(); 490 delegate_->EmbedderDestroyed();
494 Destroy(); 491 Destroy();
495 } 492 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility) 526 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_SetVisibility, OnSetVisibility)
530 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UnlockMouse_ACK, OnUnlockMouseAck) 527 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UnlockMouse_ACK, OnUnlockMouseAck)
531 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateGeometry, OnUpdateGeometry) 528 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateGeometry, OnUpdateGeometry)
532 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateRect_ACK, OnUpdateRectACK) 529 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_UpdateRect_ACK, OnUpdateRectACK)
533 IPC_MESSAGE_UNHANDLED(handled = false) 530 IPC_MESSAGE_UNHANDLED(handled = false)
534 IPC_END_MESSAGE_MAP() 531 IPC_END_MESSAGE_MAP()
535 return handled; 532 return handled;
536 } 533 }
537 534
538 void BrowserPluginGuest::Initialize( 535 void BrowserPluginGuest::Initialize(
539 WebContentsImpl* embedder_web_contents, 536 const BrowserPluginHostMsg_Attach_Params& params,
540 const BrowserPluginHostMsg_Attach_Params& params) { 537 WebContentsImpl* embedder_web_contents) {
541 focused_ = params.focused; 538 focused_ = params.focused;
542 guest_visible_ = params.visible; 539 guest_visible_ = params.visible;
543 guest_window_rect_ = params.resize_guest_params.view_rect; 540 guest_window_rect_ = params.resize_guest_params.view_rect;
544 541
545 if (!params.name.empty()) 542 if (!params.name.empty())
546 name_ = params.name; 543 name_ = params.name;
547 auto_size_enabled_ = params.auto_size_params.enable; 544 auto_size_enabled_ = params.auto_size_params.enable;
548 max_auto_size_ = params.auto_size_params.max_size; 545 max_auto_size_ = params.auto_size_params.max_size;
549 min_auto_size_ = params.auto_size_params.min_size; 546 min_auto_size_ = params.auto_size_params.min_size;
550 547
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 BrowserPluginGuest* BrowserPluginGuest::Create( 634 BrowserPluginGuest* BrowserPluginGuest::Create(
638 int instance_id, 635 int instance_id,
639 SiteInstance* guest_site_instance, 636 SiteInstance* guest_site_instance,
640 WebContentsImpl* web_contents, 637 WebContentsImpl* web_contents,
641 scoped_ptr<base::DictionaryValue> extra_params) { 638 scoped_ptr<base::DictionaryValue> extra_params) {
642 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Create")); 639 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Create"));
643 BrowserPluginGuest* guest = NULL; 640 BrowserPluginGuest* guest = NULL;
644 if (factory_) { 641 if (factory_) {
645 guest = factory_->CreateBrowserPluginGuest(instance_id, web_contents); 642 guest = factory_->CreateBrowserPluginGuest(instance_id, web_contents);
646 } else { 643 } else {
647 guest = new BrowserPluginGuest(instance_id, web_contents, NULL, false); 644 guest = new BrowserPluginGuest(instance_id, false, web_contents, NULL);
648 } 645 }
649 guest->extra_attach_params_.reset(extra_params->DeepCopy()); 646 guest->extra_attach_params_.reset(extra_params->DeepCopy());
650 web_contents->SetBrowserPluginGuest(guest); 647 web_contents->SetBrowserPluginGuest(guest);
651 BrowserPluginGuestDelegate* delegate = NULL; 648 BrowserPluginGuestDelegate* delegate = NULL;
652 GetContentClient()->browser()->GuestWebContentsCreated( 649 GetContentClient()->browser()->GuestWebContentsCreated(
653 guest_site_instance, web_contents, NULL, &delegate, extra_params.Pass()); 650 guest_site_instance, web_contents, NULL, &delegate, extra_params.Pass());
654 guest->SetDelegate(delegate); 651 guest->SetDelegate(delegate);
655 return guest; 652 return guest;
656 } 653 }
657 654
658 // static 655 // static
659 BrowserPluginGuest* BrowserPluginGuest::CreateWithOpener( 656 BrowserPluginGuest* BrowserPluginGuest::CreateWithOpener(
660 int instance_id, 657 int instance_id,
658 bool has_render_view,
661 WebContentsImpl* web_contents, 659 WebContentsImpl* web_contents,
662 BrowserPluginGuest* opener, 660 BrowserPluginGuest* opener) {
663 bool has_render_view) {
664 BrowserPluginGuest* guest = 661 BrowserPluginGuest* guest =
665 new BrowserPluginGuest( 662 new BrowserPluginGuest(
666 instance_id, web_contents, opener, has_render_view); 663 instance_id, has_render_view, web_contents, opener);
667 web_contents->SetBrowserPluginGuest(guest); 664 web_contents->SetBrowserPluginGuest(guest);
668 BrowserPluginGuestDelegate* delegate = NULL; 665 BrowserPluginGuestDelegate* delegate = NULL;
669 GetContentClient()->browser()->GuestWebContentsCreated( 666 GetContentClient()->browser()->GuestWebContentsCreated(
670 opener->GetWebContents()->GetSiteInstance(), 667 opener->GetWebContents()->GetSiteInstance(),
671 web_contents, opener->GetWebContents(), &delegate, 668 web_contents, opener->GetWebContents(), &delegate,
672 scoped_ptr<base::DictionaryValue>()); 669 scoped_ptr<base::DictionaryValue>());
673 guest->SetDelegate(delegate); 670 guest->SetDelegate(delegate);
674 return guest; 671 return guest;
675 } 672 }
676 673
(...skipping 18 matching lines...) Expand all
695 } 692 }
696 693
697 void BrowserPluginGuest::AddNewContents(WebContents* source, 694 void BrowserPluginGuest::AddNewContents(WebContents* source,
698 WebContents* new_contents, 695 WebContents* new_contents,
699 WindowOpenDisposition disposition, 696 WindowOpenDisposition disposition,
700 const gfx::Rect& initial_pos, 697 const gfx::Rect& initial_pos,
701 bool user_gesture, 698 bool user_gesture,
702 bool* was_blocked) { 699 bool* was_blocked) {
703 if (was_blocked) 700 if (was_blocked)
704 *was_blocked = false; 701 *was_blocked = false;
705 RequestNewWindowPermission(static_cast<WebContentsImpl*>(new_contents), 702 RequestNewWindowPermission(disposition, initial_pos, user_gesture,
706 disposition, initial_pos, user_gesture); 703 static_cast<WebContentsImpl*>(new_contents));
707 } 704 }
708 705
709 void BrowserPluginGuest::CanDownload( 706 void BrowserPluginGuest::CanDownload(
710 RenderViewHost* render_view_host, 707 RenderViewHost* render_view_host,
711 int request_id, 708 int request_id,
712 const std::string& request_method, 709 const std::string& request_method,
713 const base::Callback<void(bool)>& callback) { 710 const base::Callback<void(bool)>& callback) {
714 BrowserThread::PostTaskAndReplyWithResult( 711 BrowserThread::PostTaskAndReplyWithResult(
715 BrowserThread::IO, FROM_HERE, 712 BrowserThread::IO, FROM_HERE,
716 base::Bind(&RetrieveDownloadURLFromRequestId, 713 base::Bind(&RetrieveDownloadURLFromRequestId,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 if (it == opener()->pending_new_windows_.end()) 776 if (it == opener()->pending_new_windows_.end())
780 return NULL; 777 return NULL;
781 const NewWindowInfo& old_target_url = it->second; 778 const NewWindowInfo& old_target_url = it->second;
782 NewWindowInfo new_window_info(params.url, old_target_url.name); 779 NewWindowInfo new_window_info(params.url, old_target_url.name);
783 new_window_info.changed = new_window_info.url != old_target_url.url; 780 new_window_info.changed = new_window_info.url != old_target_url.url;
784 it->second = new_window_info; 781 it->second = new_window_info;
785 return NULL; 782 return NULL;
786 } 783 }
787 if (params.disposition == CURRENT_TAB) { 784 if (params.disposition == CURRENT_TAB) {
788 // This can happen for cross-site redirects. 785 // This can happen for cross-site redirects.
789 LoadURLWithParams(source, params.url, params.referrer, params.transition); 786 LoadURLWithParams(params.url, params.referrer, params.transition, source);
790 return source; 787 return source;
791 } 788 }
792 789
793 return CreateNewGuestWindow(params)->GetWebContents(); 790 return CreateNewGuestWindow(params)->GetWebContents();
794 } 791 }
795 792
796 void BrowserPluginGuest::WebContentsCreated(WebContents* source_contents, 793 void BrowserPluginGuest::WebContentsCreated(WebContents* source_contents,
797 int64 source_frame_id, 794 int64 source_frame_id,
798 const string16& frame_name, 795 const string16& frame_name,
799 const GURL& target_url, 796 const GURL& target_url,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 screen_pos += guest_window_rect_.OffsetFromOrigin(); 878 screen_pos += guest_window_rect_.OffsetFromOrigin();
882 return screen_pos; 879 return screen_pos;
883 } 880 }
884 881
885 bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const { 882 bool BrowserPluginGuest::InAutoSizeBounds(const gfx::Size& size) const {
886 return size.width() <= max_auto_size_.width() && 883 return size.width() <= max_auto_size_.width() &&
887 size.height() <= max_auto_size_.height(); 884 size.height() <= max_auto_size_.height();
888 } 885 }
889 886
890 void BrowserPluginGuest::RequestNewWindowPermission( 887 void BrowserPluginGuest::RequestNewWindowPermission(
891 WebContentsImpl* new_contents,
892 WindowOpenDisposition disposition, 888 WindowOpenDisposition disposition,
893 const gfx::Rect& initial_bounds, 889 const gfx::Rect& initial_bounds,
894 bool user_gesture) { 890 bool user_gesture,
891 WebContentsImpl* new_contents) {
895 BrowserPluginGuest* guest = new_contents->GetBrowserPluginGuest(); 892 BrowserPluginGuest* guest = new_contents->GetBrowserPluginGuest();
896 PendingWindowMap::iterator it = pending_new_windows_.find(guest); 893 PendingWindowMap::iterator it = pending_new_windows_.find(guest);
897 if (it == pending_new_windows_.end()) 894 if (it == pending_new_windows_.end())
898 return; 895 return;
899 const NewWindowInfo& new_window_info = it->second; 896 const NewWindowInfo& new_window_info = it->second;
900 897
901 base::DictionaryValue request_info; 898 base::DictionaryValue request_info;
902 request_info.Set(browser_plugin::kInitialHeight, 899 request_info.Set(browser_plugin::kInitialHeight,
903 base::Value::CreateIntegerValue(initial_bounds.height())); 900 base::Value::CreateIntegerValue(initial_bounds.height()));
904 request_info.Set(browser_plugin::kInitialWidth, 901 request_info.Set(browser_plugin::kInitialWidth,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 case BrowserPluginHostMsg_SetAutoSize::ID: 1114 case BrowserPluginHostMsg_SetAutoSize::ID:
1118 case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID: 1115 case BrowserPluginHostMsg_SetEditCommandsForNextKeyEvent::ID:
1119 case BrowserPluginHostMsg_SetFocus::ID: 1116 case BrowserPluginHostMsg_SetFocus::ID:
1120 case BrowserPluginHostMsg_SetName::ID: 1117 case BrowserPluginHostMsg_SetName::ID:
1121 case BrowserPluginHostMsg_SetVisibility::ID: 1118 case BrowserPluginHostMsg_SetVisibility::ID:
1122 case BrowserPluginHostMsg_UnlockMouse_ACK::ID: 1119 case BrowserPluginHostMsg_UnlockMouse_ACK::ID:
1123 case BrowserPluginHostMsg_UpdateGeometry::ID: 1120 case BrowserPluginHostMsg_UpdateGeometry::ID:
1124 case BrowserPluginHostMsg_UpdateRect_ACK::ID: 1121 case BrowserPluginHostMsg_UpdateRect_ACK::ID:
1125 return true; 1122 return true;
1126 default: 1123 default:
1127 break; 1124 return false;
1128 } 1125 }
1129 return false;
1130 } 1126 }
1131 1127
1132 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) { 1128 bool BrowserPluginGuest::OnMessageReceived(const IPC::Message& message) {
1133 bool handled = true; 1129 bool handled = true;
1134 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message) 1130 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message)
1135 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, 1131 IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers,
1136 OnHasTouchEventHandlers) 1132 OnHasTouchEventHandlers)
1137 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse) 1133 IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
1138 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor) 1134 IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
1139 #if defined(OS_MACOSX) 1135 #if defined(OS_MACOSX)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 // Once a new guest is attached to the DOM of the embedder page, then the 1189 // Once a new guest is attached to the DOM of the embedder page, then the
1194 // lifetime of the new guest is no longer managed by the opener guest. 1190 // lifetime of the new guest is no longer managed by the opener guest.
1195 opener()->pending_new_windows_.erase(this); 1191 opener()->pending_new_windows_.erase(this);
1196 1192
1197 // The guest's frame name takes precedence over the BrowserPlugin's name. 1193 // The guest's frame name takes precedence over the BrowserPlugin's name.
1198 // The guest's frame name is assigned in 1194 // The guest's frame name is assigned in
1199 // BrowserPluginGuest::WebContentsCreated. 1195 // BrowserPluginGuest::WebContentsCreated.
1200 if (!name_.empty()) 1196 if (!name_.empty())
1201 params.name.clear(); 1197 params.name.clear();
1202 1198
1203 Initialize(embedder_web_contents, params); 1199 Initialize(params, embedder_web_contents);
1204 1200
1205 SendQueuedMessages(); 1201 SendQueuedMessages();
1206 1202
1207 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Attached")); 1203 RecordAction(UserMetricsAction("BrowserPlugin.Guest.Attached"));
1208 } 1204 }
1209 1205
1210 void BrowserPluginGuest::OnCompositorFrameACK( 1206 void BrowserPluginGuest::OnCompositorFrameACK(
1211 int instance_id, 1207 int instance_id,
1212 int route_id, 1208 int route_id,
1213 uint32 output_surface_id, 1209 uint32 output_surface_id,
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 1366
1371 GURL validated_url(url); 1367 GURL validated_url(url);
1372 RenderViewHost::FilterURL( 1368 RenderViewHost::FilterURL(
1373 GetWebContents()->GetRenderProcessHost(), 1369 GetWebContents()->GetRenderProcessHost(),
1374 false, 1370 false,
1375 &validated_url); 1371 &validated_url);
1376 // As guests do not swap processes on navigation, only navigations to 1372 // As guests do not swap processes on navigation, only navigations to
1377 // normal web URLs are supported. No protocol handlers are installed for 1373 // normal web URLs are supported. No protocol handlers are installed for
1378 // other schemes (e.g., WebUI or extensions), and no permissions or bindings 1374 // other schemes (e.g., WebUI or extensions), and no permissions or bindings
1379 // can be granted to the guest process. 1375 // can be granted to the guest process.
1380 LoadURLWithParams(GetWebContents(), validated_url, Referrer(), 1376 LoadURLWithParams(validated_url, Referrer(), PAGE_TRANSITION_AUTO_TOPLEVEL,
1381 PAGE_TRANSITION_AUTO_TOPLEVEL); 1377 GetWebContents());
1382 } 1378 }
1383 1379
1384 void BrowserPluginGuest::OnPluginDestroyed(int instance_id) { 1380 void BrowserPluginGuest::OnPluginDestroyed(int instance_id) {
1385 Destroy(); 1381 Destroy();
1386 } 1382 }
1387 1383
1388 void BrowserPluginGuest::OnResizeGuest( 1384 void BrowserPluginGuest::OnResizeGuest(
1389 int instance_id, 1385 int instance_id,
1390 const BrowserPluginHostMsg_ResizeGuest_Params& params) { 1386 const BrowserPluginHostMsg_ResizeGuest_Params& params) {
1391 if (!params.size_changed) 1387 if (!params.size_changed)
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 request_info.Set(browser_plugin::kRequestMethod, 1727 request_info.Set(browser_plugin::kRequestMethod,
1732 base::Value::CreateStringValue(request_method)); 1728 base::Value::CreateStringValue(request_method));
1733 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url)); 1729 request_info.Set(browser_plugin::kURL, base::Value::CreateStringValue(url));
1734 1730
1735 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD, 1731 RequestPermission(BROWSER_PLUGIN_PERMISSION_TYPE_DOWNLOAD,
1736 new DownloadRequest(callback), 1732 new DownloadRequest(callback),
1737 request_info); 1733 request_info);
1738 } 1734 }
1739 1735
1740 } // namespace content 1736 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698