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

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: feedback + test failures 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..719ea93d45408f00a0be573002ba3938a55c5930 100644
--- a/chrome/browser/extensions/api/app/app_api.cc
+++ b/chrome/browser/extensions/api/app/app_api.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "content/public/browser/notification_service.h"
const char kBodyTextKey[] = "bodyText";
@@ -25,6 +26,11 @@ const char kMissingLinkTextError[] =
"You must specify linkText if you use linkUrl";
bool AppNotifyFunction::RunImpl() {
+ if (!include_incognito() && profile_->IsOffTheRecord()) {
+ error_ = extension_misc::kAppNotificationsIncognitoError;
+ return false;
+ }
+
DictionaryValue* details;
EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &details));
EXTENSION_FUNCTION_VALIDATE(details != NULL);
@@ -77,6 +83,11 @@ bool AppNotifyFunction::RunImpl() {
}
bool AppClearAllNotificationsFunction::RunImpl() {
+ if (!include_incognito() && profile_->IsOffTheRecord()) {
+ error_ = extension_misc::kAppNotificationsIncognitoError;
+ return false;
+ }
+
std::string id = extension_id();
DictionaryValue* details = NULL;
if (args_->GetDictionary(0, &details) && details->HasKey(kExtensionIdKey)) {
« no previous file with comments | « chrome/browser/chromeos/extensions/external_filesystem_apitest.cc ('k') | chrome/browser/extensions/api/app/app_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698