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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 years 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
« no previous file with comments | « chrome/browser/intranet_redirect_detector.h ('k') | chrome/browser/io_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 // static 50 // static
51 GURL IntranetRedirectDetector::RedirectOrigin() { 51 GURL IntranetRedirectDetector::RedirectOrigin() {
52 const IntranetRedirectDetector* const detector = 52 const IntranetRedirectDetector* const detector =
53 g_browser_process->intranet_redirect_detector(); 53 g_browser_process->intranet_redirect_detector();
54 return detector ? detector->redirect_origin_ : GURL(); 54 return detector ? detector->redirect_origin_ : GURL();
55 } 55 }
56 56
57 // static 57 // static
58 void IntranetRedirectDetector::RegisterPrefs(PrefService* prefs) { 58 void IntranetRedirectDetector::RegisterPrefs(PrefServiceSimple* prefs) {
59 prefs->RegisterStringPref(prefs::kLastKnownIntranetRedirectOrigin, 59 prefs->RegisterStringPref(prefs::kLastKnownIntranetRedirectOrigin,
60 std::string()); 60 std::string());
61 } 61 }
62 62
63 void IntranetRedirectDetector::FinishSleep() { 63 void IntranetRedirectDetector::FinishSleep() {
64 in_sleep_ = false; 64 in_sleep_ = false;
65 65
66 // If another fetch operation is still running, cancel it. 66 // If another fetch operation is still running, cancel it.
67 STLDeleteElements(&fetchers_); 67 STLDeleteElements(&fetchers_);
68 resulting_origins_.clear(); 68 resulting_origins_.clear();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // the same thread. So just use the heuristic that any all-lowercase a-z 173 // the same thread. So just use the heuristic that any all-lowercase a-z
174 // hostname with the right number of characters is likely from the detector 174 // hostname with the right number of characters is likely from the detector
175 // (and thus should be blocked). 175 // (and thus should be blocked).
176 return ((host.length() == IntranetRedirectDetector::kNumCharsInHostnames) && 176 return ((host.length() == IntranetRedirectDetector::kNumCharsInHostnames) &&
177 (host.find_first_not_of("abcdefghijklmnopqrstuvwxyz") == 177 (host.find_first_not_of("abcdefghijklmnopqrstuvwxyz") ==
178 std::string::npos)) ? 178 std::string::npos)) ?
179 net::ERR_NAME_NOT_RESOLVED : 179 net::ERR_NAME_NOT_RESOLVED :
180 ResolveUsingPrevious(host, address_family, host_resolver_flags, addrlist, 180 ResolveUsingPrevious(host, address_family, host_resolver_flags, addrlist,
181 os_error); 181 os_error);
182 } 182 }
OLDNEW
« no previous file with comments | « chrome/browser/intranet_redirect_detector.h ('k') | chrome/browser/io_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698