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 20 matching lines...) Expand all Loading... | |
31 #include "content/browser/renderer_host/render_process_host.h" | 31 #include "content/browser/renderer_host/render_process_host.h" |
32 #include "content/browser/renderer_host/render_view_host.h" | 32 #include "content/browser/renderer_host/render_view_host.h" |
33 #include "content/browser/site_instance.h" | 33 #include "content/browser/site_instance.h" |
34 #include "content/browser/worker_host/worker_process_host.h" | 34 #include "content/browser/worker_host/worker_process_host.h" |
35 #include "content/common/desktop_notification_messages.h" | 35 #include "content/common/desktop_notification_messages.h" |
36 #include "content/common/notification_service.h" | 36 #include "content/common/notification_service.h" |
37 #include "grit/browser_resources.h" | 37 #include "grit/browser_resources.h" |
38 #include "grit/chromium_strings.h" | 38 #include "grit/chromium_strings.h" |
39 #include "grit/generated_resources.h" | 39 #include "grit/generated_resources.h" |
40 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
41 #include "grit/theme_resources_standard.h" | |
41 #include "net/base/escape.h" | 42 #include "net/base/escape.h" |
42 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
43 #include "ui/base/resource/resource_bundle.h" | 44 #include "ui/base/resource/resource_bundle.h" |
44 | 45 |
45 using WebKit::WebNotificationPresenter; | 46 using WebKit::WebNotificationPresenter; |
46 using WebKit::WebTextDirection; | 47 using WebKit::WebTextDirection; |
47 | 48 |
48 const ContentSetting kDefaultSetting = CONTENT_SETTING_ASK; | 49 const ContentSetting kDefaultSetting = CONTENT_SETTING_ASK; |
49 | 50 |
50 // NotificationPermissionInfoBarDelegate -------------------------------------- | 51 // NotificationPermissionInfoBarDelegate -------------------------------------- |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 if (!action_taken_) | 116 if (!action_taken_) |
116 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1); | 117 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1); |
117 | 118 |
118 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_); | 119 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_); |
119 if (host) | 120 if (host) |
120 host->DesktopNotificationPermissionRequestDone(callback_context_); | 121 host->DesktopNotificationPermissionRequestDone(callback_context_); |
121 } | 122 } |
122 | 123 |
123 gfx::Image* NotificationPermissionInfoBarDelegate::GetIcon() const { | 124 gfx::Image* NotificationPermissionInfoBarDelegate::GetIcon() const { |
124 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 125 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
125 IDR_PRODUCT_LOGO_32); | 126 IDR_INFOBAR_DESKTOP_NOTIFICATIONS); |
msw
2011/09/07 23:36:12
nit: I think this line should be indented one more
| |
126 } | 127 } |
127 | 128 |
128 InfoBarDelegate::Type | 129 InfoBarDelegate::Type |
129 NotificationPermissionInfoBarDelegate::GetInfoBarType() const { | 130 NotificationPermissionInfoBarDelegate::GetInfoBarType() const { |
130 return PAGE_ACTION_TYPE; | 131 return PAGE_ACTION_TYPE; |
131 } | 132 } |
132 | 133 |
133 string16 NotificationPermissionInfoBarDelegate::GetMessageText() const { | 134 string16 NotificationPermissionInfoBarDelegate::GetMessageText() const { |
134 return l10n_util::GetStringFUTF16(IDS_NOTIFICATION_PERMISSIONS, | 135 return l10n_util::GetStringFUTF16(IDS_NOTIFICATION_PERMISSIONS, |
135 display_name_); | 136 display_name_); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 | 432 |
432 if (setting == CONTENT_SETTING_ALLOW) | 433 if (setting == CONTENT_SETTING_ALLOW) |
433 return WebKit::WebNotificationPresenter::PermissionAllowed; | 434 return WebKit::WebNotificationPresenter::PermissionAllowed; |
434 if (setting == CONTENT_SETTING_BLOCK) | 435 if (setting == CONTENT_SETTING_BLOCK) |
435 return WebKit::WebNotificationPresenter::PermissionDenied; | 436 return WebKit::WebNotificationPresenter::PermissionDenied; |
436 if (setting == CONTENT_SETTING_ASK) | 437 if (setting == CONTENT_SETTING_ASK) |
437 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 438 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
438 NOTREACHED() << "Invalid notifications settings value: " << setting; | 439 NOTREACHED() << "Invalid notifications settings value: " << setting; |
439 return WebKit::WebNotificationPresenter::PermissionNotAllowed; | 440 return WebKit::WebNotificationPresenter::PermissionNotAllowed; |
440 } | 441 } |
OLD | NEW |