OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/safe_browsing/srt_client_info_win.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "chrome/browser/profiles/profile.h" | |
9 #include "chrome/browser/ui/browser.h" | |
10 #include "chrome/browser/ui/browser_list.h" | |
11 #include "chrome/common/channel_info.h" | |
12 #include "components/safe_browsing_db/safe_browsing_prefs.h" | |
13 #include "components/version_info/version_info.h" | |
14 | |
15 namespace safe_browsing { | |
16 | |
17 namespace { | |
18 | |
19 bool SafeBrowsingExtendedEnabledForBrowser(const Browser* browser) { | |
20 const Profile* profile = browser->profile(); | |
21 return profile && !profile->IsOffTheRecord() && | |
22 IsExtendedReportingEnabled(*profile->GetPrefs()); | |
23 } | |
24 | |
25 } // namespace | |
26 | |
27 int ChannelAsInt() { | |
28 switch (chrome::GetChannel()) { | |
29 case version_info::Channel::UNKNOWN: | |
30 return 0; | |
31 case version_info::Channel::CANARY: | |
32 return 1; | |
33 case version_info::Channel::DEV: | |
34 return 2; | |
35 case version_info::Channel::BETA: | |
36 return 3; | |
37 case version_info::Channel::STABLE: | |
38 return 4; | |
39 } | |
40 NOTREACHED(); | |
41 return 0; | |
42 } | |
43 | |
44 bool SafeBrowsingExtendedReportingEnabled() { | |
45 BrowserList* browser_list = BrowserList::GetInstance(); | |
46 return std::any_of(browser_list->begin_last_active(), | |
47 browser_list->end_last_active(), | |
48 &SafeBrowsingExtendedEnabledForBrowser); | |
49 } | |
50 | |
51 } // namespace safe_browsing | |
OLD | NEW |