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" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "content/public/browser/desktop_notification_delegate.h" | 22 #include "content/public/browser/desktop_notification_delegate.h" |
22 #include "content/public/browser/notification_event_dispatcher.h" | 23 #include "content/public/browser/notification_event_dispatcher.h" |
23 #include "content/public/browser/platform_notification_context.h" | 24 #include "content/public/browser/platform_notification_context.h" |
24 #include "content/public/browser/storage_partition.h" | 25 #include "content/public/browser/storage_partition.h" |
25 #include "content/public/common/platform_notification_data.h" | 26 #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/desktop_notification_service.h" | 31 #include "chrome/browser/notifications/desktop_notification_service.h" |
32 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 32 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
33 #include "extensions/browser/extension_registry.h" | 33 #include "extensions/browser/extension_registry.h" |
34 #include "extensions/browser/extension_system.h" | 34 #include "extensions/browser/extension_system.h" |
35 #include "extensions/browser/info_map.h" | 35 #include "extensions/browser/info_map.h" |
36 #include "extensions/common/constants.h" | 36 #include "extensions/common/constants.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 if (origin.SchemeIsHTTPOrHTTPS()) { | 400 if (origin.SchemeIsHTTPOrHTTPS()) { |
401 base::string16 formatted_origin; | 401 base::string16 formatted_origin; |
402 if (origin.SchemeIs(url::kHttpScheme)) { | 402 if (origin.SchemeIs(url::kHttpScheme)) { |
403 const url::Parsed& parsed = origin.parsed_for_possibly_invalid_spec(); | 403 const url::Parsed& parsed = origin.parsed_for_possibly_invalid_spec(); |
404 const std::string& spec = origin.possibly_invalid_spec(); | 404 const std::string& spec = origin.possibly_invalid_spec(); |
405 formatted_origin.append( | 405 formatted_origin.append( |
406 spec.begin(), | 406 spec.begin(), |
407 spec.begin() + | 407 spec.begin() + |
408 parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); | 408 parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); |
409 } | 409 } |
410 formatted_origin.append(net::IDNToUnicode(origin.host(), languages)); | 410 formatted_origin.append( |
| 411 url_formatter::IDNToUnicode(origin.host(), languages)); |
411 if (origin.has_port()) { | 412 if (origin.has_port()) { |
412 formatted_origin.push_back(':'); | 413 formatted_origin.push_back(':'); |
413 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 414 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
414 } | 415 } |
415 return formatted_origin; | 416 return formatted_origin; |
416 } | 417 } |
417 | 418 |
418 // TODO(dewittj): Once file:// URLs are passed in to the origin | 419 // TODO(dewittj): Once file:// URLs are passed in to the origin |
419 // GURL here, begin returning the path as the display name. | 420 // GURL here, begin returning the path as the display name. |
420 return net::FormatUrl(origin, languages); | 421 return url_formatter::FormatUrl(origin, languages); |
421 } | 422 } |
OLD | NEW |