Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.h

Issue 5682008: Make members of Singleton<T> private and only visible to the singleton type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
37 #include "googleurl/src/gurl.h" 37 #include "googleurl/src/gurl.h"
38 38
39 class DictionaryValue; 39 class DictionaryValue;
40 class MessageLoop; 40 class MessageLoop;
41 class SafeBrowsingBlockingPageFactory; 41 class SafeBrowsingBlockingPageFactory;
42 class MalwareDetails; 42 class MalwareDetails;
43 class TabContents; 43 class TabContents;
44 44
45 class SafeBrowsingBlockingPage : public InterstitialPage { 45 class SafeBrowsingBlockingPage : public InterstitialPage {
46 public: 46 public:
47 typedef std::vector<SafeBrowsingService::UnsafeResource> UnsafeResourceList;
48 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap;
49
47 virtual ~SafeBrowsingBlockingPage(); 50 virtual ~SafeBrowsingBlockingPage();
48 51
49 // Shows a blocking page warning the user about phishing/malware for a 52 // Shows a blocking page warning the user about phishing/malware for a
50 // specific resource. 53 // specific resource.
51 // You can call this method several times, if an interstitial is already 54 // You can call this method several times, if an interstitial is already
52 // showing, the new one will be queued and displayed if the user decides 55 // showing, the new one will be queued and displayed if the user decides
53 // to proceed on the currently showing interstitial. 56 // to proceed on the currently showing interstitial.
54 static void ShowBlockingPage( 57 static void ShowBlockingPage(
55 SafeBrowsingService* service, 58 SafeBrowsingService* service,
56 const SafeBrowsingService::UnsafeResource& resource); 59 const SafeBrowsingService::UnsafeResource& resource);
57 60
58 // Makes the passed |factory| the factory used to instanciate 61 // Makes the passed |factory| the factory used to instanciate
59 // SafeBrowsingBlockingPage objects. Usefull for tests. 62 // SafeBrowsingBlockingPage objects. Usefull for tests.
60 static void RegisterFactory(SafeBrowsingBlockingPageFactory* factory) { 63 static void RegisterFactory(SafeBrowsingBlockingPageFactory* factory) {
61 factory_ = factory; 64 factory_ = factory;
62 } 65 }
63 66
64 // InterstitialPage method: 67 // InterstitialPage method:
65 virtual std::string GetHTMLContents(); 68 virtual std::string GetHTMLContents();
66 virtual void Proceed(); 69 virtual void Proceed();
67 virtual void DontProceed(); 70 virtual void DontProceed();
68 71
69 typedef std::vector<SafeBrowsingService::UnsafeResource> UnsafeResourceList;
70
71 protected: 72 protected:
72 friend class SafeBrowsingBlockingPageTest; 73 friend class SafeBrowsingBlockingPageTest;
73 74
74 // InterstitialPage method: 75 // InterstitialPage method:
75 virtual void CommandReceived(const std::string& command); 76 virtual void CommandReceived(const std::string& command);
76 77
77 // Don't instanciate this class directly, use ShowBlockingPage instead. 78 // Don't instanciate this class directly, use ShowBlockingPage instead.
78 SafeBrowsingBlockingPage(SafeBrowsingService* service, 79 SafeBrowsingBlockingPage(SafeBrowsingService* service,
79 TabContents* tab_contents, 80 TabContents* tab_contents,
80 const UnsafeResourceList& unsafe_resources); 81 const UnsafeResourceList& unsafe_resources);
(...skipping 30 matching lines...) Expand all
111 112
112 // Called when the insterstitial is going away. If there is a 113 // Called when the insterstitial is going away. If there is a
113 // pending malware details object, we look at the user's 114 // pending malware details object, we look at the user's
114 // preferences, and if the option to send malware details is 115 // preferences, and if the option to send malware details is
115 // enabled, the report is scheduled to be sent on the |sb_service_|. 116 // enabled, the report is scheduled to be sent on the |sb_service_|.
116 void FinishMalwareDetails(); 117 void FinishMalwareDetails();
117 118
118 // A list of SafeBrowsingService::UnsafeResource for a tab that the user 119 // A list of SafeBrowsingService::UnsafeResource for a tab that the user
119 // should be warned about. They are queued when displaying more than one 120 // should be warned about. They are queued when displaying more than one
120 // interstitial at a time. 121 // interstitial at a time.
121 typedef std::map<TabContents*, UnsafeResourceList> UnsafeResourceMap;
122 static UnsafeResourceMap* GetUnsafeResourcesMap(); 122 static UnsafeResourceMap* GetUnsafeResourcesMap();
123 123
124 // Notifies the SafeBrowsingService on the IO thread whether to proceed or not 124 // Notifies the SafeBrowsingService on the IO thread whether to proceed or not
125 // for the |resources|. 125 // for the |resources|.
126 static void NotifySafeBrowsingService(SafeBrowsingService* sb_service, 126 static void NotifySafeBrowsingService(SafeBrowsingService* sb_service,
127 const UnsafeResourceList& resources, 127 const UnsafeResourceList& resources,
128 bool proceed); 128 bool proceed);
129 129
130 // Returns true if the passed |unsafe_resources| is for the main page. 130 // Returns true if the passed |unsafe_resources| is for the main page.
131 static bool IsMainPage(const UnsafeResourceList& unsafe_resources); 131 static bool IsMainPage(const UnsafeResourceList& unsafe_resources);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 public: 165 public:
166 virtual ~SafeBrowsingBlockingPageFactory() { } 166 virtual ~SafeBrowsingBlockingPageFactory() { }
167 167
168 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage( 168 virtual SafeBrowsingBlockingPage* CreateSafeBrowsingPage(
169 SafeBrowsingService* service, 169 SafeBrowsingService* service,
170 TabContents* tab_contents, 170 TabContents* tab_contents,
171 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0; 171 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) = 0;
172 }; 172 };
173 173
174 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ 174 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698