Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/incident_reporting/incident_reporting_ser vice.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/incident_reporting_ser vice.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 } | 431 } |
| 432 | 432 |
| 433 scoped_ptr<IncidentReportUploader> IncidentReportingService::StartReportUpload( | 433 scoped_ptr<IncidentReportUploader> IncidentReportingService::StartReportUpload( |
| 434 const IncidentReportUploader::OnResultCallback& callback, | 434 const IncidentReportUploader::OnResultCallback& callback, |
| 435 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, | 435 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, |
| 436 const ClientIncidentReport& report) { | 436 const ClientIncidentReport& report) { |
| 437 return IncidentReportUploaderImpl::UploadReport( | 437 return IncidentReportUploaderImpl::UploadReport( |
| 438 callback, request_context_getter, report).Pass(); | 438 callback, request_context_getter, report).Pass(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool IncidentReportingService::IsProcessingReport() const { | |
| 442 return report_; | |
|
robertshield
2014/09/11 15:37:22
can you make this report_ != null, makes it explic
grt (UTC plus 2)
2014/09/11 15:50:01
Done.
| |
| 443 } | |
| 444 | |
| 441 IncidentReportingService::ProfileContext* | 445 IncidentReportingService::ProfileContext* |
| 442 IncidentReportingService::GetOrCreateProfileContext(Profile* profile) { | 446 IncidentReportingService::GetOrCreateProfileContext(Profile* profile) { |
| 443 ProfileContextCollection::iterator it = | 447 ProfileContextCollection::iterator it = |
| 444 profiles_.insert(ProfileContextCollection::value_type(profile, NULL)) | 448 profiles_.insert(ProfileContextCollection::value_type(profile, NULL)) |
| 445 .first; | 449 .first; |
| 446 if (!it->second) | 450 if (!it->second) |
| 447 it->second = new ProfileContext(); | 451 it->second = new ProfileContext(); |
| 448 return it->second; | 452 return it->second; |
| 449 } | 453 } |
| 450 | 454 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 673 } | 677 } |
| 674 | 678 |
| 675 bool IncidentReportingService::WaitingForMostRecentDownload() { | 679 bool IncidentReportingService::WaitingForMostRecentDownload() { |
| 676 DCHECK(report_); // Only call this when a report is being assembled. | 680 DCHECK(report_); // Only call this when a report is being assembled. |
| 677 // The easy case: not waiting if a download has already been found. | 681 // The easy case: not waiting if a download has already been found. |
| 678 if (report_->has_download()) | 682 if (report_->has_download()) |
| 679 return false; | 683 return false; |
| 680 // The next easy case: waiting if the finder is operating. | 684 // The next easy case: waiting if the finder is operating. |
| 681 if (last_download_finder_) | 685 if (last_download_finder_) |
| 682 return true; | 686 return true; |
| 683 // The harder case: waiting if a profile has not yet been added. | 687 // The harder case: waiting if a non-NULL profile has not yet been added. |
| 684 for (ProfileContextCollection::const_iterator scan = profiles_.begin(); | 688 for (ProfileContextCollection::const_iterator scan = profiles_.begin(); |
| 685 scan != profiles_.end(); | 689 scan != profiles_.end(); |
| 686 ++scan) { | 690 ++scan) { |
| 687 if (!scan->second->added) | 691 if (scan->first && !scan->second->added) |
| 688 return true; | 692 return true; |
| 689 } | 693 } |
| 690 // There is no most recent download and there's nothing more to wait for. | 694 // There is no most recent download and there's nothing more to wait for. |
| 691 return false; | 695 return false; |
| 692 } | 696 } |
| 693 | 697 |
| 694 void IncidentReportingService::CancelDownloadCollection() { | 698 void IncidentReportingService::CancelDownloadCollection() { |
| 695 last_download_finder_.reset(); | 699 last_download_finder_.reset(); |
| 696 last_download_begin_ = base::TimeTicks(); | 700 last_download_begin_ = base::TimeTicks(); |
| 697 if (report_) | 701 if (report_) |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 957 if (!profile->IsOffTheRecord()) | 961 if (!profile->IsOffTheRecord()) |
| 958 OnProfileDestroyed(profile); | 962 OnProfileDestroyed(profile); |
| 959 break; | 963 break; |
| 960 } | 964 } |
| 961 default: | 965 default: |
| 962 break; | 966 break; |
| 963 } | 967 } |
| 964 } | 968 } |
| 965 | 969 |
| 966 } // namespace safe_browsing | 970 } // namespace safe_browsing |
| OLD | NEW |