OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
11 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 11 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
12 #include "chrome/browser/notifications/notification_object_proxy.h" | 12 #include "chrome/browser/notifications/notification_object_proxy.h" |
13 #include "chrome/browser/notifications/notification_ui_manager.h" | 13 #include "chrome/browser/notifications/notification_ui_manager.h" |
14 #include "chrome/browser/notifications/persistent_notification_delegate.h" | 14 #include "chrome/browser/notifications/persistent_notification_delegate.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/profiles/profile_io_data.h" | 16 #include "chrome/browser/profiles/profile_io_data.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "components/content_settings/core/browser/host_content_settings_map.h" | 18 #include "components/content_settings/core/browser/host_content_settings_map.h" |
19 #include "components/content_settings/core/common/content_settings.h" | 19 #include "components/content_settings/core/common/content_settings.h" |
20 #include "components/url_formatter/url_formatter.h" | |
21 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/desktop_notification_delegate.h" | 21 #include "content/public/browser/desktop_notification_delegate.h" |
23 #include "content/public/browser/notification_event_dispatcher.h" | 22 #include "content/public/browser/notification_event_dispatcher.h" |
24 #include "content/public/browser/platform_notification_context.h" | 23 #include "content/public/browser/platform_notification_context.h" |
25 #include "content/public/browser/storage_partition.h" | 24 #include "content/public/browser/storage_partition.h" |
26 #include "content/public/common/platform_notification_data.h" | 25 #include "content/public/common/platform_notification_data.h" |
| 26 #include "net/base/net_util.h" |
27 #include "ui/message_center/notifier_settings.h" | 27 #include "ui/message_center/notifier_settings.h" |
28 #include "url/url_constants.h" | 28 #include "url/url_constants.h" |
29 | 29 |
30 #if defined(ENABLE_EXTENSIONS) | 30 #if defined(ENABLE_EXTENSIONS) |
31 #include "chrome/browser/notifications/notifier_state_tracker.h" | 31 #include "chrome/browser/notifications/notifier_state_tracker.h" |
32 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" | 32 #include "chrome/browser/notifications/notifier_state_tracker_factory.h" |
33 #include "extensions/browser/extension_registry.h" | 33 #include "extensions/browser/extension_registry.h" |
34 #include "extensions/browser/info_map.h" | 34 #include "extensions/browser/info_map.h" |
35 #include "extensions/common/constants.h" | 35 #include "extensions/common/constants.h" |
36 #include "extensions/common/permissions/api_permission.h" | 36 #include "extensions/common/permissions/api_permission.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (origin.SchemeIsHTTPOrHTTPS()) { | 384 if (origin.SchemeIsHTTPOrHTTPS()) { |
385 base::string16 formatted_origin; | 385 base::string16 formatted_origin; |
386 if (origin.SchemeIs(url::kHttpScheme)) { | 386 if (origin.SchemeIs(url::kHttpScheme)) { |
387 const url::Parsed& parsed = origin.parsed_for_possibly_invalid_spec(); | 387 const url::Parsed& parsed = origin.parsed_for_possibly_invalid_spec(); |
388 const std::string& spec = origin.possibly_invalid_spec(); | 388 const std::string& spec = origin.possibly_invalid_spec(); |
389 formatted_origin.append( | 389 formatted_origin.append( |
390 spec.begin(), | 390 spec.begin(), |
391 spec.begin() + | 391 spec.begin() + |
392 parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); | 392 parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); |
393 } | 393 } |
394 formatted_origin.append( | 394 formatted_origin.append(net::IDNToUnicode(origin.host(), languages)); |
395 url_formatter::IDNToUnicode(origin.host(), languages)); | |
396 if (origin.has_port()) { | 395 if (origin.has_port()) { |
397 formatted_origin.push_back(':'); | 396 formatted_origin.push_back(':'); |
398 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 397 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
399 } | 398 } |
400 return formatted_origin; | 399 return formatted_origin; |
401 } | 400 } |
402 | 401 |
403 // TODO(dewittj): Once file:// URLs are passed in to the origin | 402 // TODO(dewittj): Once file:// URLs are passed in to the origin |
404 // GURL here, begin returning the path as the display name. | 403 // GURL here, begin returning the path as the display name. |
405 return url_formatter::FormatUrl(origin, languages); | 404 return net::FormatUrl(origin, languages); |
406 } | 405 } |
OLD | NEW |