Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.cc

Issue 2921753002: NOT YET READY: Making chrome.windows.create establish an actual "opener" relationship.
Patch Set: Adding setSelfAsOpener parameter. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/tabs/tabs_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698