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

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

Issue 2812223003: Move shared constants to //components/chrome_cleaner (Closed)
Patch Set: Comment on #endif line Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 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 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_client_info_win.h" 5 #include "chrome/browser/safe_browsing/srt_client_info_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/common/channel_info.h" 11 #include "chrome/common/channel_info.h"
12 #include "components/safe_browsing_db/safe_browsing_prefs.h" 12 #include "components/safe_browsing_db/safe_browsing_prefs.h"
13 #include "components/version_info/version_info.h" 13 #include "components/version_info/version_info.h"
14 14
15 namespace safe_browsing { 15 namespace safe_browsing {
16 16
17 namespace { 17 namespace {
18 18
19 bool SafeBrowsingExtendedEnabledForBrowser(const Browser* browser) { 19 bool SafeBrowsingExtendedEnabledForBrowser(const Browser* browser) {
20 const Profile* profile = browser->profile(); 20 const Profile* profile = browser->profile();
21 return profile && !profile->IsOffTheRecord() && 21 return profile && !profile->IsOffTheRecord() &&
22 IsExtendedReportingEnabled(*profile->GetPrefs()); 22 IsExtendedReportingEnabled(*profile->GetPrefs());
23 } 23 }
24 24
25 } // namespace 25 } // namespace
26 26
27 const char kChromeChannelSwitch[] = "chrome-channel";
28 const char kChromeVersionSwitch[] = "chrome-version";
29 const char kEnableCrashReporting[] = "enable-crash-reporting";
30 const char kExtendedSafeBrowsingEnabledSwitch[] =
31 "extended-safebrowsing-enabled";
32
33 int ChannelAsInt() { 27 int ChannelAsInt() {
34 switch (chrome::GetChannel()) { 28 switch (chrome::GetChannel()) {
35 case version_info::Channel::UNKNOWN: 29 case version_info::Channel::UNKNOWN:
36 return 0; 30 return 0;
37 case version_info::Channel::CANARY: 31 case version_info::Channel::CANARY:
38 return 1; 32 return 1;
39 case version_info::Channel::DEV: 33 case version_info::Channel::DEV:
40 return 2; 34 return 2;
41 case version_info::Channel::BETA: 35 case version_info::Channel::BETA:
42 return 3; 36 return 3;
43 case version_info::Channel::STABLE: 37 case version_info::Channel::STABLE:
44 return 4; 38 return 4;
45 } 39 }
46 NOTREACHED(); 40 NOTREACHED();
47 return 0; 41 return 0;
48 } 42 }
49 43
50 bool SafeBrowsingExtendedReportingEnabled() { 44 bool SafeBrowsingExtendedReportingEnabled() {
51 BrowserList* browser_list = BrowserList::GetInstance(); 45 BrowserList* browser_list = BrowserList::GetInstance();
52 return std::any_of(browser_list->begin_last_active(), 46 return std::any_of(browser_list->begin_last_active(),
53 browser_list->end_last_active(), 47 browser_list->end_last_active(),
54 &SafeBrowsingExtendedEnabledForBrowser); 48 &SafeBrowsingExtendedEnabledForBrowser);
55 } 49 }
56 50
57 } // namespace safe_browsing 51 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698