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

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

Issue 258373002: Towards moving guest management to chrome: Introduce GuestViewManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with ToT 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 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/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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 instance_id_(instance_id) { 92 instance_id_(instance_id) {
93 RecordAction( 93 RecordAction(
94 base::UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.NewWindow ")); 94 base::UserMetricsAction("BrowserPlugin.Guest.PermissionRequest.NewWindow "));
95 } 95 }
96 96
97 virtual void RespondImpl(bool should_allow, 97 virtual void RespondImpl(bool should_allow,
98 const std::string& user_input) OVERRIDE { 98 const std::string& user_input) OVERRIDE {
99 int embedder_render_process_id = 99 int embedder_render_process_id =
100 guest_->embedder_web_contents()->GetRenderProcessHost()->GetID(); 100 guest_->embedder_web_contents()->GetRenderProcessHost()->GetID();
101 BrowserPluginGuest* guest = 101 BrowserPluginGuest* guest =
102 guest_->GetWebContents()->GetBrowserPluginGuestManager()-> 102 BrowserPluginGuestManager::FromBrowserContext(
103 GetGuestByInstanceID(instance_id_, embedder_render_process_id); 103 guest_->GetWebContents()->GetBrowserContext())->
104 GetGuestByInstanceID(instance_id_, embedder_render_process_id);
104 if (!guest) { 105 if (!guest) {
105 VLOG(0) << "Guest not found. Instance ID: " << instance_id_; 106 VLOG(0) << "Guest not found. Instance ID: " << instance_id_;
106 return; 107 return;
107 } 108 }
108 109
109 // If we do not destroy the guest then we allow the new window. 110 // If we do not destroy the guest then we allow the new window.
110 if (!should_allow) 111 if (!should_allow)
111 guest->Destroy(); 112 guest->Destroy();
112 } 113 }
113 114
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 183
183 private: 184 private:
184 BrowserPluginGuest* browser_plugin_guest_; 185 BrowserPluginGuest* browser_plugin_guest_;
185 186
186 DISALLOW_COPY_AND_ASSIGN(EmbedderWebContentsObserver); 187 DISALLOW_COPY_AND_ASSIGN(EmbedderWebContentsObserver);
187 }; 188 };
188 189
189 BrowserPluginGuest::BrowserPluginGuest( 190 BrowserPluginGuest::BrowserPluginGuest(
190 int instance_id, 191 int instance_id,
191 bool has_render_view, 192 bool has_render_view,
192 WebContentsImpl* web_contents, 193 WebContentsImpl* web_contents)
193 BrowserPluginGuest* opener)
194 : WebContentsObserver(web_contents), 194 : WebContentsObserver(web_contents),
195 embedder_web_contents_(NULL), 195 embedder_web_contents_(NULL),
196 instance_id_(instance_id), 196 instance_id_(instance_id),
197 guest_device_scale_factor_(1.0f), 197 guest_device_scale_factor_(1.0f),
198 guest_hang_timeout_( 198 guest_hang_timeout_(
199 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)), 199 base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
200 focused_(false), 200 focused_(false),
201 mouse_locked_(false), 201 mouse_locked_(false),
202 pending_lock_request_(false), 202 pending_lock_request_(false),
203 embedder_visible_(true), 203 embedder_visible_(true),
204 auto_size_enabled_(false), 204 auto_size_enabled_(false),
205 copy_request_id_(0), 205 copy_request_id_(0),
206 next_permission_request_id_(browser_plugin::kInvalidPermissionRequestID), 206 next_permission_request_id_(browser_plugin::kInvalidPermissionRequestID),
207 has_render_view_(has_render_view), 207 has_render_view_(has_render_view),
208 last_seen_auto_size_enabled_(false), 208 last_seen_auto_size_enabled_(false),
209 is_in_destruction_(false), 209 is_in_destruction_(false),
210 last_text_input_type_(ui::TEXT_INPUT_TYPE_NONE), 210 last_text_input_type_(ui::TEXT_INPUT_TYPE_NONE),
211 last_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), 211 last_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
212 last_can_compose_inline_(true), 212 last_can_compose_inline_(true),
213 weak_ptr_factory_(this) { 213 weak_ptr_factory_(this) {
214 DCHECK(web_contents); 214 DCHECK(web_contents);
215 web_contents->SetDelegate(this); 215 web_contents->SetDelegate(this);
216 if (opener) 216 BrowserPluginGuestManager::FromBrowserContext(
217 opener_ = opener->AsWeakPtr(); 217 GetWebContents()->GetBrowserContext())->AddGuest(instance_id_,
218 GetWebContents()->GetBrowserPluginGuestManager()->AddGuest(instance_id_, 218 GetWebContents());
219 GetWebContents());
220 } 219 }
221 220
222 bool BrowserPluginGuest::AddMessageToConsole(WebContents* source, 221 bool BrowserPluginGuest::AddMessageToConsole(WebContents* source,
223 int32 level, 222 int32 level,
224 const base::string16& message, 223 const base::string16& message,
225 int32 line_no, 224 int32 line_no,
226 const base::string16& source_id) { 225 const base::string16& source_id) {
227 if (!delegate_) 226 if (!delegate_)
228 return false; 227 return false;
229 228
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 base::Bind(&BrowserPluginGuest::RespondToPermissionRequest, 295 base::Bind(&BrowserPluginGuest::RespondToPermissionRequest,
297 AsWeakPtr(), 296 AsWeakPtr(),
298 request_id); 297 request_id);
299 delegate_->RequestPermission( 298 delegate_->RequestPermission(
300 permission_type, request_info, callback, request->AllowedByDefault()); 299 permission_type, request_info, callback, request->AllowedByDefault());
301 } 300 }
302 301
303 BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow( 302 BrowserPluginGuest* BrowserPluginGuest::CreateNewGuestWindow(
304 const OpenURLParams& params) { 303 const OpenURLParams& params) {
305 BrowserPluginGuestManager* guest_manager = 304 BrowserPluginGuestManager* guest_manager =
306 GetWebContents()->GetBrowserPluginGuestManager(); 305 BrowserPluginGuestManager::FromBrowserContext(
306 GetWebContents()->GetBrowserContext());
307 307
308 // Allocate a new instance ID for the new guest. 308 // Allocate a new instance ID for the new guest.
309 int instance_id = guest_manager->get_next_instance_id(); 309 int instance_id = guest_manager->GetNextInstanceID();
310 310
311 // Set the attach params to use the same partition as the opener. 311 // Set the attach params to use the same partition as the opener.
312 // We pull the partition information from the site's URL, which is of the form 312 // We pull the partition information from the site's URL, which is of the form
313 // guest://site/{persist}?{partition_name}. 313 // guest://site/{persist}?{partition_name}.
314 const GURL& site_url = GetWebContents()->GetSiteInstance()->GetSiteURL(); 314 const GURL& site_url = GetWebContents()->GetSiteInstance()->GetSiteURL();
315 BrowserPluginHostMsg_Attach_Params attach_params; 315 BrowserPluginHostMsg_Attach_Params attach_params;
316 attach_params.storage_partition_id = site_url.query(); 316 attach_params.storage_partition_id = site_url.query();
317 attach_params.persist_storage = 317 attach_params.persist_storage =
318 site_url.path().find("persist") != std::string::npos; 318 site_url.path().find("persist") != std::string::npos;
319 319
320 // The new guest gets a copy of this guest's extra params so that the content 320 // The new guest gets a copy of this guest's extra params so that the content
321 // embedder exposes the same API for this guest as its opener. 321 // embedder exposes the same API for this guest as its opener.
322 scoped_ptr<base::DictionaryValue> extra_params( 322 scoped_ptr<base::DictionaryValue> extra_params(
323 extra_attach_params_->DeepCopy()); 323 extra_attach_params_->DeepCopy());
324 BrowserPluginGuest* new_guest = 324 BrowserPluginGuest* new_guest =
325 GetWebContents()->GetBrowserPluginGuestManager()->CreateGuest( 325 guest_manager->CreateGuest(GetWebContents()->GetSiteInstance(),
326 GetWebContents()->GetSiteInstance(), instance_id, 326 instance_id,
327 attach_params, extra_params.Pass()); 327 attach_params,
328 new_guest->opener_ = AsWeakPtr(); 328 extra_params.Pass());
329 if (new_guest->delegate_)
330 new_guest->delegate_->SetOpener(GetWebContents());
329 331
330 // Take ownership of |new_guest|. 332 // Take ownership of |new_guest|.
331 pending_new_windows_.insert( 333 pending_new_windows_.insert(
332 std::make_pair(new_guest, NewWindowInfo(params.url, std::string()))); 334 std::make_pair(new_guest, NewWindowInfo(params.url, std::string())));
333 335
334 // Request permission to show the new window. 336 // Request permission to show the new window.
335 RequestNewWindowPermission(params.disposition, gfx::Rect(), 337 RequestNewWindowPermission(params.disposition, gfx::Rect(),
336 params.user_gesture, new_guest->GetWebContents()); 338 params.user_gesture, new_guest->GetWebContents());
337 339
338 return new_guest; 340 return new_guest;
339 } 341 }
340 342
341 base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() { 343 base::WeakPtr<BrowserPluginGuest> BrowserPluginGuest::AsWeakPtr() {
342 return weak_ptr_factory_.GetWeakPtr(); 344 return weak_ptr_factory_.GetWeakPtr();
343 } 345 }
344 346
345 void BrowserPluginGuest::EmbedderDestroyed() { 347 void BrowserPluginGuest::EmbedderDestroyed() {
346 embedder_web_contents_ = NULL; 348 embedder_web_contents_ = NULL;
347 if (delegate_) 349 if (delegate_)
348 delegate_->EmbedderDestroyed(); 350 delegate_->EmbedderDestroyed();
349 Destroy(); 351 Destroy();
350 } 352 }
351 353
352 void BrowserPluginGuest::Destroy() { 354 void BrowserPluginGuest::Destroy() {
353 is_in_destruction_ = true; 355 is_in_destruction_ = true;
354 if (!attached() && opener()) 356 if (!attached() && GetOpener())
355 opener()->pending_new_windows_.erase(this); 357 GetOpener()->pending_new_windows_.erase(this);
356 DestroyUnattachedWindows(); 358 DestroyUnattachedWindows();
357 GetWebContents()->GetBrowserPluginGuestManager()->RemoveGuest(instance_id_); 359 BrowserPluginGuestManager::FromBrowserContext(
lazyboy 2014/05/01 20:06:59 Same for this file, add BrowserPluginGuest::GetBro
Fady Samuel 2014/05/01 21:05:28 Done.
360 GetWebContents()->GetBrowserContext())->RemoveGuest(instance_id_);
358 delete GetWebContents(); 361 delete GetWebContents();
359 } 362 }
360 363
361 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder( 364 bool BrowserPluginGuest::OnMessageReceivedFromEmbedder(
362 const IPC::Message& message) { 365 const IPC::Message& message) {
363 bool handled = true; 366 bool handled = true;
364 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message) 367 IPC_BEGIN_MESSAGE_MAP(BrowserPluginGuest, message)
365 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CompositorFrameSwappedACK, 368 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CompositorFrameSwappedACK,
366 OnCompositorFrameSwappedACK) 369 OnCompositorFrameSwappedACK)
367 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CopyFromCompositingSurfaceAck, 370 IPC_MESSAGE_HANDLER(BrowserPluginHostMsg_CopyFromCompositingSurfaceAck,
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 BrowserPluginGuest* BrowserPluginGuest::Create( 505 BrowserPluginGuest* BrowserPluginGuest::Create(
503 int instance_id, 506 int instance_id,
504 SiteInstance* guest_site_instance, 507 SiteInstance* guest_site_instance,
505 WebContentsImpl* web_contents, 508 WebContentsImpl* web_contents,
506 scoped_ptr<base::DictionaryValue> extra_params) { 509 scoped_ptr<base::DictionaryValue> extra_params) {
507 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create")); 510 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Create"));
508 BrowserPluginGuest* guest = NULL; 511 BrowserPluginGuest* guest = NULL;
509 if (factory_) { 512 if (factory_) {
510 guest = factory_->CreateBrowserPluginGuest(instance_id, web_contents); 513 guest = factory_->CreateBrowserPluginGuest(instance_id, web_contents);
511 } else { 514 } else {
512 guest = new BrowserPluginGuest(instance_id, false, web_contents, NULL); 515 guest = new BrowserPluginGuest(instance_id, false, web_contents);
513 } 516 }
514 guest->extra_attach_params_.reset(extra_params->DeepCopy()); 517 guest->extra_attach_params_.reset(extra_params->DeepCopy());
515 web_contents->SetBrowserPluginGuest(guest); 518 web_contents->SetBrowserPluginGuest(guest);
516 BrowserPluginGuestDelegate* delegate = NULL; 519 BrowserPluginGuestDelegate* delegate = NULL;
517 GetContentClient()->browser()->GuestWebContentsCreated( 520 GetContentClient()->browser()->GuestWebContentsCreated(
518 guest_site_instance, web_contents, NULL, &delegate, extra_params.Pass()); 521 guest_site_instance, web_contents, NULL, &delegate, extra_params.Pass());
519 guest->SetDelegate(delegate); 522 guest->SetDelegate(delegate);
520 return guest; 523 return guest;
521 } 524 }
522 525
523 // static 526 // static
524 BrowserPluginGuest* BrowserPluginGuest::CreateWithOpener( 527 BrowserPluginGuest* BrowserPluginGuest::CreateWithOpener(
525 int instance_id, 528 int instance_id,
526 bool has_render_view, 529 bool has_render_view,
527 WebContentsImpl* web_contents, 530 WebContentsImpl* web_contents,
528 BrowserPluginGuest* opener) { 531 BrowserPluginGuest* opener) {
529 BrowserPluginGuest* guest = 532 BrowserPluginGuest* guest =
530 new BrowserPluginGuest( 533 new BrowserPluginGuest(
531 instance_id, has_render_view, web_contents, opener); 534 instance_id, has_render_view, web_contents);
532 web_contents->SetBrowserPluginGuest(guest); 535 web_contents->SetBrowserPluginGuest(guest);
533 BrowserPluginGuestDelegate* delegate = NULL; 536 BrowserPluginGuestDelegate* delegate = NULL;
534 GetContentClient()->browser()->GuestWebContentsCreated( 537 GetContentClient()->browser()->GuestWebContentsCreated(
535 opener->GetWebContents()->GetSiteInstance(), 538 opener->GetWebContents()->GetSiteInstance(),
536 web_contents, opener->GetWebContents(), &delegate, 539 web_contents, opener->GetWebContents(), &delegate,
537 scoped_ptr<base::DictionaryValue>()); 540 scoped_ptr<base::DictionaryValue>());
538 guest->SetDelegate(delegate); 541 guest->SetDelegate(delegate);
539 return guest; 542 return guest;
540 } 543 }
541 544
542 RenderWidgetHostView* BrowserPluginGuest::GetEmbedderRenderWidgetHostView() { 545 RenderWidgetHostView* BrowserPluginGuest::GetEmbedderRenderWidgetHostView() {
543 if (!attached()) 546 if (!attached())
544 return NULL; 547 return NULL;
545 return embedder_web_contents_->GetRenderWidgetHostView(); 548 return embedder_web_contents_->GetRenderWidgetHostView();
546 } 549 }
547 550
551 BrowserPluginGuest* BrowserPluginGuest::GetOpener() {
552 if (!delegate_)
553 return NULL;
554
555 WebContents* opener = delegate_->GetOpener();
556 if (!opener)
557 return NULL;
558
559 return static_cast<WebContentsImpl*>(opener)->GetBrowserPluginGuest();
560 }
561
548 void BrowserPluginGuest::UpdateVisibility() { 562 void BrowserPluginGuest::UpdateVisibility() {
549 OnSetVisibility(instance_id_, visible()); 563 OnSetVisibility(instance_id_, visible());
550 } 564 }
551 565
552 void BrowserPluginGuest::CopyFromCompositingSurface( 566 void BrowserPluginGuest::CopyFromCompositingSurface(
553 gfx::Rect src_subrect, 567 gfx::Rect src_subrect,
554 gfx::Size dst_size, 568 gfx::Size dst_size,
555 const base::Callback<void(bool, const SkBitmap&)>& callback) { 569 const base::Callback<void(bool, const SkBitmap&)>& callback) {
556 copy_request_callbacks_.insert(std::make_pair(++copy_request_id_, callback)); 570 copy_request_callbacks_.insert(std::make_pair(++copy_request_id_, callback));
557 SendMessageToEmbedder( 571 SendMessageToEmbedder(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 } 704 }
691 705
692 WebContents* BrowserPluginGuest::OpenURLFromTab(WebContents* source, 706 WebContents* BrowserPluginGuest::OpenURLFromTab(WebContents* source,
693 const OpenURLParams& params) { 707 const OpenURLParams& params) {
694 // If the guest wishes to navigate away prior to attachment then we save the 708 // If the guest wishes to navigate away prior to attachment then we save the
695 // navigation to perform upon attachment. Navigation initializes a lot of 709 // navigation to perform upon attachment. Navigation initializes a lot of
696 // state that assumes an embedder exists, such as RenderWidgetHostViewGuest. 710 // state that assumes an embedder exists, such as RenderWidgetHostViewGuest.
697 // Navigation also resumes resource loading which we don't want to allow 711 // Navigation also resumes resource loading which we don't want to allow
698 // until attachment. 712 // until attachment.
699 if (!attached()) { 713 if (!attached()) {
700 PendingWindowMap::iterator it = opener()->pending_new_windows_.find(this); 714 PendingWindowMap::iterator it =
701 if (it == opener()->pending_new_windows_.end()) 715 GetOpener()->pending_new_windows_.find(this);
716 if (it == GetOpener()->pending_new_windows_.end())
702 return NULL; 717 return NULL;
703 const NewWindowInfo& old_target_url = it->second; 718 const NewWindowInfo& old_target_url = it->second;
704 NewWindowInfo new_window_info(params.url, old_target_url.name); 719 NewWindowInfo new_window_info(params.url, old_target_url.name);
705 new_window_info.changed = new_window_info.url != old_target_url.url; 720 new_window_info.changed = new_window_info.url != old_target_url.url;
706 it->second = new_window_info; 721 it->second = new_window_info;
707 return NULL; 722 return NULL;
708 } 723 }
709 if (params.disposition == CURRENT_TAB) { 724 if (params.disposition == CURRENT_TAB) {
710 // This can happen for cross-site redirects. 725 // This can happen for cross-site redirects.
711 LoadURLWithParams(params.url, params.referrer, params.transition, source); 726 LoadURLWithParams(params.url, params.referrer, params.transition, source);
712 return source; 727 return source;
713 } 728 }
714 729
715 return CreateNewGuestWindow(params)->GetWebContents(); 730 return CreateNewGuestWindow(params)->GetWebContents();
716 } 731 }
717 732
718 void BrowserPluginGuest::WebContentsCreated(WebContents* source_contents, 733 void BrowserPluginGuest::WebContentsCreated(WebContents* source_contents,
719 int opener_render_frame_id, 734 int opener_render_frame_id,
720 const base::string16& frame_name, 735 const base::string16& frame_name,
721 const GURL& target_url, 736 const GURL& target_url,
722 WebContents* new_contents) { 737 WebContents* new_contents) {
723 WebContentsImpl* new_contents_impl = 738 WebContentsImpl* new_contents_impl =
724 static_cast<WebContentsImpl*>(new_contents); 739 static_cast<WebContentsImpl*>(new_contents);
725 BrowserPluginGuest* guest = new_contents_impl->GetBrowserPluginGuest(); 740 BrowserPluginGuest* guest = new_contents_impl->GetBrowserPluginGuest();
726 guest->opener_ = AsWeakPtr(); 741 if (guest->delegate_)
742 guest->delegate_->SetOpener(GetWebContents());
727 std::string guest_name = base::UTF16ToUTF8(frame_name); 743 std::string guest_name = base::UTF16ToUTF8(frame_name);
728 guest->name_ = guest_name; 744 guest->name_ = guest_name;
729 // Take ownership of the new guest until it is attached to the embedder's DOM 745 // Take ownership of the new guest until it is attached to the embedder's DOM
730 // tree to avoid leaking a guest if this guest is destroyed before attaching 746 // tree to avoid leaking a guest if this guest is destroyed before attaching
731 // the new guest. 747 // the new guest.
732 pending_new_windows_.insert( 748 pending_new_windows_.insert(
733 std::make_pair(guest, NewWindowInfo(target_url, guest_name))); 749 std::make_pair(guest, NewWindowInfo(target_url, guest_name)));
734 } 750 }
735 751
736 void BrowserPluginGuest::RendererUnresponsive(WebContents* source) { 752 void BrowserPluginGuest::RendererUnresponsive(WebContents* source) {
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 GetWebContents()->GetRenderViewHost())->Init(); 1029 GetWebContents()->GetRenderViewHost())->Init();
1014 WebContentsViewGuest* new_view = 1030 WebContentsViewGuest* new_view =
1015 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); 1031 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
1016 new_view->CreateViewForWidget(web_contents()->GetRenderViewHost()); 1032 new_view->CreateViewForWidget(web_contents()->GetRenderViewHost());
1017 } 1033 }
1018 1034
1019 // We need to do a navigation here if the target URL has changed between 1035 // We need to do a navigation here if the target URL has changed between
1020 // the time the WebContents was created and the time it was attached. 1036 // the time the WebContents was created and the time it was attached.
1021 // We also need to do an initial navigation if a RenderView was never 1037 // We also need to do an initial navigation if a RenderView was never
1022 // created for the new window in cases where there is no referrer. 1038 // created for the new window in cases where there is no referrer.
1023 PendingWindowMap::iterator it = opener()->pending_new_windows_.find(this); 1039 PendingWindowMap::iterator it = GetOpener()->pending_new_windows_.find(this);
1024 if (it != opener()->pending_new_windows_.end()) { 1040 if (it != GetOpener()->pending_new_windows_.end()) {
1025 const NewWindowInfo& new_window_info = it->second; 1041 const NewWindowInfo& new_window_info = it->second;
1026 if (new_window_info.changed || !has_render_view_) 1042 if (new_window_info.changed || !has_render_view_)
1027 params.src = it->second.url.spec(); 1043 params.src = it->second.url.spec();
1028 } else { 1044 } else {
1029 NOTREACHED(); 1045 NOTREACHED();
1030 } 1046 }
1031 1047
1032 // Once a new guest is attached to the DOM of the embedder page, then the 1048 // Once a new guest is attached to the DOM of the embedder page, then the
1033 // lifetime of the new guest is no longer managed by the opener guest. 1049 // lifetime of the new guest is no longer managed by the opener guest.
1034 opener()->pending_new_windows_.erase(this); 1050 GetOpener()->pending_new_windows_.erase(this);
1035 1051
1036 // The guest's frame name takes precedence over the BrowserPlugin's name. 1052 // The guest's frame name takes precedence over the BrowserPlugin's name.
1037 // The guest's frame name is assigned in 1053 // The guest's frame name is assigned in
1038 // BrowserPluginGuest::WebContentsCreated. 1054 // BrowserPluginGuest::WebContentsCreated.
1039 if (!name_.empty()) 1055 if (!name_.empty())
1040 params.name.clear(); 1056 params.name.clear();
1041 1057
1042 Initialize(params, embedder_web_contents); 1058 Initialize(params, embedder_web_contents);
1043 1059
1044 SendQueuedMessages(); 1060 SendQueuedMessages();
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 const GURL& url) { 1541 const GURL& url) {
1526 if (!url.is_valid()) { 1542 if (!url.is_valid()) {
1527 callback.Run(false); 1543 callback.Run(false);
1528 return; 1544 return;
1529 } 1545 }
1530 1546
1531 delegate_->CanDownload(request_method, url, callback); 1547 delegate_->CanDownload(request_method, url, callback);
1532 } 1548 }
1533 1549
1534 } // namespace content 1550 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698