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

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

Issue 2418813002: [Reland] Refactoring of SBER preference usage (Closed)
Patch Set: Sync Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/srt_fetcher_win.h" 5 #include "chrome/browser/safe_browsing/srt_fetcher_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 26 matching lines...) Expand all
37 #include "chrome/browser/ui/browser_finder.h" 37 #include "chrome/browser/ui/browser_finder.h"
38 #include "chrome/browser/ui/browser_list.h" 38 #include "chrome/browser/ui/browser_list.h"
39 #include "chrome/browser/ui/browser_list_observer.h" 39 #include "chrome/browser/ui/browser_list_observer.h"
40 #include "chrome/browser/ui/global_error/global_error_service.h" 40 #include "chrome/browser/ui/global_error/global_error_service.h"
41 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 41 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
42 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
43 #include "components/component_updater/pref_names.h" 43 #include "components/component_updater/pref_names.h"
44 #include "components/data_use_measurement/core/data_use_user_data.h" 44 #include "components/data_use_measurement/core/data_use_user_data.h"
45 #include "components/prefs/pref_service.h" 45 #include "components/prefs/pref_service.h"
46 #include "components/rappor/rappor_service.h" 46 #include "components/rappor/rappor_service.h"
47 #include "components/safe_browsing_db/safe_browsing_prefs.h"
47 #include "components/variations/net/variations_http_headers.h" 48 #include "components/variations/net/variations_http_headers.h"
48 #include "components/version_info/version_info.h" 49 #include "components/version_info/version_info.h"
49 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
50 #include "net/base/load_flags.h" 51 #include "net/base/load_flags.h"
51 #include "net/http/http_status_code.h" 52 #include "net/http/http_status_code.h"
52 #include "net/url_request/url_fetcher.h" 53 #include "net/url_request/url_fetcher.h"
53 #include "net/url_request/url_fetcher_delegate.h" 54 #include "net/url_request/url_fetcher_delegate.h"
54 #include "net/url_request/url_request_context_getter.h" 55 #include "net/url_request/url_request_context_getter.h"
55 56
56 using content::BrowserThread; 57 using content::BrowserThread;
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 547 }
547 } 548 }
548 } 549 }
549 if (show_bubble) 550 if (show_bubble)
550 global_error->ShowBubbleView(browser); 551 global_error->ShowBubbleView(browser);
551 } 552 }
552 553
553 bool SafeBrowsingExtendedEnabledForBrowser(const Browser* browser) { 554 bool SafeBrowsingExtendedEnabledForBrowser(const Browser* browser) {
554 const Profile* profile = browser->profile(); 555 const Profile* profile = browser->profile();
555 return profile && !profile->IsOffTheRecord() && 556 return profile && !profile->IsOffTheRecord() &&
556 profile->GetPrefs()->GetBoolean( 557 IsExtendedReportingEnabled(*profile->GetPrefs());
557 prefs::kSafeBrowsingExtendedReportingEnabled);
558 } 558 }
559 559
560 // Returns true if there is a profile that is not in incognito mode and the user 560 // Returns true if there is a profile that is not in incognito mode and the user
561 // has opted into Safe Browsing extended reporting. 561 // has opted into Safe Browsing extended reporting.
562 bool SafeBrowsingExtendedReportingEnabled() { 562 bool SafeBrowsingExtendedReportingEnabled() {
563 BrowserList* browser_list = BrowserList::GetInstance(); 563 BrowserList* browser_list = BrowserList::GetInstance();
564 return std::any_of(browser_list->begin_last_active(), 564 return std::any_of(browser_list->begin_last_active(),
565 browser_list->end_last_active(), 565 browser_list->end_last_active(),
566 &SafeBrowsingExtendedEnabledForBrowser); 566 &SafeBrowsingExtendedEnabledForBrowser);
567 } 567 }
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(), 1076 return srt_cleaner_key.Open(HKEY_CURRENT_USER, cleaner_key_path.c_str(),
1077 KEY_QUERY_VALUE) == ERROR_SUCCESS && 1077 KEY_QUERY_VALUE) == ERROR_SUCCESS &&
1078 srt_cleaner_key.GetValueCount() > 0; 1078 srt_cleaner_key.GetValueCount() > 0;
1079 } 1079 }
1080 1080
1081 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) { 1081 void SetSwReporterTestingDelegate(SwReporterTestingDelegate* delegate) {
1082 g_testing_delegate_ = delegate; 1082 g_testing_delegate_ = delegate;
1083 } 1083 }
1084 1084
1085 } // namespace safe_browsing 1085 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/srt_fetcher_browsertest_win.cc ('k') | chrome/browser/safe_browsing/ui_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698