OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/security_interstitials/content/security_interstitial_contro ller_client.h" | 5 #include "components/security_interstitials/content/security_interstitial_contro ller_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "components/prefs/pref_service.h" | 9 #include "components/prefs/pref_service.h" |
10 #include "components/safe_browsing/common/safe_browsing_prefs.h" | 10 #include "components/safe_browsing/common/safe_browsing_prefs.h" |
11 #include "components/security_interstitials/core/metrics_helper.h" | 11 #include "components/security_interstitials/core/metrics_helper.h" |
12 #include "content/public/browser/interstitial_page.h" | 12 #include "content/public/browser/interstitial_page.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "content/public/common/referrer.h" | 14 #include "content/public/common/referrer.h" |
15 | 15 |
16 using content::Referrer; | 16 using content::Referrer; |
17 | 17 |
18 namespace security_interstitials { | 18 namespace security_interstitials { |
19 | 19 |
20 // Help Center url | |
meacer
2017/06/23 20:28:32
nit: End comments with a period.
sperigo
2017/06/23 21:32:11
Done.
| |
21 const char kHelpCenterUrl[] = "https://support.google.com/chrome/"; | |
22 | |
20 SecurityInterstitialControllerClient::SecurityInterstitialControllerClient( | 23 SecurityInterstitialControllerClient::SecurityInterstitialControllerClient( |
21 content::WebContents* web_contents, | 24 content::WebContents* web_contents, |
22 std::unique_ptr<MetricsHelper> metrics_helper, | 25 std::unique_ptr<MetricsHelper> metrics_helper, |
23 PrefService* prefs, | 26 PrefService* prefs, |
24 const std::string& app_locale, | 27 const std::string& app_locale, |
25 const GURL& default_safe_page) | 28 const GURL& default_safe_page) |
26 : ControllerClient(std::move(metrics_helper)), | 29 : ControllerClient(std::move(metrics_helper)), |
27 web_contents_(web_contents), | 30 web_contents_(web_contents), |
28 interstitial_page_(nullptr), | 31 interstitial_page_(nullptr), |
29 prefs_(prefs), | 32 prefs_(prefs), |
30 app_locale_(app_locale), | 33 app_locale_(app_locale), |
31 default_safe_page_(default_safe_page) {} | 34 default_safe_page_(default_safe_page) { |
35 help_center_url_ = GURL(kHelpCenterUrl); | |
meacer
2017/06/23 20:28:32
You can move this to the parameter list:
...
defa
sperigo
2017/06/23 21:32:11
Done.
| |
36 } | |
32 | 37 |
33 SecurityInterstitialControllerClient::~SecurityInterstitialControllerClient() {} | 38 SecurityInterstitialControllerClient::~SecurityInterstitialControllerClient() {} |
34 | 39 |
35 void SecurityInterstitialControllerClient::set_interstitial_page( | 40 void SecurityInterstitialControllerClient::set_interstitial_page( |
36 content::InterstitialPage* interstitial_page) { | 41 content::InterstitialPage* interstitial_page) { |
37 interstitial_page_ = interstitial_page; | 42 interstitial_page_ = interstitial_page; |
38 } | 43 } |
39 | 44 |
40 content::InterstitialPage* | 45 content::InterstitialPage* |
41 SecurityInterstitialControllerClient::interstitial_page() { | 46 SecurityInterstitialControllerClient::interstitial_page() { |
(...skipping 22 matching lines...) Expand all Loading... | |
64 } | 69 } |
65 | 70 |
66 void SecurityInterstitialControllerClient::Proceed() { | 71 void SecurityInterstitialControllerClient::Proceed() { |
67 interstitial_page_->Proceed(); | 72 interstitial_page_->Proceed(); |
68 } | 73 } |
69 | 74 |
70 void SecurityInterstitialControllerClient::Reload() { | 75 void SecurityInterstitialControllerClient::Reload() { |
71 web_contents_->GetController().Reload(content::ReloadType::NORMAL, true); | 76 web_contents_->GetController().Reload(content::ReloadType::NORMAL, true); |
72 } | 77 } |
73 | 78 |
79 void SecurityInterstitialControllerClient::OpenUrlInNewForegroundTab( | |
80 const GURL& url) { | |
81 content::OpenURLParams params(url, Referrer(), | |
82 WindowOpenDisposition::NEW_FOREGROUND_TAB, | |
83 ui::PAGE_TRANSITION_LINK, false); | |
84 web_contents_->OpenURL(params); | |
85 } | |
86 | |
74 void SecurityInterstitialControllerClient::OpenUrlInCurrentTab( | 87 void SecurityInterstitialControllerClient::OpenUrlInCurrentTab( |
75 const GURL& url) { | 88 const GURL& url) { |
76 content::OpenURLParams params(url, Referrer(), | 89 content::OpenURLParams params(url, Referrer(), |
77 WindowOpenDisposition::CURRENT_TAB, | 90 WindowOpenDisposition::CURRENT_TAB, |
78 ui::PAGE_TRANSITION_LINK, false); | 91 ui::PAGE_TRANSITION_LINK, false); |
79 web_contents_->OpenURL(params); | 92 web_contents_->OpenURL(params); |
80 } | 93 } |
81 | 94 |
82 const std::string& | 95 const std::string& |
83 SecurityInterstitialControllerClient::GetApplicationLocale() const { | 96 SecurityInterstitialControllerClient::GetApplicationLocale() const { |
(...skipping 12 matching lines...) Expand all Loading... | |
96 | 109 |
97 bool SecurityInterstitialControllerClient::CanLaunchDateAndTimeSettings() { | 110 bool SecurityInterstitialControllerClient::CanLaunchDateAndTimeSettings() { |
98 NOTREACHED(); | 111 NOTREACHED(); |
99 return false; | 112 return false; |
100 } | 113 } |
101 | 114 |
102 void SecurityInterstitialControllerClient::LaunchDateAndTimeSettings() { | 115 void SecurityInterstitialControllerClient::LaunchDateAndTimeSettings() { |
103 NOTREACHED(); | 116 NOTREACHED(); |
104 } | 117 } |
105 | 118 |
119 GURL SecurityInterstitialControllerClient::GetHelpCenterUrl() const { | |
120 return help_center_url_; | |
121 } | |
122 | |
123 void SecurityInterstitialControllerClient::SetHelpCenterUrlForTesting( | |
124 const GURL test_url) { | |
meacer
2017/06/23 20:28:32
const GURL& test_url
sperigo
2017/06/23 21:32:11
Done.
| |
125 help_center_url_ = test_url; | |
126 } | |
127 | |
106 } // namespace security_interstitials | 128 } // namespace security_interstitials |
OLD | NEW |