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

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

Issue 351363002: Revert of Port HistoryService::GetVisibleVisitCountToHost to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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) 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 // Implementation of the SafeBrowsingBlockingPage class. 5 // Implementation of the SafeBrowsingBlockingPage class.
6 6
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 else 279 else
280 interstitial_type_ = TYPE_PHISHING; 280 interstitial_type_ = TYPE_PHISHING;
281 281
282 RecordUserAction(SHOW); 282 RecordUserAction(SHOW);
283 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 283 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
284 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 284 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
285 Profile::EXPLICIT_ACCESS); 285 Profile::EXPLICIT_ACCESS);
286 if (history_service) { 286 if (history_service) {
287 history_service->GetVisibleVisitCountToHost( 287 history_service->GetVisibleVisitCountToHost(
288 url_, 288 url_,
289 &request_consumer_,
289 base::Bind(&SafeBrowsingBlockingPage::OnGotHistoryCount, 290 base::Bind(&SafeBrowsingBlockingPage::OnGotHistoryCount,
290 base::Unretained(this)), 291 base::Unretained(this)));
291 &request_tracker_);
292 } 292 }
293 293
294 if (!is_main_frame_load_blocked_) { 294 if (!is_main_frame_load_blocked_) {
295 navigation_entry_index_to_remove_ = 295 navigation_entry_index_to_remove_ =
296 web_contents->GetController().GetLastCommittedEntryIndex(); 296 web_contents->GetController().GetLastCommittedEntryIndex();
297 } else { 297 } else {
298 navigation_entry_index_to_remove_ = -1; 298 navigation_entry_index_to_remove_ = -1;
299 } 299 }
300 300
301 // Start computing malware details. They will be sent only 301 // Start computing malware details. They will be sent only
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 web_contents_->GetController().GetLastCommittedEntryIndex(); 587 web_contents_->GetController().GetLastCommittedEntryIndex();
588 if (navigation_entry_index_to_remove_ != -1 && 588 if (navigation_entry_index_to_remove_ != -1 &&
589 navigation_entry_index_to_remove_ != last_committed_index && 589 navigation_entry_index_to_remove_ != last_committed_index &&
590 !web_contents_->IsBeingDestroyed()) { 590 !web_contents_->IsBeingDestroyed()) {
591 CHECK(web_contents_->GetController().RemoveEntryAtIndex( 591 CHECK(web_contents_->GetController().RemoveEntryAtIndex(
592 navigation_entry_index_to_remove_)); 592 navigation_entry_index_to_remove_));
593 navigation_entry_index_to_remove_ = -1; 593 navigation_entry_index_to_remove_ = -1;
594 } 594 }
595 } 595 }
596 596
597 void SafeBrowsingBlockingPage::OnGotHistoryCount(bool success, 597 void SafeBrowsingBlockingPage::OnGotHistoryCount(HistoryService::Handle handle,
598 bool success,
598 int num_visits, 599 int num_visits,
599 base::Time first_visit) { 600 base::Time first_visit) {
600 if (success) 601 if (success)
601 num_visits_ = num_visits; 602 num_visits_ = num_visits;
602 } 603 }
603 604
604 void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) { 605 void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) {
605 // This enum is used for a histogram. Don't reorder, delete, or insert 606 // This enum is used for a histogram. Don't reorder, delete, or insert
606 // elements. New elements should be added before MAX_ACTION only. 607 // elements. New elements should be added before MAX_ACTION only.
607 enum { 608 enum {
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 IDS_PHISHING_V3_PRIMARY_PARAGRAPH, 1394 IDS_PHISHING_V3_PRIMARY_PARAGRAPH,
1394 base::UTF8ToUTF16(url_.host()))); 1395 base::UTF8ToUTF16(url_.host())));
1395 load_time_data->SetString( 1396 load_time_data->SetString(
1396 "explanationParagraph", 1397 "explanationParagraph",
1397 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, 1398 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH,
1398 base::UTF8ToUTF16(url_.host()))); 1399 base::UTF8ToUTF16(url_.host())));
1399 load_time_data->SetString( 1400 load_time_data->SetString(
1400 "finalParagraph", 1401 "finalParagraph",
1401 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); 1402 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH));
1402 } 1403 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page.h ('k') | chrome/browser/ssl/ssl_blocking_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698