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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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 // 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 12 matching lines...) Expand all
23 #include "chrome/browser/safe_browsing/malware_details.h" 23 #include "chrome/browser/safe_browsing/malware_details.h"
24 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 24 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
25 #include "chrome/browser/tab_contents/tab_util.h" 25 #include "chrome/browser/tab_contents/tab_util.h"
26 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 26 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
27 #include "chrome/common/jstemplate_builder.h" 27 #include "chrome/common/jstemplate_builder.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "content/browser/tab_contents/navigation_controller.h" 30 #include "content/browser/tab_contents/navigation_controller.h"
31 #include "content/browser/tab_contents/navigation_entry.h" 31 #include "content/browser/tab_contents/navigation_entry.h"
32 #include "content/browser/tab_contents/tab_contents.h" 32 #include "content/browser/tab_contents/tab_contents.h"
33 #include "content/browser/user_metrics.h"
34 #include "content/public/browser/browser_thread.h" 33 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/user_metrics.h"
35 #include "grit/browser_resources.h" 35 #include "grit/browser_resources.h"
36 #include "grit/generated_resources.h" 36 #include "grit/generated_resources.h"
37 #include "grit/locale_settings.h" 37 #include "grit/locale_settings.h"
38 #include "net/base/escape.h" 38 #include "net/base/escape.h"
39 #include "ui/base/l10n/l10n_util.h" 39 #include "ui/base/l10n/l10n_util.h"
40 #include "ui/base/resource/resource_bundle.h" 40 #include "ui/base/resource/resource_bundle.h"
41 41
42 using content::BrowserThread; 42 using content::BrowserThread;
43 using content::UserMetricsAction;
43 44
44 // For malware interstitial pages, we link the problematic URL to Google's 45 // For malware interstitial pages, we link the problematic URL to Google's
45 // diagnostic page. 46 // diagnostic page.
46 #if defined(GOOGLE_CHROME_BUILD) 47 #if defined(GOOGLE_CHROME_BUILD)
47 static const char* const kSbDiagnosticUrl = 48 static const char* const kSbDiagnosticUrl =
48 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=googlechrome"; 49 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=googlechrome";
49 #else 50 #else
50 static const char* const kSbDiagnosticUrl = 51 static const char* const kSbDiagnosticUrl =
51 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=chromium"; 52 "http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=%s&clie nt=chromium";
52 #endif 53 #endif
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 case PROCEED: 620 case PROCEED:
620 action.append("Proceed"); 621 action.append("Proceed");
621 break; 622 break;
622 case DONT_PROCEED: 623 case DONT_PROCEED:
623 action.append("DontProceed"); 624 action.append("DontProceed");
624 break; 625 break;
625 default: 626 default:
626 NOTREACHED() << "Unexpected event: " << event; 627 NOTREACHED() << "Unexpected event: " << event;
627 } 628 }
628 629
629 UserMetrics::RecordComputedAction(action); 630 content::RecordComputedAction(action);
630 } 631 }
631 632
632 void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) { 633 void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) {
633 if (malware_details_ == NULL) 634 if (malware_details_ == NULL)
634 return; // Not all interstitials have malware details (eg phishing). 635 return; // Not all interstitials have malware details (eg phishing).
635 636
636 Profile* profile = Profile::FromBrowserContext(tab()->browser_context()); 637 Profile* profile = Profile::FromBrowserContext(tab()->browser_context());
637 const PrefService::Preference* pref = 638 const PrefService::Preference* pref =
638 profile->GetPrefs()->FindPreference(prefs::kSafeBrowsingReportingEnabled); 639 profile->GetPrefs()->FindPreference(prefs::kSafeBrowsingReportingEnabled);
639 640
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // Client-side phishing detection interstitials never block the main frame 708 // Client-side phishing detection interstitials never block the main frame
708 // load, since they happen after the page is finished loading. 709 // load, since they happen after the page is finished loading.
709 if (unsafe_resources[0].threat_type == 710 if (unsafe_resources[0].threat_type ==
710 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) { 711 SafeBrowsingService::CLIENT_SIDE_PHISHING_URL) {
711 return false; 712 return false;
712 } 713 }
713 714
714 // Otherwise, check the threat type. 715 // Otherwise, check the threat type.
715 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; 716 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource;
716 } 717 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | chrome/browser/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698