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

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

Issue 2686943002: New WebContents created via ctrl-click should be in a new process. (Closed)
Patch Set: s/renderer/process/ in the field name + initializing the field and variables. Created 3 years, 8 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
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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // The next 2 statements put the new contents in the same BrowsingInstance
626 // as their opener. Note that |force_new_process_for_new_contents = false|
627 // means that new contents might still end up in a new renderer
628 // (if they open a web URL and are transferred out of an extension
629 // renderer), but even in this case the flags below ensure findability via
630 // window.open.
631 navigate_params.force_new_process_for_new_contents = false;
624 navigate_params.source_site_instance = 632 navigate_params.source_site_instance =
625 render_frame_host()->GetSiteInstance(); 633 render_frame_host()->GetSiteInstance();
634
626 chrome::Navigate(&navigate_params); 635 chrome::Navigate(&navigate_params);
627 } 636 }
628 637
629 WebContents* contents = NULL; 638 WebContents* contents = NULL;
630 // Move the tab into the created window only if it's an empty popup or it's 639 // Move the tab into the created window only if it's an empty popup or it's
631 // a tabbed window. 640 // a tabbed window.
632 if ((window_type == Browser::TYPE_POPUP && urls.empty()) || 641 if ((window_type == Browser::TYPE_POPUP && urls.empty()) ||
633 window_type == Browser::TYPE_TABBED) { 642 window_type == Browser::TYPE_TABBED) {
634 if (source_tab_strip) 643 if (source_tab_strip)
635 contents = source_tab_strip->DetachWebContentsAt(tab_index); 644 contents = source_tab_strip->DetachWebContentsAt(tab_index);
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 params->tab_id 2145 params->tab_id
2137 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab, 2146 ? ErrorUtils::FormatErrorMessage(keys::kCannotDiscardTab,
2138 base::IntToString(*params->tab_id)) 2147 base::IntToString(*params->tab_id))
2139 : keys::kCannotFindTabToDiscard)); 2148 : keys::kCannotFindTabToDiscard));
2140 } 2149 }
2141 2150
2142 TabsDiscardFunction::TabsDiscardFunction() {} 2151 TabsDiscardFunction::TabsDiscardFunction() {}
2143 TabsDiscardFunction::~TabsDiscardFunction() {} 2152 TabsDiscardFunction::~TabsDiscardFunction() {}
2144 2153
2145 } // namespace extensions 2154 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chrome_navigation_browsertest.cc ('k') | chrome/browser/extensions/api/tabs/tabs_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698