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

Side by Side Diff: chrome/browser/extensions/api/notifications/notifications_api.cc

Issue 415143002: A few source code cosmetics for notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/message_center/notification_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/notifications/notifications_api.h" 5 #include "chrome/browser/extensions/api/notifications/notifications_api.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 NotificationsApiFunction::NotificationsApiFunction() { 247 NotificationsApiFunction::NotificationsApiFunction() {
248 } 248 }
249 249
250 NotificationsApiFunction::~NotificationsApiFunction() { 250 NotificationsApiFunction::~NotificationsApiFunction() {
251 } 251 }
252 252
253 bool NotificationsApiFunction::CreateNotification( 253 bool NotificationsApiFunction::CreateNotification(
254 const std::string& id, 254 const std::string& id,
255 api::notifications::NotificationOptions* options) { 255 api::notifications::NotificationOptions* options) {
256 // First, make sure the required fields exist: type, title, message, icon. 256 // First, make sure the required fields exist: type, title, message, icon.
257 // These fields are defined as optional in IDL such that they can be used as 257 // These fields are defined as optional in IDL such that they can be used as
258 // optional for notification updates. But for notification creations, they 258 // optional for notification updates. But for notification creations, they
259 // should be present. 259 // should be present.
260 if (options->type == api::notifications::TEMPLATE_TYPE_NONE || 260 if (options->type == api::notifications::TEMPLATE_TYPE_NONE ||
261 !options->icon_url || !options->title || !options->message) { 261 !options->icon_url || !options->title || !options->message) {
262 SetError(kMissingRequiredPropertiesForCreateNotification); 262 SetError(kMissingRequiredPropertiesForCreateNotification);
263 return false; 263 return false;
264 } 264 }
265 265
266 NotificationBitmapSizes bitmap_sizes = GetNotificationBitmapSizes(); 266 NotificationBitmapSizes bitmap_sizes = GetNotificationBitmapSizes();
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 ? api::notifications::PERMISSION_LEVEL_GRANTED 684 ? api::notifications::PERMISSION_LEVEL_GRANTED
685 : api::notifications::PERMISSION_LEVEL_DENIED; 685 : api::notifications::PERMISSION_LEVEL_DENIED;
686 686
687 SetResult(new base::StringValue(api::notifications::ToString(result))); 687 SetResult(new base::StringValue(api::notifications::ToString(result)));
688 SendResponse(true); 688 SendResponse(true);
689 689
690 return true; 690 return true;
691 } 691 }
692 692
693 } // namespace extensions 693 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | ui/message_center/notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698