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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // The Safe Browsing service is responsible for downloading anti-phishing and 5 // The Safe Browsing service is responsible for downloading anti-phishing and
6 // anti-malware tables and checking urls against them. 6 // anti-malware tables and checking urls against them.
7 7
8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 8 #ifndef CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 9 #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
10 10
11 #include <deque> 11 #include <deque>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/file_path.h" 18 #include "base/file_path.h"
19 #include "base/hash_tables.h" 19 #include "base/hash_tables.h"
20 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
21 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
22 #include "base/observer_list.h" 22 #include "base/observer_list.h"
23 #include "base/prefs/public/pref_observer.h"
23 #include "base/sequenced_task_runner_helpers.h" 24 #include "base/sequenced_task_runner_helpers.h"
24 #include "base/synchronization/lock.h" 25 #include "base/synchronization/lock.h"
25 #include "base/time.h" 26 #include "base/time.h"
26 #include "chrome/browser/safe_browsing/safe_browsing_util.h" 27 #include "chrome/browser/safe_browsing/safe_browsing_util.h"
27 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/notification_observer.h" 29 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 30 #include "content/public/browser/notification_registrar.h"
30 #include "googleurl/src/gurl.h" 31 #include "googleurl/src/gurl.h"
31 32
32 class MalwareDetails; 33 class MalwareDetails;
(...skipping 15 matching lines...) Expand all
48 49
49 namespace safe_browsing { 50 namespace safe_browsing {
50 class ClientSideDetectionService; 51 class ClientSideDetectionService;
51 class DownloadProtectionService; 52 class DownloadProtectionService;
52 } 53 }
53 54
54 // Construction needs to happen on the main thread. 55 // Construction needs to happen on the main thread.
55 class SafeBrowsingService 56 class SafeBrowsingService
56 : public base::RefCountedThreadSafe< 57 : public base::RefCountedThreadSafe<
57 SafeBrowsingService, content::BrowserThread::DeleteOnUIThread>, 58 SafeBrowsingService, content::BrowserThread::DeleteOnUIThread>,
58 public content::NotificationObserver { 59 public content::NotificationObserver,
60 public PrefObserver {
59 public: 61 public:
60 class Client; 62 class Client;
61 // Passed a boolean indicating whether or not it is OK to proceed with 63 // Passed a boolean indicating whether or not it is OK to proceed with
62 // loading an URL. 64 // loading an URL.
63 typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback; 65 typedef base::Callback<void(bool /*proceed*/)> UrlCheckCallback;
64 66
65 // Structure used to pass parameters between the IO and UI thread when 67 // Structure used to pass parameters between the IO and UI thread when
66 // interacting with the blocking page. 68 // interacting with the blocking page.
67 struct UnsafeResource { 69 struct UnsafeResource {
68 UnsafeResource(); 70 UnsafeResource();
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 int64 timeout_ms); 465 int64 timeout_ms);
464 466
465 // Adds the given entry to the whitelist. Called on the UI thread. 467 // Adds the given entry to the whitelist. Called on the UI thread.
466 void UpdateWhitelist(const UnsafeResource& resource); 468 void UpdateWhitelist(const UnsafeResource& resource);
467 469
468 // content::NotificationObserver override 470 // content::NotificationObserver override
469 virtual void Observe(int type, 471 virtual void Observe(int type,
470 const content::NotificationSource& source, 472 const content::NotificationSource& source,
471 const content::NotificationDetails& details) OVERRIDE; 473 const content::NotificationDetails& details) OVERRIDE;
472 474
475 // PrefObserver override
476 virtual void OnPreferenceChanged(PrefServiceBase* service,
477 const std::string& pref_name) OVERRIDE;
478
473 // Starts following the safe browsing preference on |pref_service|. 479 // Starts following the safe browsing preference on |pref_service|.
474 void AddPrefService(PrefService* pref_service); 480 void AddPrefService(PrefService* pref_service);
475 481
476 // Stop following the safe browsing preference on |pref_service|. 482 // Stop following the safe browsing preference on |pref_service|.
477 void RemovePrefService(PrefService* pref_service); 483 void RemovePrefService(PrefService* pref_service);
478 484
479 // Checks if any profile is currently using the safe browsing service, and 485 // Checks if any profile is currently using the safe browsing service, and
480 // starts or stops the service accordingly. 486 // starts or stops the service accordingly.
481 void RefreshState(); 487 void RefreshState();
482 488
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 class SafeBrowsingServiceFactory { 587 class SafeBrowsingServiceFactory {
582 public: 588 public:
583 SafeBrowsingServiceFactory() { } 589 SafeBrowsingServiceFactory() { }
584 virtual ~SafeBrowsingServiceFactory() { } 590 virtual ~SafeBrowsingServiceFactory() { }
585 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0; 591 virtual SafeBrowsingService* CreateSafeBrowsingService() = 0;
586 private: 592 private:
587 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory); 593 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceFactory);
588 }; 594 };
589 595
590 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_ 596 #endif // CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/protector/protected_prefs_watcher.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698