Chromium Code Reviews| 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 "chrome/browser/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/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/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 | 588 |
| 589 void ExtensionHost::RunFileChooser(WebContents* tab, | 589 void ExtensionHost::RunFileChooser(WebContents* tab, |
| 590 const content::FileChooserParams& params) { | 590 const content::FileChooserParams& params) { |
| 591 FileSelectHelper::RunFileChooser(tab, params); | 591 FileSelectHelper::RunFileChooser(tab, params); |
| 592 } | 592 } |
| 593 | 593 |
| 594 void ExtensionHost::AddNewContents(WebContents* source, | 594 void ExtensionHost::AddNewContents(WebContents* source, |
| 595 WebContents* new_contents, | 595 WebContents* new_contents, |
| 596 WindowOpenDisposition disposition, | 596 WindowOpenDisposition disposition, |
| 597 const gfx::Rect& initial_pos, | 597 const gfx::Rect& initial_pos, |
| 598 bool user_gesture) { | 598 bool user_gesture, |
| 599 bool* was_blocked) { | |
| 599 // First, if the creating extension view was associated with a tab contents, | 600 // First, if the creating extension view was associated with a tab contents, |
| 600 // use that tab content's delegate. We must be careful here that the | 601 // use that tab content's delegate. We must be careful here that the |
| 601 // associated tab contents has the same profile as the new tab contents. In | 602 // associated tab contents has the same profile as the new tab contents. In |
| 602 // the case of extensions in 'spanning' incognito mode, they can mismatch. | 603 // the case of extensions in 'spanning' incognito mode, they can mismatch. |
| 603 // We don't want to end up putting a normal tab into an incognito window, or | 604 // We don't want to end up putting a normal tab into an incognito window, or |
| 604 // vice versa. | 605 // vice versa. |
| 605 // Note that we don't do this for popup windows, because we need to associate | 606 // Note that we don't do this for popup windows, because we need to associate |
| 606 // those with their extension_app_id. | 607 // those with their extension_app_id. |
| 607 if (disposition != NEW_POPUP) { | 608 if (disposition != NEW_POPUP) { |
| 608 WebContents* associated_contents = GetAssociatedWebContents(); | 609 WebContents* associated_contents = GetAssociatedWebContents(); |
| 609 if (associated_contents && | 610 if (associated_contents && |
| 610 associated_contents->GetBrowserContext() == | 611 associated_contents->GetBrowserContext() == |
| 611 new_contents->GetBrowserContext()) { | 612 new_contents->GetBrowserContext()) { |
| 612 associated_contents->AddNewContents( | 613 WebContentsDelegate* delegate = associated_contents->GetDelegate(); |
| 613 new_contents, disposition, initial_pos, user_gesture); | 614 if (delegate) { |
| 614 return; | 615 delegate->AddNewContents( |
|
jochen (gone - plz use gerrit)
2012/11/20 10:50:44
why did you delete this?
| |
| 616 associated_contents, new_contents, disposition, initial_pos, | |
| 617 user_gesture, was_blocked); | |
| 618 } | |
| 615 } | 619 } |
| 616 } | 620 } |
| 617 | 621 |
| 618 ExtensionTabUtil::CreateTab(new_contents, extension_id_, disposition, | 622 ExtensionTabUtil::CreateTab(new_contents, extension_id_, disposition, |
| 619 initial_pos, user_gesture); | 623 initial_pos, user_gesture); |
| 620 } | 624 } |
| 621 | 625 |
| 622 void ExtensionHost::RenderViewReady() { | 626 void ExtensionHost::RenderViewReady() { |
| 623 content::NotificationService::current()->Notify( | 627 content::NotificationService::current()->Notify( |
| 624 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, | 628 chrome::NOTIFICATION_EXTENSION_HOST_CREATED, |
| 625 content::Source<Profile>(profile_), | 629 content::Source<Profile>(profile_), |
| 626 content::Details<ExtensionHost>(this)); | 630 content::Details<ExtensionHost>(this)); |
| 627 } | 631 } |
| 628 | 632 |
| 629 } // namespace extensions | 633 } // namespace extensions |
| OLD | NEW |