OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/notifications/desktop_notification_service.h" | 5 #include "chrome/browser/notifications/desktop_notification_service.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/content_settings/content_settings_details.h" | 10 #include "chrome/browser/content_settings/content_settings_details.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 ResourceBundle::GetSharedInstance().GetRawDataResource( | 201 ResourceBundle::GetSharedInstance().GetRawDataResource( |
202 resource)); | 202 resource)); |
203 | 203 |
204 if (template_html.empty()) { | 204 if (template_html.empty()) { |
205 NOTREACHED() << "unable to load template. ID: " << resource; | 205 NOTREACHED() << "unable to load template. ID: " << resource; |
206 return string16(); | 206 return string16(); |
207 } | 207 } |
208 | 208 |
209 std::string data = ReplaceStringPlaceholders(template_html, subst, NULL); | 209 std::string data = ReplaceStringPlaceholders(template_html, subst, NULL); |
210 return UTF8ToUTF16("data:text/html;charset=utf-8," + | 210 return UTF8ToUTF16("data:text/html;charset=utf-8," + |
211 EscapeQueryParamValue(data, false)); | 211 net::EscapeQueryParamValue(data, false)); |
212 } | 212 } |
213 | 213 |
214 DesktopNotificationService::DesktopNotificationService(Profile* profile, | 214 DesktopNotificationService::DesktopNotificationService(Profile* profile, |
215 NotificationUIManager* ui_manager) | 215 NotificationUIManager* ui_manager) |
216 : profile_(profile), | 216 : profile_(profile), |
217 ui_manager_(ui_manager) { | 217 ui_manager_(ui_manager) { |
218 StartObserving(); | 218 StartObserving(); |
219 } | 219 } |
220 | 220 |
221 DesktopNotificationService::~DesktopNotificationService() { | 221 DesktopNotificationService::~DesktopNotificationService() { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 | 431 |
432 if (setting == CONTENT_SETTING_ALLOW) | 432 if (setting == CONTENT_SETTING_ALLOW) |
433 return WebKit::WebNotificationPresenter::PermissionAllowed; | 433 return WebKit::WebNotificationPresenter::PermissionAllowed; |
434 if (setting == CONTENT_SETTING_BLOCK) | 434 if (setting == CONTENT_SETTING_BLOCK) |
435 return WebKit::WebNotificationPresenter::PermissionDenied; | 435 return WebKit::WebNotificationPresenter::PermissionDenied; |
436 if (setting == CONTENT_SETTING_ASK) | 436 if (setting == CONTENT_SETTING_ASK) |
437 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 437 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
438 NOTREACHED() << "Invalid notifications settings value: " << setting; | 438 NOTREACHED() << "Invalid notifications settings value: " << setting; |
439 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 439 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
440 } | 440 } |
OLD | NEW |