Chromium Code Reviews| 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, |