| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 622 |
| 623 // First, if the creating extension view was associated with a tab contents, | 623 // First, if the creating extension view was associated with a tab contents, |
| 624 // use that tab content's delegate. We must be careful here that the | 624 // use that tab content's delegate. We must be careful here that the |
| 625 // associated tab contents has the same profile as the new tab contents. In | 625 // associated tab contents has the same profile as the new tab contents. In |
| 626 // the case of extensions in 'spanning' incognito mode, they can mismatch. | 626 // the case of extensions in 'spanning' incognito mode, they can mismatch. |
| 627 // We don't want to end up putting a normal tab into an incognito window, or | 627 // We don't want to end up putting a normal tab into an incognito window, or |
| 628 // vice versa. | 628 // vice versa. |
| 629 TabContents* associated_contents = associated_tab_contents(); | 629 TabContents* associated_contents = associated_tab_contents(); |
| 630 if (associated_contents && | 630 if (associated_contents && |
| 631 associated_contents->profile() == contents->profile()) { | 631 associated_contents->profile() == contents->profile()) { |
| 632 associated_contents->AddOrBlockNewContents( | 632 associated_contents->AddNewContents( |
| 633 contents, disposition, initial_pos, user_gesture); | 633 contents, disposition, initial_pos, user_gesture); |
| 634 return; | 634 return; |
| 635 } | 635 } |
| 636 | 636 |
| 637 // If there's no associated tab contents, or it doesn't have a matching | 637 // If there's no associated tab contents, or it doesn't have a matching |
| 638 // profile, try finding an open window. Again, we must make sure to find a | 638 // profile, try finding an open window. Again, we must make sure to find a |
| 639 // window with the correct profile. | 639 // window with the correct profile. |
| 640 Browser* browser = BrowserList::FindBrowserWithType( | 640 Browser* browser = BrowserList::FindBrowserWithType( |
| 641 contents->profile(), | 641 contents->profile(), |
| 642 Browser::TYPE_NORMAL, | 642 Browser::TYPE_NORMAL, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 return window_id; | 833 return window_id; |
| 834 } | 834 } |
| 835 | 835 |
| 836 void ExtensionHost::OnRunFileChooser( | 836 void ExtensionHost::OnRunFileChooser( |
| 837 const ViewHostMsg_RunFileChooser_Params& params) { | 837 const ViewHostMsg_RunFileChooser_Params& params) { |
| 838 if (file_select_helper_.get() == NULL) | 838 if (file_select_helper_.get() == NULL) |
| 839 file_select_helper_.reset(new FileSelectHelper(profile())); | 839 file_select_helper_.reset(new FileSelectHelper(profile())); |
| 840 file_select_helper_->RunFileChooser(render_view_host_, | 840 file_select_helper_->RunFileChooser(render_view_host_, |
| 841 associated_tab_contents(), params); | 841 associated_tab_contents(), params); |
| 842 } | 842 } |
| OLD | NEW |