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

Side by Side Diff: chrome/browser/safe_browsing/client_side_detection_host.cc

Issue 9015021: Remove DeleteTask and convert remaining users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix last Linux gotchas (upload attempt #2) Created 8 years, 11 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/safe_browsing/client_side_detection_host.h" 5 #include "chrome/browser/safe_browsing/client_side_detection_host.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop_helpers.h"
12 #include "base/metrics/histogram.h" 13 #include "base/metrics/histogram.h"
13 #include "base/task.h"
14 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" 17 #include "chrome/browser/safe_browsing/browser_feature_extractor.h"
18 #include "chrome/browser/safe_browsing/client_side_detection_service.h" 18 #include "chrome/browser/safe_browsing/client_side_detection_service.h"
19 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 19 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/pref_names.h" 21 #include "chrome/common/pref_names.h"
22 #include "chrome/common/safe_browsing/csd.pb.h" 22 #include "chrome/common/safe_browsing/csd.pb.h"
23 #include "chrome/common/safe_browsing/safebrowsing_messages.h" 23 #include "chrome/common/safe_browsing/safebrowsing_messages.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 class CsdClient : public SafeBrowsingService::Client { 231 class CsdClient : public SafeBrowsingService::Client {
232 public: 232 public:
233 CsdClient() {} 233 CsdClient() {}
234 234
235 // Method from SafeBrowsingService::Client. This method is called on the 235 // Method from SafeBrowsingService::Client. This method is called on the
236 // IO thread once the interstitial is going away. This method simply deletes 236 // IO thread once the interstitial is going away. This method simply deletes
237 // the CsdClient object. 237 // the CsdClient object.
238 virtual void OnBlockingPageComplete(bool proceed) OVERRIDE { 238 virtual void OnBlockingPageComplete(bool proceed) OVERRIDE {
239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
240 // Delete this on the UI thread since it was created there. 240 // Delete this on the UI thread since it was created there.
241 BrowserThread::PostTask(BrowserThread::UI, 241 BrowserThread::DeleteSoon(BrowserThread::UI,
242 FROM_HERE, 242 FROM_HERE,
243 new DeleteTask<CsdClient>(this)); 243 this);
244 } 244 }
245 245
246 private: 246 private:
247 friend class DeleteTask<CsdClient>; // Calls the private destructor. 247 friend class base::DeleteHelper<CsdClient>; // Calls the private destructor.
248 248
249 // We're taking care of deleting this object. No-one else should delete 249 // We're taking care of deleting this object. No-one else should delete
250 // this object. 250 // this object.
251 virtual ~CsdClient() {} 251 virtual ~CsdClient() {}
252 252
253 DISALLOW_COPY_AND_ASSIGN(CsdClient); 253 DISALLOW_COPY_AND_ASSIGN(CsdClient);
254 }; 254 };
255 255
256 // static 256 // static
257 ClientSideDetectionHost* ClientSideDetectionHost::Create( 257 ClientSideDetectionHost* ClientSideDetectionHost::Create(
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 if (sb_service_) { 492 if (sb_service_) {
493 sb_service_->RemoveObserver(this); 493 sb_service_->RemoveObserver(this);
494 } 494 }
495 sb_service_ = service; 495 sb_service_ = service;
496 if (sb_service_) { 496 if (sb_service_) {
497 sb_service_->AddObserver(this); 497 sb_service_->AddObserver(this);
498 } 498 }
499 } 499 }
500 500
501 } // namespace safe_browsing 501 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698