diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-28 18:34:56 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-28 18:34:56 +0000 |
commit | cafe4ad25440a7752f5a4d230adf29b16a4766b0 (patch) | |
tree | 125f3d638cbaf3a3db61c91904c0eddae1e8ad34 /chrome/browser/safe_browsing | |
parent | 96561cb87ad2679df630ddc0d1561949d78bbcff (diff) | |
download | chromium_src-cafe4ad25440a7752f5a4d230adf29b16a4766b0.zip chromium_src-cafe4ad25440a7752f5a4d230adf29b16a4766b0.tar.gz chromium_src-cafe4ad25440a7752f5a4d230adf29b16a4766b0.tar.bz2 |
Removal of Profile from content part 3.
BUG=76788
TEST=no change visible
Review URL: http://codereview.chromium.org/7522018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
5 files changed, 18 insertions, 10 deletions
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor.cc b/chrome/browser/safe_browsing/browser_feature_extractor.cc index 3a65a01..4d8a48f 100644 --- a/chrome/browser/safe_browsing/browser_feature_extractor.cc +++ b/chrome/browser/safe_browsing/browser_feature_extractor.cc @@ -430,8 +430,9 @@ bool BrowserFeatureExtractor::GetPendingQuery( bool BrowserFeatureExtractor::GetHistoryService(HistoryService** history) { *history = NULL; - if (tab_ && tab_->profile()) { - *history = tab_->profile()->GetHistoryService(Profile::EXPLICIT_ACCESS); + if (tab_ && tab_->browser_context()) { + Profile* profile = Profile::FromBrowserContext(tab_->browser_context()); + *history = profile->GetHistoryService(Profile::EXPLICIT_ACCESS); if (*history) { return true; } @@ -439,4 +440,5 @@ bool BrowserFeatureExtractor::GetHistoryService(HistoryService** history) { VLOG(2) << "Unable to query history. No history service available."; return false; } + }; // namespace safe_browsing diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc index 2224d7c..d88f8ab 100644 --- a/chrome/browser/safe_browsing/client_side_detection_host.cc +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc @@ -106,7 +106,7 @@ class ClientSideDetectionHost::ShouldClassifyUrlRequest } // Don't run the phishing classifier if the tab is incognito. - if (tab_contents_->profile()->IsOffTheRecord()) { + if (tab_contents_->browser_context()->IsOffTheRecord()) { VLOG(1) << "Skipping phishing classification for URL: " << params_.url << " because we're browsing incognito."; UMA_HISTOGRAM_ENUMERATION("SBClientPhishing.PreClassificationCheckFail", diff --git a/chrome/browser/safe_browsing/malware_details.cc b/chrome/browser/safe_browsing/malware_details.cc index decf24b..d8edb23 100644 --- a/chrome/browser/safe_browsing/malware_details.cc +++ b/chrome/browser/safe_browsing/malware_details.cc @@ -74,12 +74,13 @@ MalwareDetails::MalwareDetails( TabContents* tab_contents, const SafeBrowsingService::UnsafeResource& resource) : TabContentsObserver(tab_contents), - request_context_getter_(tab_contents->profile()->GetRequestContext()), + profile_(Profile::FromBrowserContext(tab_contents->browser_context())), + request_context_getter_(profile_->GetRequestContext()), sb_service_(sb_service), resource_(resource), cache_collector_(new MalwareDetailsCacheCollector), redirects_collector_( - new MalwareDetailsRedirectsCollector(tab_contents->profile())) { + new MalwareDetailsRedirectsCollector(profile_)) { StartCollection(); } diff --git a/chrome/browser/safe_browsing/malware_details.h b/chrome/browser/safe_browsing/malware_details.h index d4036c6..2f49df3 100644 --- a/chrome/browser/safe_browsing/malware_details.h +++ b/chrome/browser/safe_browsing/malware_details.h @@ -31,6 +31,7 @@ struct SafeBrowsingHostMsg_MalwareDOMDetails_Node; class MalwareDetailsCacheCollector; class MalwareDetailsRedirectsCollector; class MalwareDetailsFactory; +class Profile; namespace safe_browsing { // Maps a URL to its Resource. @@ -81,6 +82,8 @@ class MalwareDetails : public base::RefCountedThreadSafe<MalwareDetails>, virtual void AddDOMDetails( const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params); + Profile* profile_; + // The report protocol buffer. scoped_ptr<safe_browsing::ClientMalwareReportRequest> report_; diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index b0c4999..8ddc4ed 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -161,7 +161,7 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( } bool SafeBrowsingBlockingPage::CanShowMalwareDetailsOption() { - return (!tab()->profile()->IsOffTheRecord() && + return (!tab()->browser_context()->IsOffTheRecord() && tab()->GetURL().SchemeIs(chrome::kHttpScheme)); } @@ -364,8 +364,9 @@ void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary( IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE, UTF8ToUTF16(privacy_link))); + Profile* profile = Profile::FromBrowserContext(tab()->browser_context()); const PrefService::Preference* pref = - tab()->profile()->GetPrefs()->FindPreference( + profile->GetPrefs()->FindPreference( prefs::kSafeBrowsingReportingEnabled); bool value; @@ -509,7 +510,8 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { } void SafeBrowsingBlockingPage::SetReportingPreference(bool report) { - PrefService* pref = tab()->profile()->GetPrefs(); + Profile* profile = Profile::FromBrowserContext(tab()->browser_context()); + PrefService* pref = profile->GetPrefs(); pref->SetBoolean(prefs::kSafeBrowsingReportingEnabled, report); } @@ -626,9 +628,9 @@ void SafeBrowsingBlockingPage::FinishMalwareDetails(int64 delay_ms) { if (malware_details_ == NULL) return; // Not all interstitials have malware details (eg phishing). + Profile* profile = Profile::FromBrowserContext(tab()->browser_context()); const PrefService::Preference* pref = - tab()->profile()->GetPrefs()->FindPreference( - prefs::kSafeBrowsingReportingEnabled); + profile->GetPrefs()->FindPreference(prefs::kSafeBrowsingReportingEnabled); bool value; if (pref && pref->GetValue()->GetAsBoolean(&value) && value) { |