Lines Matching refs:check

49 // When download url check takes this long, client's callback will be called
64 // Records disposition information about the check. |hit| should be
134 const SafeBrowsingCheck& check) {
135 if (!check.urls.empty()) {
137 DCHECK(!check.full_hash.get());
138 if (!check.is_download) {
139 DCHECK_EQ(1U, check.urls.size());
140 OnBrowseUrlCheckResult(check.urls[0], check.result);
142 OnDownloadUrlCheckResult(check.urls, check.result);
144 } else if (check.full_hash.get()) {
146 safe_browsing_util::SBFullHashToString(*check.full_hash),
147 check.result);
212 // We need to check the database for url prefix, and later may fetch the url
214 SafeBrowsingCheck* check = new SafeBrowsingCheck();
215 check->urls = url_chain;
217 check,
221 check),
233 // We need to check the database for url prefix, and later may fetch the url
235 SafeBrowsingCheck* check = new SafeBrowsingCheck();
236 check->full_hash.reset(new SBFullHash);
237 safe_browsing_util::StringToSBFullHash(full_hash, check->full_hash.get());
239 check,
243 check),
271 QueuedCheck check;
272 check.client = client;
273 check.url = url;
274 check.start = start;
275 queued_checks_.push_back(check);
294 SafeBrowsingCheck* check = new SafeBrowsingCheck();
295 check->urls.push_back(url);
296 check->client = client;
297 check->result = SAFE;
298 check->is_download = false;
299 check->need_get_hash = full_hits.empty();
300 check->prefix_hits.swap(prefix_hits);
301 check->full_hits.swap(full_hits);
302 checks_.insert(check);
306 NewRunnableMethod(this, &SafeBrowsingService::OnCheckDone, check));
316 // thread calls us back, we'll clean up the check.
322 // check before the database has finished loading.
379 SafeBrowsingCheck* check,
387 // If the service has been shut down, |check| should have been deleted.
388 DCHECK(checks_.find(check) != checks_.end());
392 DCHECK(!check->start.is_null());
394 base::TimeTicks::Now() - check->start);
396 std::vector<SBPrefix> prefixes = check->prefix_hits;
397 OnHandleGetHashResults(check, full_hashes); // 'check' is deleted here.
618 // Flush the database thread. Any in-progress database check results will be
636 SafeBrowsingCheck* check = *it;
637 if (check->client) {
638 check->result = SAFE;
639 check->client->OnSafeBrowsingResult(*check);
641 if (check->timeout_task)
642 check->timeout_task->Cancel();
696 void SafeBrowsingService::OnCheckDone(SafeBrowsingCheck* check) {
702 // If the service has been shut down, |check| should have been deleted.
703 DCHECK(checks_.find(check) != checks_.end());
705 if (check->client && check->need_get_hash) {
714 if (check->prefix_hits.size() == 1) {
715 SBPrefix prefix = check->prefix_hits[0];
719 it->second.push_back(check);
725 requestors.push_back(check);
731 check->start = base::TimeTicks::Now();
732 protocol_manager_->GetFullHash(check, check->prefix_hits);
736 HandleOneCheck(check, check->full_hits);
784 // below will add the check back to the queue, and we'll infinite-loop.
787 QueuedCheck check = queued_checks_.front();
788 DCHECK(!check.start.is_null());
789 HISTOGRAM_TIMES("SB.QueueDelay", base::TimeTicks::Now() - check.start);
793 if (check.client && CheckBrowseUrl(check.url, check.client)) {
795 sb_check.urls.push_back(check.url);
796 sb_check.client = check.client;
798 check.client->OnSafeBrowsingResult(sb_check);
887 // cannot check whether the metrics_service() object is created because it
936 SafeBrowsingCheck* check,
939 bool is_download = check->is_download;
940 SBPrefix prefix = check->prefix_hits[0];
942 if (check->prefix_hits.size() > 1 || it == gethash_requests_.end()) {
943 const bool hit = HandleOneCheck(check, full_hashes);
962 SafeBrowsingCheck* check,
965 DCHECK(check);
969 if (!check->urls.empty()) {
970 for (size_t i = 0; i < check->urls.size(); ++i) {
971 index = safe_browsing_util::GetUrlHashIndex(check->urls[i], full_hashes);
976 index = safe_browsing_util::GetHashIndex(*(check->full_hash), full_hashes);
980 if (check->client) {
981 check->result = SAFE;
983 check->result = GetResultFromListname(full_hashes[index].list_name);
985 SafeBrowsingCheckDone(check);
1092 SafeBrowsingCheck* check) {
1096 if (!database_->ContainsDownloadHashPrefix(check->full_hash->prefix)) {
1098 check->result = SAFE;
1103 check));
1107 check->need_get_hash = true;
1108 check->prefix_hits.push_back(check->full_hash->prefix);
1111 NewRunnableMethod(this, &SafeBrowsingService::OnCheckDone, check));
1114 void SafeBrowsingService::CheckDownloadUrlOnSBThread(SafeBrowsingCheck* check) {
1120 if (!database_->ContainsDownloadUrl(check->urls, &prefix_hits)) {
1122 check->result = SAFE;
1127 check));
1131 check->need_get_hash = true;
1132 check->prefix_hits.clear();
1133 check->prefix_hits = prefix_hits;
1136 NewRunnableMethod(this, &SafeBrowsingService::OnCheckDone, check));
1139 void SafeBrowsingService::TimeoutCallback(SafeBrowsingCheck* check) {
1141 DCHECK(check);
1146 DCHECK(checks_.find(check) != checks_.end());
1147 DCHECK_EQ(check->result, SAFE);
1148 if (check->client) {
1149 check->client->OnSafeBrowsingResult(*check);
1150 check->client = NULL;
1152 check->timeout_task = NULL;
1155 void SafeBrowsingService::CheckDownloadUrlDone(SafeBrowsingCheck* check) {
1157 SafeBrowsingCheckDone(check);
1160 void SafeBrowsingService::CheckDownloadHashDone(SafeBrowsingCheck* check) {
1162 SafeBrowsingCheckDone(check);
1165 void SafeBrowsingService::SafeBrowsingCheckDone(SafeBrowsingCheck* check) {
1167 DCHECK(check);
1172 VLOG(1) << "SafeBrowsingCheckDone: " << check->result;
1173 DCHECK(checks_.find(check) != checks_.end());
1174 if (check->client)
1175 check->client->OnSafeBrowsingResult(*check);
1176 if (check->timeout_task)
1177 check->timeout_task->Cancel();
1178 checks_.erase(check);
1179 delete check;
1182 void SafeBrowsingService::StartDownloadCheck(SafeBrowsingCheck* check,
1187 check->client = client;
1188 check->result = SAFE;
1189 check->is_download = true;
1190 check->timeout_task =
1191 NewRunnableMethod(this, &SafeBrowsingService::TimeoutCallback, check);
1192 checks_.insert(check);
1197 FROM_HERE, check->timeout_task, timeout_ms);