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

Side by Side Diff: net/base/registry_controlled_domain.h

Issue 6085013: Start reordering the methods in headers in net/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 //* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1 //* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK ***** 2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * 4 *
5 * The contents of this file are subject to the Mozilla Public License Version 5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with 6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at 7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/ 8 * http://www.mozilla.org/MPL/
9 * 9 *
10 * Software distributed under the License is distributed on an "AS IS" basis, 10 * Software distributed under the License is distributed on an "AS IS" basis,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 bool allow_unknown_registries); 197 bool allow_unknown_registries);
198 static size_t GetRegistryLength(const std::wstring& host, 198 static size_t GetRegistryLength(const std::wstring& host,
199 bool allow_unknown_registries); 199 bool allow_unknown_registries);
200 200
201 // Returns the singleton instance, after attempting to initialize it. 201 // Returns the singleton instance, after attempting to initialize it.
202 // NOTE that if the effective-TLD data resource can't be found, the instance 202 // NOTE that if the effective-TLD data resource can't be found, the instance
203 // will be initialized and continue operation with simple default TLD data. 203 // will be initialized and continue operation with simple default TLD data.
204 static RegistryControlledDomainService* GetInstance(); 204 static RegistryControlledDomainService* GetInstance();
205 205
206 protected: 206 protected:
207 typedef const struct DomainRule* (*FindDomainPtr)(const char *, unsigned int);
208
207 // The entire protected API is only for unit testing. I mean it. Don't make 209 // The entire protected API is only for unit testing. I mean it. Don't make
208 // me come over there! 210 // me come over there!
209 RegistryControlledDomainService(); 211 RegistryControlledDomainService();
210 212
211 // Set the RegistryControledDomainService instance to be used internally. 213 // Set the RegistryControledDomainService instance to be used internally.
212 // |instance| will supersede the singleton instance normally used. If 214 // |instance| will supersede the singleton instance normally used. If
213 // |instance| is NULL, normal behavior is restored, and internal operations 215 // |instance| is NULL, normal behavior is restored, and internal operations
214 // will return to using the singleton. This function always returns the 216 // will return to using the singleton. This function always returns the
215 // instance set by the most recent call to SetInstance. 217 // instance set by the most recent call to SetInstance.
216 static RegistryControlledDomainService* SetInstance( 218 static RegistryControlledDomainService* SetInstance(
217 RegistryControlledDomainService* instance); 219 RegistryControlledDomainService* instance);
218 220
219 typedef const struct DomainRule* (*FindDomainPtr)(const char *, unsigned int);
220
221 // Used for unit tests, so that a different perfect hash map from the full 221 // Used for unit tests, so that a different perfect hash map from the full
222 // list is used. 222 // list is used.
223 static void UseFindDomainFunction(FindDomainPtr function); 223 static void UseFindDomainFunction(FindDomainPtr function);
224 224
225 private: 225 private:
226 // To allow construction of the internal singleton instance. 226 // To allow construction of the internal singleton instance.
227 friend struct DefaultSingletonTraits<RegistryControlledDomainService>; 227 friend struct DefaultSingletonTraits<RegistryControlledDomainService>;
228 228
229 // Internal workings of the static public methods. See above. 229 // Internal workings of the static public methods. See above.
230 static std::string GetDomainAndRegistryImpl(const std::string& host); 230 static std::string GetDomainAndRegistryImpl(const std::string& host);
231 size_t GetRegistryLengthImpl(const std::string& host, 231 size_t GetRegistryLengthImpl(const std::string& host,
232 bool allow_unknown_registries); 232 bool allow_unknown_registries);
233 233
234 // Function that returns a DomainRule given a domain. 234 // Function that returns a DomainRule given a domain.
235 FindDomainPtr find_domain_function_; 235 FindDomainPtr find_domain_function_;
236 236
237 DISALLOW_COPY_AND_ASSIGN(RegistryControlledDomainService); 237 DISALLOW_COPY_AND_ASSIGN(RegistryControlledDomainService);
238 }; 238 };
239 239
240 } // namespace net 240 } // namespace net
241 241
242 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAIN_H_ 242 #endif // NET_BASE_REGISTRY_CONTROLLED_DOMAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698