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

Unified Diff: chrome/browser/ui/webui/settings/site_settings_handler.cc

Issue 2679453002: MD Settings: CrOS: Use correct profile for Guest mode content settings (Closed)
Patch Set: Fix unittests Created 3 years, 10 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/ui/webui/settings/site_settings_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/site_settings_handler.cc
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc
index 3a0954a4b0b48260a2d41653bdee78ef26c3100e..9c17f2e19ba33fdf14ef09a3a2c1e1b1592c686f 100644
--- a/chrome/browser/ui/webui/settings/site_settings_handler.cc
+++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -37,6 +37,10 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/bytes_formatting.h"
+#if defined(OS_CHROMEOS)
+#include "components/user_manager/user_manager.h"
+#endif
+
namespace settings {
namespace {
@@ -374,8 +378,15 @@ void SiteSettingsHandler::HandleSetDefaultValueForContentType(
ContentSetting default_setting;
CHECK(content_settings::ContentSettingFromString(setting, &default_setting));
+ Profile* profile = profile_;
+#if defined(OS_CHROMEOS)
+ // ChromeOS special case: in Guest mode, settings are opened in Incognito
+ // mode so we need the original profile to actually modify settings.
+ if (user_manager::UserManager::Get()->IsLoggedInAsGuest())
+ profile = profile->GetOriginalProfile();
+#endif
HostContentSettingsMap* map =
- HostContentSettingsMapFactory::GetForProfile(profile_);
+ HostContentSettingsMapFactory::GetForProfile(profile);
map->SetDefaultContentSetting(
static_cast<ContentSettingsType>(static_cast<int>(
site_settings::ContentSettingsTypeFromGroupName(content_type))),
« no previous file with comments | « no previous file | chrome/browser/ui/webui/settings/site_settings_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698