OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/extension_host.h" | 5 #include "extensions/browser/extension_host.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 } | 427 } |
428 | 428 |
429 content::JavaScriptDialogManager* ExtensionHost::GetJavaScriptDialogManager( | 429 content::JavaScriptDialogManager* ExtensionHost::GetJavaScriptDialogManager( |
430 WebContents* source) { | 430 WebContents* source) { |
431 return delegate_->GetJavaScriptDialogManager(); | 431 return delegate_->GetJavaScriptDialogManager(); |
432 } | 432 } |
433 | 433 |
434 void ExtensionHost::AddNewContents(WebContents* source, | 434 void ExtensionHost::AddNewContents(WebContents* source, |
435 WebContents* new_contents, | 435 WebContents* new_contents, |
436 WindowOpenDisposition disposition, | 436 WindowOpenDisposition disposition, |
437 const gfx::Rect& initial_pos, | 437 const gfx::Rect& initial_rect, |
438 bool user_gesture, | 438 bool user_gesture, |
439 bool* was_blocked) { | 439 bool* was_blocked) { |
440 // First, if the creating extension view was associated with a tab contents, | 440 // First, if the creating extension view was associated with a tab contents, |
441 // use that tab content's delegate. We must be careful here that the | 441 // use that tab content's delegate. We must be careful here that the |
442 // associated tab contents has the same profile as the new tab contents. In | 442 // associated tab contents has the same profile as the new tab contents. In |
443 // the case of extensions in 'spanning' incognito mode, they can mismatch. | 443 // the case of extensions in 'spanning' incognito mode, they can mismatch. |
444 // We don't want to end up putting a normal tab into an incognito window, or | 444 // We don't want to end up putting a normal tab into an incognito window, or |
445 // vice versa. | 445 // vice versa. |
446 // Note that we don't do this for popup windows, because we need to associate | 446 // Note that we don't do this for popup windows, because we need to associate |
447 // those with their extension_app_id. | 447 // those with their extension_app_id. |
448 if (disposition != NEW_POPUP) { | 448 if (disposition != NEW_POPUP) { |
449 WebContents* associated_contents = GetAssociatedWebContents(); | 449 WebContents* associated_contents = GetAssociatedWebContents(); |
450 if (associated_contents && | 450 if (associated_contents && |
451 associated_contents->GetBrowserContext() == | 451 associated_contents->GetBrowserContext() == |
452 new_contents->GetBrowserContext()) { | 452 new_contents->GetBrowserContext()) { |
453 WebContentsDelegate* delegate = associated_contents->GetDelegate(); | 453 WebContentsDelegate* delegate = associated_contents->GetDelegate(); |
454 if (delegate) { | 454 if (delegate) { |
455 delegate->AddNewContents( | 455 delegate->AddNewContents( |
456 associated_contents, new_contents, disposition, initial_pos, | 456 associated_contents, new_contents, disposition, initial_rect, |
457 user_gesture, was_blocked); | 457 user_gesture, was_blocked); |
458 return; | 458 return; |
459 } | 459 } |
460 } | 460 } |
461 } | 461 } |
462 | 462 |
463 delegate_->CreateTab( | 463 delegate_->CreateTab( |
464 new_contents, extension_id_, disposition, initial_pos, user_gesture); | 464 new_contents, extension_id_, disposition, initial_rect, user_gesture); |
465 } | 465 } |
466 | 466 |
467 void ExtensionHost::RenderViewReady() { | 467 void ExtensionHost::RenderViewReady() { |
468 content::NotificationService::current()->Notify( | 468 content::NotificationService::current()->Notify( |
469 extensions::NOTIFICATION_EXTENSION_HOST_CREATED, | 469 extensions::NOTIFICATION_EXTENSION_HOST_CREATED, |
470 content::Source<BrowserContext>(browser_context_), | 470 content::Source<BrowserContext>(browser_context_), |
471 content::Details<ExtensionHost>(this)); | 471 content::Details<ExtensionHost>(this)); |
472 } | 472 } |
473 | 473 |
474 void ExtensionHost::RequestMediaAccessPermission( | 474 void ExtensionHost::RequestMediaAccessPermission( |
(...skipping 11 matching lines...) Expand all Loading... |
486 return delegate_->CheckMediaAccessPermission( | 486 return delegate_->CheckMediaAccessPermission( |
487 web_contents, security_origin, type, extension()); | 487 web_contents, security_origin, type, extension()); |
488 } | 488 } |
489 | 489 |
490 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { | 490 bool ExtensionHost::IsNeverVisible(content::WebContents* web_contents) { |
491 ViewType view_type = extensions::GetViewType(web_contents); | 491 ViewType view_type = extensions::GetViewType(web_contents); |
492 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; | 492 return view_type == extensions::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE; |
493 } | 493 } |
494 | 494 |
495 } // namespace extensions | 495 } // namespace extensions |
OLD | NEW |