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

Unified Diff: chrome/browser/extensions/api/app/app_api.cc

Issue 9737001: Fix crash in AppNotifyChannelSetup when incognito profiles are used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
Index: chrome/browser/extensions/api/app/app_api.cc
diff --git a/chrome/browser/extensions/api/app/app_api.cc b/chrome/browser/extensions/api/app/app_api.cc
index a03c603df119403b9dc9a9abf7b45a34d890326d..663b59bfd066ab55dc7311f1c70244dd98803714 100644
--- a/chrome/browser/extensions/api/app/app_api.cc
+++ b/chrome/browser/extensions/api/app/app_api.cc
@@ -23,8 +23,16 @@ const char kInvalidExtensionIdError[] =
"Invalid extension id";
const char kMissingLinkTextError[] =
"You must specify linkText if you use linkUrl";
+const char kIncognitoError[] =
+ "This API is not accessible by 'split' mode "
+ "extensions in incognito windows.";
bool AppNotifyFunction::RunImpl() {
+ if (!include_incognito() && profile_->IsOffTheRecord()) {
+ error_ = kIncognitoError;
+ return false;
+ }
+
DictionaryValue* details;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
EXTENSION_FUNCTION_VALIDATE(details != NULL);
@@ -77,6 +85,11 @@ bool AppNotifyFunction::RunImpl() {
}
bool AppClearAllNotificationsFunction::RunImpl() {
+ if (!include_incognito() && profile_->IsOffTheRecord()) {
+ error_ = kIncognitoError;
+ return false;
+ }
+
std::string id = extension_id();
DictionaryValue* details = NULL;
if (args_->GetDictionary(0, &details) && details->HasKey(kExtensionIdKey)) {
« no previous file with comments | « no previous file | chrome/browser/extensions/api/app/app_apitest.cc » ('j') | chrome/browser/extensions/extension_tab_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698