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/ui/webui/interstitials/interstitial_ui.h" | 5 #include "chrome/browser/ui/webui/interstitials/interstitial_ui.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 10 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
11 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 11 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
12 #include "chrome/browser/ssl/ssl_blocking_page.h" | 12 #include "chrome/browser/ssl/ssl_blocking_page.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/interstitial_page_delegate.h" | 14 #include "content/public/browser/interstitial_page_delegate.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
17 #include "content/public/browser/web_ui_controller.h" | 17 #include "content/public/browser/web_ui_controller.h" |
18 #include "content/public/browser/web_ui_data_source.h" | 18 #include "content/public/browser/web_ui_data_source.h" |
19 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
20 #include "net/base/url_util.h" | 20 #include "net/base/url_util.h" |
21 #include "net/cert/x509_certificate.h" | 21 #include "net/cert/x509_certificate.h" |
22 #include "net/ssl/ssl_info.h" | 22 #include "net/ssl/ssl_info.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 class InterstitialHTMLSource : public content::URLDataSource { | 26 class InterstitialHTMLSource : public content::URLDataSource { |
27 public: | 27 public: |
28 InterstitialHTMLSource(Profile* profile, | 28 InterstitialHTMLSource(Profile* profile, |
29 content::WebContents* web_contents); | 29 content::WebContents* web_contents); |
30 virtual ~InterstitialHTMLSource(); | 30 ~InterstitialHTMLSource() override; |
31 | 31 |
32 // content::URLDataSource: | 32 // content::URLDataSource: |
33 virtual std::string GetMimeType(const std::string& mime_type) const override; | 33 std::string GetMimeType(const std::string& mime_type) const override; |
34 virtual std::string GetSource() const override; | 34 std::string GetSource() const override; |
35 virtual bool ShouldAddContentSecurityPolicy() const override; | 35 bool ShouldAddContentSecurityPolicy() const override; |
36 virtual void StartDataRequest( | 36 void StartDataRequest( |
37 const std::string& path, | 37 const std::string& path, |
38 int render_process_id, | 38 int render_process_id, |
39 int render_frame_id, | 39 int render_frame_id, |
40 const content::URLDataSource::GotDataCallback& callback) override; | 40 const content::URLDataSource::GotDataCallback& callback) override; |
41 | 41 |
42 private: | 42 private: |
43 Profile* profile_; | 43 Profile* profile_; |
44 content::WebContents* web_contents_; | 44 content::WebContents* web_contents_; |
45 DISALLOW_COPY_AND_ASSIGN(InterstitialHTMLSource); | 45 DISALLOW_COPY_AND_ASSIGN(InterstitialHTMLSource); |
46 }; | 46 }; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 "<a href='safebrowsing?type=clientside_malware'>" | 199 "<a href='safebrowsing?type=clientside_malware'>" |
200 " Client Side Malware</a><br>" | 200 " Client Side Malware</a><br>" |
201 "<a href='safebrowsing?type=clientside_phishing'>" | 201 "<a href='safebrowsing?type=clientside_phishing'>" |
202 " Client Side Phishing</a><br>" | 202 " Client Side Phishing</a><br>" |
203 "</body></html>"; | 203 "</body></html>"; |
204 } | 204 } |
205 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; | 205 scoped_refptr<base::RefCountedString> html_bytes = new base::RefCountedString; |
206 html_bytes->data().assign(html.begin(), html.end()); | 206 html_bytes->data().assign(html.begin(), html.end()); |
207 callback.Run(html_bytes.get()); | 207 callback.Run(html_bytes.get()); |
208 } | 208 } |
OLD | NEW |