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/string_number_conversions.h" | 8 #include "base/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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 UTF8ToUTF16(i->get()->title)); | 173 UTF8ToUTF16(i->get()->title)); |
174 item->SetString(ui::notifications::kItemMessageKey, | 174 item->SetString(ui::notifications::kItemMessageKey, |
175 UTF8ToUTF16(i->get()->message)); | 175 UTF8ToUTF16(i->get()->message)); |
176 items->Append(item); | 176 items->Append(item); |
177 } | 177 } |
178 optional_fields->Set(ui::notifications::kItemsKey, items); | 178 optional_fields->Set(ui::notifications::kItemsKey, items); |
179 } | 179 } |
180 | 180 |
181 string16 replace_id(UTF8ToUTF16(options->replace_id)); | 181 string16 replace_id(UTF8ToUTF16(options->replace_id)); |
182 | 182 |
183 Notification notification(type, icon_url, title, message, | 183 Notification notification(type, extension_->url(), icon_url, title, message, |
184 WebKit::WebTextDirectionDefault, | 184 WebKit::WebTextDirectionDefault, |
185 string16(), replace_id, | 185 string16(), replace_id, |
186 optional_fields.get(), | 186 optional_fields.get(), |
187 new NotificationApiDelegate(this, | 187 new NotificationApiDelegate(this, |
188 profile(), | 188 profile(), |
189 extension_->id(), | 189 extension_->id(), |
190 replace_id)); | 190 replace_id)); |
191 g_browser_process->notification_ui_manager()->Add(notification, profile()); | 191 g_browser_process->notification_ui_manager()->Add(notification, profile()); |
192 | 192 |
193 // TODO(miket): why return a result if it's always true? | 193 // TODO(miket): why return a result if it's always true? |
194 DictionaryValue* result = new DictionaryValue(); | 194 DictionaryValue* result = new DictionaryValue(); |
195 result->SetBoolean(kResultKey, true); | 195 result->SetBoolean(kResultKey, true); |
196 SetResult(result); | 196 SetResult(result); |
197 SendResponse(true); | 197 SendResponse(true); |
198 | 198 |
199 return true; | 199 return true; |
200 } | 200 } |
201 | 201 |
202 } // namespace extensions | 202 } // namespace extensions |
OLD | NEW |