summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 14:59:29 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-04 14:59:29 +0000
commite1457d5825f3609777651359ae424be65b75b0e4 (patch)
tree50275793720bc3315b928dfa79c8f9396f6bc872
parentc4081853c78b7842406d1ebcf3c32bd7c9c9e674 (diff)
downloadchromium_src-e1457d5825f3609777651359ae424be65b75b0e4.zip
chromium_src-e1457d5825f3609777651359ae424be65b75b0e4.tar.gz
chromium_src-e1457d5825f3609777651359ae424be65b75b0e4.tar.bz2
Make sure extensions can't open an incognito window if disabled by network policy.
BUG=66413 TEST=Disallow incognito (using the enterprise tools), open the bookmark manager, right-click an item, select Open in incognito. It should not work. Review URL: http://codereview.chromium.org/6250131 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73804 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/extension_tabs_module.cc6
-rw-r--r--chrome/browser/extensions/extension_tabs_module_constants.cc3
-rw-r--r--chrome/browser/extensions/extension_tabs_module_constants.h3
3 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index 2d1fe41..c3d5705 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -33,6 +33,7 @@
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_error_utils.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "gfx/codec/jpeg_codec.h"
#include "gfx/codec/png_codec.h"
@@ -434,6 +435,11 @@ bool CreateWindowFunction::RunImpl() {
if (args->HasKey(keys::kIncognitoKey)) {
EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kIncognitoKey,
&incognito));
+ if (!profile_->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) {
+ error_ = keys::kIncognitoModeIsDisabled;
+ return false;
+ }
+
if (incognito)
window_profile = window_profile->GetOffTheRecordProfile();
}
diff --git a/chrome/browser/extensions/extension_tabs_module_constants.cc b/chrome/browser/extensions/extension_tabs_module_constants.cc
index 11ddc28..74eff33 100644
--- a/chrome/browser/extensions/extension_tabs_module_constants.cc
+++ b/chrome/browser/extensions/extension_tabs_module_constants.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -63,6 +63,7 @@ const char kTabNotFoundError[] = "No tab with id: *.";
const char kTabStripNotEditableError[] =
"Tabs cannot be edited right now (user may be dragging a tab).";
const char kNoSelectedTabError[] = "No selected tab";
+const char kIncognitoModeIsDisabled[] = "Incognito mode is disabled.";
const char kInvalidUrlError[] = "Invalid url: \"*\".";
const char kInternalVisibleTabCaptureError[] =
"Internal error while trying to capture visible region of the current tab";
diff --git a/chrome/browser/extensions/extension_tabs_module_constants.h b/chrome/browser/extensions/extension_tabs_module_constants.h
index 4503014..977727d 100644
--- a/chrome/browser/extensions/extension_tabs_module_constants.h
+++ b/chrome/browser/extensions/extension_tabs_module_constants.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -64,6 +64,7 @@ extern const char kWindowNotFoundError[];
extern const char kTabNotFoundError[];
extern const char kTabStripNotEditableError[];
extern const char kNoSelectedTabError[];
+extern const char kIncognitoModeIsDisabled[];
extern const char kInvalidUrlError[];
extern const char kInternalVisibleTabCaptureError[];
extern const char kNotImplementedError[];