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/notification/notification_api.h" | 5 #include "chrome/browser/extensions/api/notification/notification_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 string16 title(UTF8ToUTF16(options->title)); | 145 string16 title(UTF8ToUTF16(options->title)); |
146 string16 message(UTF8ToUTF16(options->message)); | 146 string16 message(UTF8ToUTF16(options->message)); |
147 | 147 |
148 scoped_ptr<DictionaryValue> optional_fields(new DictionaryValue()); | 148 scoped_ptr<DictionaryValue> optional_fields(new DictionaryValue()); |
149 | 149 |
150 // For all notification types. | 150 // For all notification types. |
151 if (options->priority.get()) | 151 if (options->priority.get()) |
152 optional_fields->SetInteger(ui::notifications::kPriorityKey, | 152 optional_fields->SetInteger(ui::notifications::kPriorityKey, |
153 *options->priority); | 153 *options->priority); |
154 if (options->event_time.get()) | 154 if (options->event_time.get()) |
155 optional_fields->SetString(ui::notifications::kTimestampKey, | 155 optional_fields->SetDouble(ui::notifications::kTimestampKey, |
156 *options->event_time); | 156 *options->event_time); |
157 if (options->buttons.get()) { | 157 if (options->buttons.get()) { |
158 if (options->buttons->size() > 0) { | 158 if (options->buttons->size() > 0) { |
159 linked_ptr<api::experimental_notification::NotificationButton> button = | 159 linked_ptr<api::experimental_notification::NotificationButton> button = |
160 (*options->buttons)[0]; | 160 (*options->buttons)[0]; |
161 optional_fields->SetString(ui::notifications::kButtonOneTitleKey, | 161 optional_fields->SetString(ui::notifications::kButtonOneTitleKey, |
162 UTF8ToUTF16(button->title)); | 162 UTF8ToUTF16(button->title)); |
163 if (button->icon_url.get()) | 163 if (button->icon_url.get()) |
164 optional_fields->SetString(ui::notifications::kButtonOneIconUrlKey, | 164 optional_fields->SetString(ui::notifications::kButtonOneIconUrlKey, |
165 UTF8ToUTF16(*button->icon_url)); | 165 UTF8ToUTF16(*button->icon_url)); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 CancelById(NotificationApiDelegate::CreateScopedIdentifier( | 305 CancelById(NotificationApiDelegate::CreateScopedIdentifier( |
306 extension_->id(), params_->notification_id)); | 306 extension_->id(), params_->notification_id)); |
307 | 307 |
308 SetResult(Value::CreateBooleanValue(cancel_result)); | 308 SetResult(Value::CreateBooleanValue(cancel_result)); |
309 SendResponse(true); | 309 SendResponse(true); |
310 | 310 |
311 return true; | 311 return true; |
312 } | 312 } |
313 | 313 |
314 } // namespace extensions | 314 } // namespace extensions |
OLD | NEW |