| OLD | NEW |
| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 optional_fields.clickable = *options->is_clickable; | 280 optional_fields.clickable = *options->is_clickable; |
| 281 | 281 |
| 282 NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate( | 282 NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate( |
| 283 this, GetProfile(), extension_->id(), id)); // ownership is passed to | 283 this, GetProfile(), extension_->id(), id)); // ownership is passed to |
| 284 // Notification | 284 // Notification |
| 285 Notification notification(type, | 285 Notification notification(type, |
| 286 extension_->url(), | 286 extension_->url(), |
| 287 title, | 287 title, |
| 288 message, | 288 message, |
| 289 icon, | 289 icon, |
| 290 blink::WebTextDirectionDefault, | |
| 291 message_center::NotifierId( | 290 message_center::NotifierId( |
| 292 message_center::NotifierId::APPLICATION, | 291 message_center::NotifierId::APPLICATION, |
| 293 extension_->id()), | 292 extension_->id()), |
| 294 base::UTF8ToUTF16(extension_->name()), | 293 base::UTF8ToUTF16(extension_->name()), |
| 295 base::UTF8ToUTF16(api_delegate->id()), | 294 base::UTF8ToUTF16(api_delegate->id()), |
| 296 optional_fields, | 295 optional_fields, |
| 297 api_delegate); | 296 api_delegate); |
| 298 | 297 |
| 299 g_browser_process->notification_ui_manager()->Add(notification, GetProfile()); | 298 g_browser_process->notification_ui_manager()->Add(notification, GetProfile()); |
| 300 return true; | 299 return true; |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 ? api::notifications::PERMISSION_LEVEL_GRANTED | 600 ? api::notifications::PERMISSION_LEVEL_GRANTED |
| 602 : api::notifications::PERMISSION_LEVEL_DENIED; | 601 : api::notifications::PERMISSION_LEVEL_DENIED; |
| 603 | 602 |
| 604 SetResult(new base::StringValue(api::notifications::ToString(result))); | 603 SetResult(new base::StringValue(api::notifications::ToString(result))); |
| 605 SendResponse(true); | 604 SendResponse(true); |
| 606 | 605 |
| 607 return true; | 606 return true; |
| 608 } | 607 } |
| 609 | 608 |
| 610 } // namespace extensions | 609 } // namespace extensions |
| OLD | NEW |