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

Side by Side Diff: chrome/browser/extensions/fake_safe_browsing_database_manager.h

Issue 23591050: Delete the omahaproxy-backed extension blacklist and clear its entries from the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix memory leak in blacklist test Created 7 years, 3 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_EXTENSIONS_FAKE_SAFE_BROWSING_DATABASE_MANAGER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_FAKE_SAFE_BROWSING_DATABASE_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_FAKE_SAFE_BROWSING_DATABASE_MANAGER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_FAKE_SAFE_BROWSING_DATABASE_MANAGER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/safe_browsing/database_manager.h" 11 #include "chrome/browser/safe_browsing/database_manager.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 // A fake safe browsing database manager for use with extensions tests. 15 // A fake safe browsing database manager for use with extensions tests.
16 // 16 //
17 // By default it is disabled (returning true and ignoring |unsafe_ids_|); 17 // By default it is disabled (returning true and ignoring |unsafe_ids_|);
18 // call set_enabled to enable it. 18 // call set_enabled to enable it.
19 class FakeSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager { 19 class FakeSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager {
20 public: 20 public:
21 FakeSafeBrowsingDatabaseManager(); 21 explicit FakeSafeBrowsingDatabaseManager(bool enabled);
22 22
23 // Returns true if synchronously safe, false if not in which case the unsafe 23 // Returns true if synchronously safe, false if not in which case the unsafe
24 // IDs taken from |unsafe_ids_| are passed to to |client| on the current 24 // IDs taken from |unsafe_ids_| are passed to to |client| on the current
25 // message loop. 25 // message loop.
26 virtual bool CheckExtensionIDs(const std::set<std::string>& extension_ids, 26 virtual bool CheckExtensionIDs(const std::set<std::string>& extension_ids,
27 Client* client) OVERRIDE; 27 Client* client) OVERRIDE;
28 28
29 void set_enabled(bool enabled) { enabled_ = enabled; } 29 // Return |this| to chain together SetUnsafe(...).NotifyUpdate() conveniently.
30 FakeSafeBrowsingDatabaseManager& Enable();
31 FakeSafeBrowsingDatabaseManager& ClearUnsafe();
32 FakeSafeBrowsingDatabaseManager& SetUnsafe(const std::string& a);
33 FakeSafeBrowsingDatabaseManager& SetUnsafe(const std::string& a,
34 const std::string& b);
35 FakeSafeBrowsingDatabaseManager& SetUnsafe(const std::string& a,
36 const std::string& b,
37 const std::string& c);
30 38
31 void set_unsafe_ids(const std::set<std::string>& unsafe_ids) { 39 // Send the update notification.
32 unsafe_ids_ = unsafe_ids; 40 void NotifyUpdate();
33 }
34 41
35 private: 42 private:
36 virtual ~FakeSafeBrowsingDatabaseManager(); 43 virtual ~FakeSafeBrowsingDatabaseManager();
37 44
38 // Runs client->SafeBrowsingResult(result). 45 // Runs client->SafeBrowsingResult(result).
39 void OnSafeBrowsingResult(scoped_ptr<SafeBrowsingCheck> result, 46 void OnSafeBrowsingResult(scoped_ptr<SafeBrowsingCheck> result,
40 Client* client); 47 Client* client);
41 48
42 // Whether to respond to CheckExtensionIDs immediately with true (indicating 49 // Whether to respond to CheckExtensionIDs immediately with true (indicating
43 // that there is definitely no extension ID match). 50 // that there is definitely no extension ID match).
44 bool enabled_; 51 bool enabled_;
45 52
46 // The extension IDs considered unsafe. 53 // The extension IDs considered unsafe.
47 std::set<std::string> unsafe_ids_; 54 std::set<std::string> unsafe_ids_;
48 }; 55 };
49 56
50 } // namespace extensions 57 } // namespace extensions
51 58
52 #endif // CHROME_BROWSER_EXTENSIONS_FAKE_SAFE_BROWSING_DATABASE_MANAGER_H_ 59 #endif // CHROME_BROWSER_EXTENSIONS_FAKE_SAFE_BROWSING_DATABASE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698