weblayer_ui_manager_delegate.cc 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "weblayer/browser/safe_browsing/weblayer_ui_manager_delegate.h"
  5. #include "components/safe_browsing/core/browser/ping_manager.h"
  6. #include "content/public/browser/web_contents.h"
  7. #include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h"
  8. #include "weblayer/browser/browser_context_impl.h"
  9. #include "weblayer/browser/browser_process.h"
  10. #include "weblayer/browser/i18n_util.h"
  11. #include "weblayer/browser/no_state_prefetch/no_state_prefetch_utils.h"
  12. #include "weblayer/browser/safe_browsing/weblayer_ping_manager_factory.h"
  13. #include "weblayer/browser/weblayer_metrics_service_accessor.h"
  14. namespace weblayer {
  15. WebLayerSafeBrowsingUIManagerDelegate::WebLayerSafeBrowsingUIManagerDelegate() =
  16. default;
  17. WebLayerSafeBrowsingUIManagerDelegate::
  18. ~WebLayerSafeBrowsingUIManagerDelegate() = default;
  19. std::string WebLayerSafeBrowsingUIManagerDelegate::GetApplicationLocale() {
  20. return i18n::GetApplicationLocale();
  21. }
  22. void WebLayerSafeBrowsingUIManagerDelegate::
  23. TriggerSecurityInterstitialShownExtensionEventIfDesired(
  24. content::WebContents* web_contents,
  25. const GURL& page_url,
  26. const std::string& reason,
  27. int net_error_code) {}
  28. void WebLayerSafeBrowsingUIManagerDelegate::
  29. TriggerSecurityInterstitialProceededExtensionEventIfDesired(
  30. content::WebContents* web_contents,
  31. const GURL& page_url,
  32. const std::string& reason,
  33. int net_error_code) {}
  34. prerender::NoStatePrefetchContents*
  35. WebLayerSafeBrowsingUIManagerDelegate::GetNoStatePrefetchContentsIfExists(
  36. content::WebContents* web_contents) {
  37. return NoStatePrefetchContentsFromWebContents(web_contents);
  38. }
  39. bool WebLayerSafeBrowsingUIManagerDelegate::IsHostingExtension(
  40. content::WebContents* web_contents) {
  41. return false;
  42. }
  43. PrefService* WebLayerSafeBrowsingUIManagerDelegate::GetPrefs(
  44. content::BrowserContext* browser_context) {
  45. return static_cast<BrowserContextImpl*>(browser_context)->pref_service();
  46. }
  47. history::HistoryService*
  48. WebLayerSafeBrowsingUIManagerDelegate::GetHistoryService(
  49. content::BrowserContext* browser_context) {
  50. return nullptr;
  51. }
  52. safe_browsing::PingManager*
  53. WebLayerSafeBrowsingUIManagerDelegate::GetPingManager(
  54. content::BrowserContext* browser_context) {
  55. return WebLayerPingManagerFactory::GetForBrowserContext(browser_context);
  56. }
  57. bool WebLayerSafeBrowsingUIManagerDelegate::
  58. IsMetricsAndCrashReportingEnabled() {
  59. return WebLayerMetricsServiceAccessor::IsMetricsReportingEnabled(
  60. BrowserProcess::GetInstance()->GetLocalState());
  61. }
  62. bool WebLayerSafeBrowsingUIManagerDelegate::IsSendingOfHitReportsEnabled() {
  63. // TODO(crbug.com/1232315): Determine whether to enable sending of hit reports
  64. // in WebLayer.
  65. return false;
  66. }
  67. } // namespace weblayer