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

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

Issue 1005673002: Make UI or API driven extension options navigations refocus any existing options page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 5 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/test/data/extensions/api_test/runtime/open_options_page/manifest.json » ('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 d5feb70183a271e5aec92d7e595b1deb81a163d8..706f41e009130deadd8baeca5763a635f234adb9 100644
--- a/chrome/browser/extensions/extension_tab_util.cc
+++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -590,35 +590,26 @@ bool ExtensionTabUtil::OpenOptionsPage(const Extension* extension,
browser = displayer->browser();
}
- if (!OptionsPageInfo::ShouldOpenInTab(extension)) {
- // If we should embed the options page for this extension, open
- // chrome://extensions in a new tab and show the extension options in an
- // embedded popup.
- chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams(
- browser, GURL(chrome::kChromeUIExtensionsURL)));
- params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE;
-
+ GURL url_to_navigate;
+ if (OptionsPageInfo::ShouldOpenInTab(extension)) {
+ // Options page tab is simply e.g. chrome-extension://.../options.html.
+ url_to_navigate = OptionsPageInfo::GetOptionsPage(extension);
+ } else {
+ // Options page tab is Extension settings pointed at that Extension's ID,
+ // e.g. chrome://extensions?options=...
+ url_to_navigate = GURL(chrome::kChromeUIExtensionsURL);
GURL::Replacements replacements;
std::string query =
base::StringPrintf("options=%s", extension->id().c_str());
replacements.SetQueryStr(query);
- params.url = params.url.ReplaceComponents(replacements);
-
- chrome::ShowSingletonTabOverwritingNTP(browser, params);
- } else {
- // Otherwise open a new tab with the extension's options page
- content::OpenURLParams params(OptionsPageInfo::GetOptionsPage(extension),
- content::Referrer(),
- SINGLETON_TAB,
- ui::PAGE_TRANSITION_LINK,
- false);
- browser->OpenURL(params);
- browser->window()->Show();
- WebContents* web_contents =
- browser->tab_strip_model()->GetActiveWebContents();
- web_contents->GetDelegate()->ActivateContents(web_contents);
+ url_to_navigate = url_to_navigate.ReplaceComponents(replacements);
}
+ chrome::NavigateParams params(
+ chrome::GetSingletonTabNavigateParams(browser, url_to_navigate));
+ params.path_behavior = 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/test/data/extensions/api_test/runtime/open_options_page/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698