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

Side by Side Diff: chrome/browser/intranet_redirect_detector.cc

Issue 6905044: Refactor preference syncing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix syncing of platform specific prefs Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/intranet_redirect_detector.h" 5 #include "chrome/browser/intranet_redirect_detector.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // static 49 // static
50 GURL IntranetRedirectDetector::RedirectOrigin() { 50 GURL IntranetRedirectDetector::RedirectOrigin() {
51 const IntranetRedirectDetector* const detector = 51 const IntranetRedirectDetector* const detector =
52 g_browser_process->intranet_redirect_detector(); 52 g_browser_process->intranet_redirect_detector();
53 return detector ? detector->redirect_origin_ : GURL(); 53 return detector ? detector->redirect_origin_ : GURL();
54 } 54 }
55 55
56 // static 56 // static
57 void IntranetRedirectDetector::RegisterPrefs(PrefService* prefs) { 57 void IntranetRedirectDetector::RegisterPrefs(PrefService* prefs) {
58 prefs->RegisterStringPref(prefs::kLastKnownIntranetRedirectOrigin, 58 prefs->RegisterStringPref(prefs::kLastKnownIntranetRedirectOrigin,
59 std::string()); 59 std::string(),
60 false /* don't sync pref */);
60 } 61 }
61 62
62 void IntranetRedirectDetector::FinishSleep() { 63 void IntranetRedirectDetector::FinishSleep() {
63 in_sleep_ = false; 64 in_sleep_ = false;
64 65
65 // If another fetch operation is still running, cancel it. 66 // If another fetch operation is still running, cancel it.
66 STLDeleteElements(&fetchers_); 67 STLDeleteElements(&fetchers_);
67 resulting_origins_.clear(); 68 resulting_origins_.clear();
68 69
69 // The detector is not needed in Chrome Frame since we have no omnibox there. 70 // The detector is not needed in Chrome Frame since we have no omnibox there.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // the same thread. So just use the heuristic that any all-lowercase a-z 175 // the same thread. So just use the heuristic that any all-lowercase a-z
175 // hostname with the right number of characters is likely from the detector 176 // hostname with the right number of characters is likely from the detector
176 // (and thus should be blocked). 177 // (and thus should be blocked).
177 return ((host.length() == IntranetRedirectDetector::kNumCharsInHostnames) && 178 return ((host.length() == IntranetRedirectDetector::kNumCharsInHostnames) &&
178 (host.find_first_not_of("abcdefghijklmnopqrstuvwxyz") == 179 (host.find_first_not_of("abcdefghijklmnopqrstuvwxyz") ==
179 std::string::npos)) ? 180 std::string::npos)) ?
180 net::ERR_NAME_NOT_RESOLVED : 181 net::ERR_NAME_NOT_RESOLVED :
181 ResolveUsingPrevious(host, address_family, host_resolver_flags, addrlist, 182 ResolveUsingPrevious(host, address_family, host_resolver_flags, addrlist,
182 os_error); 183 os_error);
183 } 184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698