| 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 ConvertToWindowShowState(create_data->state); | 564 ConvertToWindowShowState(create_data->state); |
| 565 } | 565 } |
| 566 | 566 |
| 567 Browser* new_window = new Browser(create_params); | 567 Browser* new_window = new Browser(create_params); |
| 568 | 568 |
| 569 for (const GURL& url : urls) { | 569 for (const GURL& url : urls) { |
| 570 chrome::NavigateParams navigate_params(new_window, url, | 570 chrome::NavigateParams navigate_params(new_window, url, |
| 571 ui::PAGE_TRANSITION_LINK); | 571 ui::PAGE_TRANSITION_LINK); |
| 572 navigate_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; | 572 navigate_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 573 | 573 |
| 574 // The next 2 statements put the new contents in the same BrowsingInstance | 574 // Put the new contents in the same BrowsingInstance as their opener. |
| 575 // as their opener. Note that |force_new_process_for_new_contents = false| | 575 bool set_self_as_opener = create_data->set_self_as_opener && // present? |
| 576 // means that new contents might still end up in a new renderer | 576 *create_data->set_self_as_opener; // set to true? |
| 577 // (if they open a web URL and are transferred out of an extension | 577 navigate_params.opener = set_self_as_opener ? render_frame_host() : nullptr; |
| 578 // renderer), but even in this case the flags below ensure findability via | |
| 579 // window.open. | |
| 580 navigate_params.force_new_process_for_new_contents = false; | |
| 581 navigate_params.source_site_instance = | 578 navigate_params.source_site_instance = |
| 582 render_frame_host()->GetSiteInstance(); | 579 render_frame_host()->GetSiteInstance(); |
| 583 | 580 |
| 584 chrome::Navigate(&navigate_params); | 581 chrome::Navigate(&navigate_params); |
| 585 } | 582 } |
| 586 | 583 |
| 587 WebContents* contents = NULL; | 584 WebContents* contents = NULL; |
| 588 // Move the tab into the created window only if it's an empty popup or it's | 585 // Move the tab into the created window only if it's an empty popup or it's |
| 589 // a tabbed window. | 586 // a tabbed window. |
| 590 if ((window_type == Browser::TYPE_POPUP && urls.empty()) || | 587 if ((window_type == Browser::TYPE_POPUP && urls.empty()) || |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2099 params->tab_id | 2096 params->tab_id |
| 2100 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, | 2097 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, |
| 2101 base::IntToString(*params->tab_id)) | 2098 base::IntToString(*params->tab_id)) |
| 2102 : keys::kCannotFindTabToDiscard)); | 2099 : keys::kCannotFindTabToDiscard)); |
| 2103 } | 2100 } |
| 2104 | 2101 |
| 2105 TabsDiscardFunction::TabsDiscardFunction() {} | 2102 TabsDiscardFunction::TabsDiscardFunction() {} |
| 2106 TabsDiscardFunction::~TabsDiscardFunction() {} | 2103 TabsDiscardFunction::~TabsDiscardFunction() {} |
| 2107 | 2104 |
| 2108 } // namespace extensions | 2105 } // namespace extensions |
| OLD | NEW |