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/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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 if (origin.SchemeIsHTTPOrHTTPS()) { | 392 if (origin.SchemeIsHTTPOrHTTPS()) { |
393 base::string16 formatted_origin; | 393 base::string16 formatted_origin; |
394 if (origin.SchemeIs(url::kHttpScheme)) { | 394 if (origin.SchemeIs(url::kHttpScheme)) { |
395 const url::Parsed& parsed = origin.parsed_for_possibly_invalid_spec(); | 395 const url::Parsed& parsed = origin.parsed_for_possibly_invalid_spec(); |
396 const std::string& spec = origin.possibly_invalid_spec(); | 396 const std::string& spec = origin.possibly_invalid_spec(); |
397 formatted_origin.append( | 397 formatted_origin.append( |
398 spec.begin(), | 398 spec.begin(), |
399 spec.begin() + | 399 spec.begin() + |
400 parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); | 400 parsed.CountCharactersBefore(url::Parsed::USERNAME, true)); |
401 } | 401 } |
402 formatted_origin.append(net::IDNToUnicode(origin.host(), languages)); | 402 formatted_origin.append( |
| 403 url_formatter::IDNToUnicode(origin.host(), languages)); |
403 if (origin.has_port()) { | 404 if (origin.has_port()) { |
404 formatted_origin.push_back(':'); | 405 formatted_origin.push_back(':'); |
405 formatted_origin.append(base::UTF8ToUTF16(origin.port())); | 406 formatted_origin.append(base::UTF8ToUTF16(origin.port())); |
406 } | 407 } |
407 return formatted_origin; | 408 return formatted_origin; |
408 } | 409 } |
409 | 410 |
410 // TODO(dewittj): Once file:// URLs are passed in to the origin | 411 // TODO(dewittj): Once file:// URLs are passed in to the origin |
411 // GURL here, begin returning the path as the display name. | 412 // GURL here, begin returning the path as the display name. |
412 return net::FormatUrl(origin, languages); | 413 return url_formatter::FormatUrl(origin, languages); |
413 } | 414 } |
OLD | NEW |