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/api/tabs/tabs_api.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <limits> | 9 #include <limits> |
10 #include <memory> | 10 #include <memory> |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 create_params.initial_show_state = | 614 create_params.initial_show_state = |
615 ConvertToWindowShowState(create_data->state); | 615 ConvertToWindowShowState(create_data->state); |
616 } | 616 } |
617 | 617 |
618 Browser* new_window = new Browser(create_params); | 618 Browser* new_window = new Browser(create_params); |
619 | 619 |
620 for (const GURL& url : urls) { | 620 for (const GURL& url : urls) { |
621 chrome::NavigateParams navigate_params(new_window, url, | 621 chrome::NavigateParams navigate_params(new_window, url, |
622 ui::PAGE_TRANSITION_LINK); | 622 ui::PAGE_TRANSITION_LINK); |
623 navigate_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; | 623 navigate_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 624 |
| 625 // Make sure that (if possible) the new contents are created in the same |
| 626 // renderer process as the caller of the chrome.windows.create API. |
| 627 navigate_params.use_new_renderer_for_new_contents = false; |
624 navigate_params.source_site_instance = | 628 navigate_params.source_site_instance = |
625 render_frame_host()->GetSiteInstance(); | 629 render_frame_host()->GetSiteInstance(); |
| 630 |
626 chrome::Navigate(&navigate_params); | 631 chrome::Navigate(&navigate_params); |
627 } | 632 } |
628 | 633 |
629 WebContents* contents = NULL; | 634 WebContents* contents = NULL; |
630 // Move the tab into the created window only if it's an empty popup or it's | 635 // Move the tab into the created window only if it's an empty popup or it's |
631 // a tabbed window. | 636 // a tabbed window. |
632 if ((window_type == Browser::TYPE_POPUP && urls.empty()) || | 637 if ((window_type == Browser::TYPE_POPUP && urls.empty()) || |
633 window_type == Browser::TYPE_TABBED) { | 638 window_type == Browser::TYPE_TABBED) { |
634 if (source_tab_strip) | 639 if (source_tab_strip) |
635 contents = source_tab_strip->DetachWebContentsAt(tab_index); | 640 contents = source_tab_strip->DetachWebContentsAt(tab_index); |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 params->tab_id | 2141 params->tab_id |
2137 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, | 2142 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, |
2138 base::IntToString(*params->tab_id)) | 2143 base::IntToString(*params->tab_id)) |
2139 : keys::kCannotFindTabToDiscard)); | 2144 : keys::kCannotFindTabToDiscard)); |
2140 } | 2145 } |
2141 | 2146 |
2142 TabsDiscardFunction::TabsDiscardFunction() {} | 2147 TabsDiscardFunction::TabsDiscardFunction() {} |
2143 TabsDiscardFunction::~TabsDiscardFunction() {} | 2148 TabsDiscardFunction::~TabsDiscardFunction() {} |
2144 | 2149 |
2145 } // namespace extensions | 2150 } // namespace extensions |
OLD | NEW |