OLD | NEW |
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> |
(...skipping 20 matching lines...) Expand all Loading... |
31 const SearchTermsData& search_terms_data); | 31 const SearchTermsData& search_terms_data); |
32 | 32 |
33 // Adds a new TemplateURL to the map. Since |template_url| is owned | 33 // Adds a new TemplateURL to the map. Since |template_url| is owned |
34 // externally, Remove or RemoveAll should be called if it becomes invalid. | 34 // externally, Remove or RemoveAll should be called if it becomes invalid. |
35 void Add(const TemplateURL* template_url, | 35 void Add(const TemplateURL* template_url, |
36 const SearchTermsData& search_terms_data); | 36 const SearchTermsData& search_terms_data); |
37 | 37 |
38 // Removes the TemplateURL from the lookup. | 38 // Removes the TemplateURL from the lookup. |
39 void Remove(const TemplateURL* template_url); | 39 void Remove(const TemplateURL* template_url); |
40 | 40 |
41 // Updates information in an existing TemplateURL. Note: Using Remove and | |
42 // then Add separately would lead to race conditions in reading because the | |
43 // lock would be released inbetween the calls. | |
44 void Update(const TemplateURL* existing_turl, | |
45 const TemplateURL& new_values, | |
46 const SearchTermsData& search_terms_data); | |
47 | |
48 // Updates all search providers which have a google base url. | 41 // Updates all search providers which have a google base url. |
49 void UpdateGoogleBaseURLs(const SearchTermsData& search_terms_data); | 42 void UpdateGoogleBaseURLs(const SearchTermsData& search_terms_data); |
50 | 43 |
51 // Returns the first TemplateURL found with a URL using the specified |host|, | 44 // Returns the first TemplateURL found with a URL using the specified |host|, |
52 // or NULL if there are no such TemplateURLs | 45 // or NULL if there are no such TemplateURLs |
53 const TemplateURL* GetTemplateURLForHost(const std::string& host) const; | 46 const TemplateURL* GetTemplateURLForHost(const std::string& host) const; |
54 | 47 |
55 // Return the TemplateURLSet for the given the |host| or NULL if there are | 48 // Return the TemplateURLSet for the given the |host| or NULL if there are |
56 // none. | 49 // none. |
57 const TemplateURLSet* GetURLsForHost(const std::string& host) const; | 50 const TemplateURLSet* GetURLsForHost(const std::string& host) const; |
(...skipping 14 matching lines...) Expand all Loading... |
72 // The security origin for the default search provider. | 65 // The security origin for the default search provider. |
73 std::string default_search_origin_; | 66 std::string default_search_origin_; |
74 | 67 |
75 // Has Init been called? | 68 // Has Init been called? |
76 bool initialized_; | 69 bool initialized_; |
77 | 70 |
78 DISALLOW_COPY_AND_ASSIGN(SearchHostToURLsMap); | 71 DISALLOW_COPY_AND_ASSIGN(SearchHostToURLsMap); |
79 }; | 72 }; |
80 | 73 |
81 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_ | 74 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_HOST_TO_URLS_MAP_H_ |
OLD | NEW |