summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiguelg <miguelg@chromium.org>2015-11-10 17:35:43 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-11 01:37:19 +0000
commitdcbfafe543d63fc1d8d9b1a1c4321b537fba1eb4 (patch)
tree1999869a24ae3a758f59f0f23c786fd0603ec09e
parentfd763172da52a3e2dc913dd96c76ea83a98cd648 (diff)
downloadchromium_src-dcbfafe543d63fc1d8d9b1a1c4321b537fba1eb4.zip
chromium_src-dcbfafe543d63fc1d8d9b1a1c4321b537fba1eb4.tar.gz
chromium_src-dcbfafe543d63fc1d8d9b1a1c4321b537fba1eb4.tar.bz2
Don't use ScopedTabbedBrowserDisplayer for showing settings in CrOs
More generally, if the settings page is displayed as a standalone Window do not bring the whole browser to the foreground. However if it is displayed as a tab make sure it is. BUG=549542 Review URL: https://codereview.chromium.org/1415883012 Cr-Commit-Position: refs/heads/master@{#359003}
-rw-r--r--chrome/browser/notifications/platform_notification_service_impl.cc16
-rw-r--r--chrome/browser/ui/chrome_pages.cc18
-rw-r--r--chrome/browser/ui/chrome_pages.h3
3 files changed, 29 insertions, 8 deletions
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
index 04734d1..6a5db5e 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
@@ -412,10 +413,17 @@ void PlatformNotificationServiceImpl::OpenNotificationSettings(
Profile* profile = Profile::FromBrowserContext(browser_context);
DCHECK(profile);
- chrome::ScopedTabbedBrowserDisplayer browser_displayer(
- profile, chrome::GetActiveDesktop());
- chrome::ShowContentSettingsExceptions(browser_displayer.browser(),
- CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
+
+ if (switches::SettingsWindowEnabled()) {
+ chrome::ShowContentSettingsExceptionsInWindow(
+ profile, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
+ } else {
+ chrome::ScopedTabbedBrowserDisplayer browser_displayer(
+ profile, chrome::GetActiveDesktop());
+ chrome::ShowContentSettingsExceptions(browser_displayer.browser(),
+ CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
+ }
+
#endif // defined(OS_ANDROID)
}
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc
index 448d16f..35609ea 100644
--- a/chrome/browser/ui/chrome_pages.cc
+++ b/chrome/browser/ui/chrome_pages.cc
@@ -129,6 +129,11 @@ void ShowHelpImpl(Browser* browser,
#endif
}
+std::string GenerateContentSettingsExceptionsSubPage(ContentSettingsType type) {
+ return kContentSettingsExceptionsSubPage + std::string(kHashMark) +
+ options::ContentSettingsHandler::ContentSettingsTypeToGroupName(type);
+}
+
} // namespace
void ShowBookmarkManager(Browser* browser) {
@@ -298,10 +303,15 @@ void ShowSettingsSubPageInTabbedBrowser(Browser* browser,
void ShowContentSettingsExceptions(Browser* browser,
ContentSettingsType content_settings_type) {
ShowSettingsSubPage(
- browser,
- kContentSettingsExceptionsSubPage + std::string(kHashMark) +
- options::ContentSettingsHandler::ContentSettingsTypeToGroupName(
- content_settings_type));
+ browser, GenerateContentSettingsExceptionsSubPage(content_settings_type));
+}
+
+void ShowContentSettingsExceptionsInWindow(
+ Profile* profile,
+ ContentSettingsType content_settings_type) {
+ DCHECK(switches::SettingsWindowEnabled());
+ ShowSettingsSubPageForProfile(
+ profile, GenerateContentSettingsExceptionsSubPage(content_settings_type));
}
void ShowContentSettings(Browser* browser,
diff --git a/chrome/browser/ui/chrome_pages.h b/chrome/browser/ui/chrome_pages.h
index 070f1ab..72f4e03 100644
--- a/chrome/browser/ui/chrome_pages.h
+++ b/chrome/browser/ui/chrome_pages.h
@@ -77,6 +77,9 @@ void ShowSettingsSubPageForProfile(Profile* profile,
const std::string& sub_page);
void ShowContentSettingsExceptions(Browser* browser,
ContentSettingsType content_settings_type);
+void ShowContentSettingsExceptionsInWindow(
+ Profile* profile,
+ ContentSettingsType content_settings_type);
void ShowContentSettings(Browser* browser,
ContentSettingsType content_settings_type);
void ShowSettingsSubPageInTabbedBrowser(Browser* browser,