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

Side by Side Diff: chrome/browser/search_engines/search_host_to_urls_map.h

Issue 7558014: Add a URL param to indicate group selection in Instant field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Thread safe handling of Profiles Created 9 years, 4 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 15
16 class Profile;
16 class SearchTermsData; 17 class SearchTermsData;
17 class TemplateURL; 18 class TemplateURL;
18 19
19 // Holds the host to template url mappings for the search providers. WARNING: 20 // Holds the host to template url mappings for the search providers. WARNING:
20 // This class does not own any TemplateURLs passed to it and it is up to the 21 // This class does not own any TemplateURLs passed to it and it is up to the
21 // caller to ensure the right lifetime of them. 22 // caller to ensure the right lifetime of them.
22 class SearchHostToURLsMap { 23 class SearchHostToURLsMap {
23 public: 24 public:
24 typedef std::set<const TemplateURL*> TemplateURLSet; 25 typedef std::set<const TemplateURL*> TemplateURLSet;
25 26
26 SearchHostToURLsMap(); 27 SearchHostToURLsMap();
27 ~SearchHostToURLsMap(); 28 ~SearchHostToURLsMap();
28 29
29 // Initializes the map. 30 // Initializes the map.
30 void Init(const std::vector<const TemplateURL*>& template_urls, 31 void Init(const std::vector<const TemplateURL*>& template_urls,
31 const SearchTermsData& search_terms_data); 32 const SearchTermsData& search_terms_data);
32 33
33 // Adds a new TemplateURL to the map. Since |template_url| is owned 34 // Adds a new TemplateURL to the map. Since |template_url| is owned
34 // externally, Remove or RemoveAll should be called if it becomes invalid. 35 // externally, Remove or RemoveAll should be called if it becomes invalid.
35 void Add(const TemplateURL* template_url, 36 void Add(const TemplateURL* template_url,
36 const SearchTermsData& search_terms_data); 37 const SearchTermsData& search_terms_data);
37 38
38 // Removes the TemplateURL from the lookup. 39 // Removes the TemplateURL from the lookup.
39 void Remove(const TemplateURL* template_url); 40 void Remove(const TemplateURL* template_url, Profile* profile);
40 41
41 // Updates information in an existing TemplateURL. Note: Using Remove and 42 // Updates information in an existing TemplateURL. Note: Using Remove and
42 // then Add separately would lead to race conditions in reading because the 43 // then Add separately would lead to race conditions in reading because the
43 // lock would be released inbetween the calls. 44 // lock would be released inbetween the calls.
44 void Update(const TemplateURL* existing_turl, 45 void Update(const TemplateURL* existing_turl,
45 const TemplateURL& new_values, 46 const TemplateURL& new_values,
46 const SearchTermsData& search_terms_data); 47 const SearchTermsData& search_terms_data,
48 Profile* profile);
47 49
48 // Updates all search providers which have a google base url. 50 // Updates all search providers which have a google base url.
49 void UpdateGoogleBaseURLs(const SearchTermsData& search_terms_data); 51 void UpdateGoogleBaseURLs(const SearchTermsData& search_terms_data);
50 52
51 // Returns the first TemplateURL found with a URL using the specified |host|, 53 // Returns the first TemplateURL found with a URL using the specified |host|,
52 // or NULL if there are no such TemplateURLs 54 // or NULL if there are no such TemplateURLs
53 const TemplateURL* GetTemplateURLForHost(const std::string& host) const; 55 const TemplateURL* GetTemplateURLForHost(const std::string& host) const;
54 56
55 // Return the TemplateURLSet for the given the |host| or NULL if there are 57 // Return the TemplateURLSet for the given the |host| or NULL if there are
56 // none. 58 // none.
(...skipping 15 matching lines...) Expand all
72 // The security origin for the default search provider. 74 // The security origin for the default search provider.
73 std::string default_search_origin_; 75 std::string default_search_origin_;
74 76
75 // Has Init been called? 77 // Has Init been called?
76 bool initialized_; 78 bool initialized_;
77 79
78 DISALLOW_COPY_AND_ASSIGN(SearchHostToURLsMap); 80 DISALLOW_COPY_AND_ASSIGN(SearchHostToURLsMap);
79 }; 81 };
80 82
81 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_ 83 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698