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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
563 create_params.initial_show_state = | 563 create_params.initial_show_state = |
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 navigate_params.opener = render_frame_host(); |
Charlie Reis
2017/06/05 21:06:28
Worth keeping a comment saying that the intention
Łukasz Anforowicz
2017/06/05 22:06:54
Done.
| |
574 // The next 2 statements put the new contents in the same BrowsingInstance | |
575 // as their opener. Note that |force_new_process_for_new_contents = false| | |
576 // means that new contents might still end up in a new renderer | |
577 // (if they open a web URL and are transferred out of an extension | |
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 = | 574 navigate_params.source_site_instance = |
582 render_frame_host()->GetSiteInstance(); | 575 render_frame_host()->GetSiteInstance(); |
583 | 576 |
584 chrome::Navigate(&navigate_params); | 577 chrome::Navigate(&navigate_params); |
585 } | 578 } |
586 | 579 |
587 WebContents* contents = NULL; | 580 WebContents* contents = NULL; |
588 // Move the tab into the created window only if it's an empty popup or it's | 581 // Move the tab into the created window only if it's an empty popup or it's |
589 // a tabbed window. | 582 // a tabbed window. |
590 if ((window_type == Browser::TYPE_POPUP && urls.empty()) || | 583 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 | 2092 params->tab_id |
2100 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, | 2093 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, |
2101 base::IntToString(*params->tab_id)) | 2094 base::IntToString(*params->tab_id)) |
2102 : keys::kCannotFindTabToDiscard)); | 2095 : keys::kCannotFindTabToDiscard)); |
2103 } | 2096 } |
2104 | 2097 |
2105 TabsDiscardFunction::TabsDiscardFunction() {} | 2098 TabsDiscardFunction::TabsDiscardFunction() {} |
2106 TabsDiscardFunction::~TabsDiscardFunction() {} | 2099 TabsDiscardFunction::~TabsDiscardFunction() {} |
2107 | 2100 |
2108 } // namespace extensions | 2101 } // namespace extensions |
OLD | NEW |