OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Classes for managing the SafeBrowsing interstitial pages. | 5 // Classes for managing the SafeBrowsing interstitial pages. |
6 // | 6 // |
7 // When a user is about to visit a page the SafeBrowsing system has deemed to | 7 // When a user is about to visit a page the SafeBrowsing system has deemed to |
8 // be malicious, either as malware or a phishing page, we show an interstitial | 8 // be malicious, either as malware or a phishing page, we show an interstitial |
9 // page with some options (go back, continue) to give the user a chance to avoid | 9 // page with some options (go back, continue) to give the user a chance to avoid |
10 // the harmful page. | 10 // the harmful page. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 const SafeBrowsingService::UnsafeResource& resource); | 55 const SafeBrowsingService::UnsafeResource& resource); |
56 | 56 |
57 // Makes the passed |factory| the factory used to instanciate | 57 // Makes the passed |factory| the factory used to instanciate |
58 // SafeBrowsingBlockingPage objects. Usefull for tests. | 58 // SafeBrowsingBlockingPage objects. Usefull for tests. |
59 static void RegisterFactory(SafeBrowsingBlockingPageFactory* factory) { | 59 static void RegisterFactory(SafeBrowsingBlockingPageFactory* factory) { |
60 factory_ = factory; | 60 factory_ = factory; |
61 } | 61 } |
62 | 62 |
63 // InterstitialPage method: | 63 // InterstitialPage method: |
64 virtual std::string GetHTMLContents(); | 64 virtual std::string GetHTMLContents(); |
65 virtual void SetReportingPreference(bool report); | |
65 virtual void Proceed(); | 66 virtual void Proceed(); |
66 virtual void DontProceed(); | 67 virtual void DontProceed(); |
67 | 68 |
68 typedef std::vector<SafeBrowsingService::UnsafeResource> UnsafeResourceList; | 69 typedef std::vector<SafeBrowsingService::UnsafeResource> UnsafeResourceList; |
69 | 70 |
70 protected: | 71 protected: |
71 // InterstitialPage method: | 72 // InterstitialPage method: |
72 virtual void CommandReceived(const std::string& command); | 73 virtual void CommandReceived(const std::string& command); |
73 | 74 |
74 // Don't instanciate this class directly, use ShowBlockingPage instead. | 75 // Don't instanciate this class directly, use ShowBlockingPage instead. |
(...skipping 20 matching lines...) Expand all Loading... | |
95 const std::wstring& title, | 96 const std::wstring& title, |
96 const std::wstring& headline, | 97 const std::wstring& headline, |
97 const std::wstring& description1, | 98 const std::wstring& description1, |
98 const std::wstring& description2, | 99 const std::wstring& description2, |
99 const std::wstring& description3); | 100 const std::wstring& description3); |
100 | 101 |
101 // Records a user action for this interstitial, using the form | 102 // Records a user action for this interstitial, using the form |
102 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. | 103 // SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed]. |
103 void RecordUserAction(BlockingPageEvent event); | 104 void RecordUserAction(BlockingPageEvent event); |
104 | 105 |
106 // See if we should even show the malware report option. For example, we | |
lzheng
2010/11/23 01:14:49
See ->Checks ?
| |
107 // don't show it in incognito mode. | |
108 bool CanShowMalwareReportOption(); | |
109 | |
105 // A list of SafeBrowsingService::UnsafeResource for a tab that the user | 110 // A list of SafeBrowsingService::UnsafeResource for a tab that the user |
106 // should be warned about. They are queued when displaying more than one | 111 // should be warned about. They are queued when displaying more than one |
107 // interstitial at a time. | 112 // interstitial at a time. |
108 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap; | 113 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap; |
109 static UnsafeResourceMap* GetUnsafeResourcesMap(); | 114 static UnsafeResourceMap* GetUnsafeResourcesMap(); |
110 | 115 |
111 // Notifies the SafeBrowsingService on the IO thread whether to proceed or not | 116 // Notifies the SafeBrowsingService on the IO thread whether to proceed or not |
112 // for the |resources|. | 117 // for the |resources|. |
113 static void NotifySafeBrowsingService(SafeBrowsingService* sb_service, | 118 static void NotifySafeBrowsingService(SafeBrowsingService* sb_service, |
114 const UnsafeResourceList& resources, | 119 const UnsafeResourceList& resources, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 public: | 152 public: |
148 virtual ~SafeBrowsingBlockingPageFactory() { } | 153 virtual ~SafeBrowsingBlockingPageFactory() { } |
149 | 154 |
150 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( | 155 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( |
151 SafeBrowsingService* service, | 156 SafeBrowsingService* service, |
152 TabContents* tab_contents, | 157 TabContents* tab_contents, |
153 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; | 158 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; |
154 }; | 159 }; |
155 | 160 |
156 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ | 161 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ |
OLD | NEW |