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

Side by Side Diff: components/policy/core/browser/browser_policy_connector.cc

Issue 1735863002: Revert "Revert of Reland: No longer start up profile if there was an error fetching policy. (patchs… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « chromeos/chromeos_switches.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/policy/core/browser/browser_policy_connector.h" 5 #include "components/policy/core/browser/browser_policy_connector.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 24 matching lines...) Expand all
35 // The URL for the device management server. 35 // The URL for the device management server.
36 const char kDefaultDeviceManagementServerUrl[] = 36 const char kDefaultDeviceManagementServerUrl[] =
37 "https://m.google.com/devicemanagement/data/api"; 37 "https://m.google.com/devicemanagement/data/api";
38 38
39 39
40 void ReportRegexSuccessMetric(bool success) { 40 void ReportRegexSuccessMetric(bool success) {
41 UMA_HISTOGRAM_BOOLEAN("Enterprise.DomainWhitelistRegexSuccess", success); 41 UMA_HISTOGRAM_BOOLEAN("Enterprise.DomainWhitelistRegexSuccess", success);
42 } 42 }
43 43
44 // Regexes that match many of the larger public email providers as we know 44 // Regexes that match many of the larger public email providers as we know
45 // these users are not from hosted enterprise domains. Keep this list in sync 45 // these users are not from hosted enterprise domains.
46 // with the EnterpriseDomainRegex enum in histograms.xml (i.e. only add things
47 // at the end).
48 const wchar_t* const kNonManagedDomainPatterns[] = { 46 const wchar_t* const kNonManagedDomainPatterns[] = {
49 L"aol\\.com", 47 L"aol\\.com",
50 L"googlemail\\.com", 48 L"googlemail\\.com",
51 L"gmail\\.com", 49 L"gmail\\.com",
52 L"hotmail(\\.co|\\.com|)\\.[^.]+", // hotmail.com, hotmail.it, hotmail.co.uk 50 L"hotmail(\\.co|\\.com|)\\.[^.]+", // hotmail.com, hotmail.it, hotmail.co.uk
53 L"live\\.com", 51 L"live\\.com",
54 L"mail\\.ru", 52 L"mail\\.ru",
55 L"msn\\.com", 53 L"msn\\.com",
56 L"qq\\.com", 54 L"qq\\.com",
57 L"yahoo(\\.co|\\.com|)\\.[^.]+", // yahoo.com, yahoo.co.uk, yahoo.com.tw 55 L"yahoo(\\.co|\\.com|)\\.[^.]+", // yahoo.com, yahoo.co.uk, yahoo.com.tw
58 L"yandex\\.ru", 56 L"yandex\\.ru",
57 L"consumer\\.example\\.com",
59 }; 58 };
60 59
61 // Returns true if |domain| matches the regex |pattern|. 60 // Returns true if |domain| matches the regex |pattern|.
62 bool MatchDomain(const base::string16& domain, const base::string16& pattern, 61 bool MatchDomain(const base::string16& domain, const base::string16& pattern,
63 size_t index) { 62 size_t index) {
64 UErrorCode status = U_ZERO_ERROR; 63 UErrorCode status = U_ZERO_ERROR;
65 const icu::UnicodeString icu_pattern(pattern.data(), pattern.length()); 64 const icu::UnicodeString icu_pattern(pattern.data(), pattern.length());
66 icu::RegexMatcher matcher(icu_pattern, UREGEX_CASE_INSENSITIVE, status); 65 icu::RegexMatcher matcher(icu_pattern, UREGEX_CASE_INSENSITIVE, status);
67 if (!U_SUCCESS(status)) { 66 if (!U_SUCCESS(status)) {
68 // http://crbug.com/365351 - if for some reason the matcher creation fails 67 // http://crbug.com/365351 - if for some reason the matcher creation fails
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 156
158 // static 157 // static
159 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { 158 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) {
160 registry->RegisterIntegerPref( 159 registry->RegisterIntegerPref(
161 policy_prefs::kUserPolicyRefreshRate, 160 policy_prefs::kUserPolicyRefreshRate,
162 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); 161 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs);
163 } 162 }
164 163
165 164
166 } // namespace policy 165 } // namespace policy
OLDNEW
« no previous file with comments | « chromeos/chromeos_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698