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

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

Issue 8373027: Prevent incognito windows from opening when incognito mode is disabled. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 2 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_tabs_module_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tabs_module.cc
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index bf40f57dfd0080acbe758e307eb7221d9f0c08c1..7e7105792679703514b8129273c0e5357b97158c 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -387,17 +387,17 @@ bool CreateWindowFunction::RunImpl() {
panel_bounds.set_height(bounds_val);
}
+ const IncognitoModePrefs::Availability incognito_avail =
Finnur 2011/10/24 10:08:08 nit: Please don't abbreviate the variable names.
rustema 2011/10/25 03:35:17 Done.
+ IncognitoModePrefs::GetAvailability(profile_->GetPrefs());
bool incognito = false;
if (args->HasKey(keys::kIncognitoKey)) {
EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kIncognitoKey,
&incognito));
- if (IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) ==
- IncognitoModePrefs::DISABLED) {
- error_ = keys::kIncognitoModeIsDisabled;
- return false;
- }
-
if (incognito) {
+ if (incognito_avail == IncognitoModePrefs::DISABLED) {
+ error_ = keys::kIncognitoModeIsDisabled;
+ return false;
+ }
std::string first_url_erased;
// Guest session is an exception as it always opens in incognito mode.
for (size_t i = 0; i < urls.size();) {
@@ -418,6 +418,10 @@ bool CreateWindowFunction::RunImpl() {
window_profile = window_profile->GetOffTheRecordProfile();
}
}
+ if (!incognito && incognito_avail == IncognitoModePrefs::FORCED) {
+ error_ = keys::kIncognitoModeIsForced;
+ return false;
+ }
if (args->HasKey(keys::kFocusedKey)) {
EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kFocusedKey,
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_tabs_module_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698