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

Unified Diff: chrome/browser/extensions/extension_tab_util.cc

Issue 1805013005: [Extensions] Allow overriding a nested options page for opening a new instance (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing files Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tab_util_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tab_util.cc
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc
index a268df55687fd7f34d21bd8ebffca2ffe8c8008d..91ca5041898ff9ed0ef7eaf0c573913fde72cb86 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -635,7 +635,8 @@ bool ExtensionTabUtil::OpenOptionsPage(const Extension* extension,
}
GURL url_to_navigate;
- if (OptionsPageInfo::ShouldOpenInTab(extension)) {
+ bool open_in_tab = OptionsPageInfo::ShouldOpenInTab(extension);
+ if (open_in_tab) {
// Options page tab is simply e.g. chrome-extension://.../options.html.
url_to_navigate = OptionsPageInfo::GetOptionsPage(extension);
} else {
@@ -653,8 +654,12 @@ bool ExtensionTabUtil::OpenOptionsPage(const Extension* extension,
chrome::GetSingletonTabNavigateParams(browser, url_to_navigate));
// We need to respect path differences because we don't want opening the
// options page to close a page that might be open to extension content.
+ // However, if the options page opens inside the chrome://extensions page, we
+ // can override an existing page.
// Note: default ref behavior is IGNORE_REF, which is correct.
- params.path_behavior = chrome::NavigateParams::RESPECT;
+ params.path_behavior = open_in_tab
+ ? chrome::NavigateParams::RESPECT
+ : chrome::NavigateParams::IGNORE_AND_NAVIGATE;
params.url = url_to_navigate;
chrome::ShowSingletonTabOverwritingNTP(browser, params);
return true;
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tab_util_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698