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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 optional_fields.clickable = *options->is_clickable; | 327 optional_fields.clickable = *options->is_clickable; |
328 | 328 |
329 NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate( | 329 NotificationsApiDelegate* api_delegate(new NotificationsApiDelegate( |
330 this, GetProfile(), extension_->id(), id)); // ownership is passed to | 330 this, GetProfile(), extension_->id(), id)); // ownership is passed to |
331 // Notification | 331 // Notification |
332 Notification notification(type, | 332 Notification notification(type, |
333 extension_->url(), | 333 extension_->url(), |
334 title, | 334 title, |
335 message, | 335 message, |
336 icon, | 336 icon, |
337 WebKit::WebTextDirectionDefault, | 337 blink::WebTextDirectionDefault, |
338 message_center::NotifierId( | 338 message_center::NotifierId( |
339 message_center::NotifierId::APPLICATION, | 339 message_center::NotifierId::APPLICATION, |
340 extension_->id()), | 340 extension_->id()), |
341 UTF8ToUTF16(extension_->name()), | 341 UTF8ToUTF16(extension_->name()), |
342 UTF8ToUTF16(api_delegate->id()), | 342 UTF8ToUTF16(api_delegate->id()), |
343 optional_fields, | 343 optional_fields, |
344 api_delegate); | 344 api_delegate); |
345 | 345 |
346 g_browser_process->notification_ui_manager()->Add(notification, GetProfile()); | 346 g_browser_process->notification_ui_manager()->Add(notification, GetProfile()); |
347 return true; | 347 return true; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 ? api::notifications::PERMISSION_LEVEL_GRANTED | 623 ? api::notifications::PERMISSION_LEVEL_GRANTED |
624 : api::notifications::PERMISSION_LEVEL_DENIED; | 624 : api::notifications::PERMISSION_LEVEL_DENIED; |
625 | 625 |
626 SetResult(new base::StringValue(api::notifications::ToString(result))); | 626 SetResult(new base::StringValue(api::notifications::ToString(result))); |
627 SendResponse(true); | 627 SendResponse(true); |
628 | 628 |
629 return true; | 629 return true; |
630 } | 630 } |
631 | 631 |
632 } // namespace extensions | 632 } // namespace extensions |
OLD | NEW |