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

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

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style nit Created 5 years, 4 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
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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 optional_fields.items.push_back(item); 351 optional_fields.items.push_back(item);
352 } 352 }
353 } 353 }
354 354
355 if (options->is_clickable.get()) 355 if (options->is_clickable.get())
356 optional_fields.clickable = *options->is_clickable; 356 optional_fields.clickable = *options->is_clickable;
357 357
358 NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate( 358 NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate(
359 this, GetProfile(), extension_->id(), id)); // ownership is passed to 359 this, GetProfile(), extension_->id(), id)); // ownership is passed to
360 // Notification 360 // Notification
361 Notification notification(type, 361 Notification notification(
362 extension_->url(), 362 type, title, message, icon,
363 title, 363 message_center::NotifierId(message_center::NotifierId::APPLICATION,
364 message, 364 extension_->id()),
365 icon, 365 base::UTF8ToUTF16(extension_->name()), extension_->url(),
366 message_center::NotifierId( 366 api_delegate->id(), optional_fields, api_delegate);
367 message_center::NotifierId::APPLICATION,
368 extension_->id()),
369 base::UTF8ToUTF16(extension_->name()),
370 api_delegate->id(),
371 optional_fields,
372 api_delegate);
373 367
374 g_browser_process->notification_ui_manager()->Add(notification, GetProfile()); 368 g_browser_process->notification_ui_manager()->Add(notification, GetProfile());
375 return true; 369 return true;
376 } 370 }
377 371
378 bool NotificationsApiFunction::UpdateNotification( 372 bool NotificationsApiFunction::UpdateNotification(
379 const std::string& id, 373 const std::string& id,
380 api::notifications::NotificationOptions* options, 374 api::notifications::NotificationOptions* options,
381 Notification* notification) { 375 Notification* notification) {
382 NotificationBitmapSizes bitmap_sizes = GetNotificationBitmapSizes(); 376 NotificationBitmapSizes bitmap_sizes = GetNotificationBitmapSizes();
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 ? api::notifications::PERMISSION_LEVEL_GRANTED 680 ? api::notifications::PERMISSION_LEVEL_GRANTED
687 : api::notifications::PERMISSION_LEVEL_DENIED; 681 : api::notifications::PERMISSION_LEVEL_DENIED;
688 682
689 SetResult(new base::StringValue(api::notifications::ToString(result))); 683 SetResult(new base::StringValue(api::notifications::ToString(result)));
690 SendResponse(true); 684 SendResponse(true);
691 685
692 return true; 686 return true;
693 } 687 }
694 688
695 } // namespace extensions 689 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698