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

Side by Side Diff: components/search_engines/template_url_data.h

Issue 1983773002: Cache SearchEngineType of TemplateURL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-extracting-terms-from-template-url
Patch Set: Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_ 5 #ifndef COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_
6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_ 6 #define COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "components/search_engines/search_engine_type.h"
13 #include "components/search_engines/template_url_id.h" 14 #include "components/search_engines/template_url_id.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 // The data for the TemplateURL. Separating this into its own class allows most 17 // The data for the TemplateURL. Separating this into its own class allows most
17 // users to do SSA-style usage of TemplateURL: construct a TemplateURLData with 18 // users to do SSA-style usage of TemplateURL: construct a TemplateURLData with
18 // whatever fields are desired, then create an immutable TemplateURL from it. 19 // whatever fields are desired, then create an immutable TemplateURL from it.
19 struct TemplateURLData { 20 struct TemplateURLData {
20 TemplateURLData(); 21 TemplateURLData();
21 TemplateURLData(const TemplateURLData& other); 22 TemplateURLData(const TemplateURLData& other);
22 ~TemplateURLData(); 23 ~TemplateURLData();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // group policy. 93 // group policy.
93 bool created_by_policy; 94 bool created_by_policy;
94 95
95 // Number of times this TemplateURL has been explicitly used to load a URL. 96 // Number of times this TemplateURL has been explicitly used to load a URL.
96 // We don't increment this for uses as the "default search engine" since 97 // We don't increment this for uses as the "default search engine" since
97 // that's not really "explicit" usage and incrementing would result in pinning 98 // that's not really "explicit" usage and incrementing would result in pinning
98 // the user's default search engine(s) to the top of the list of searches on 99 // the user's default search engine(s) to the top of the list of searches on
99 // the New Tab page, de-emphasizing the omnibox as "where you go to search". 100 // the New Tab page, de-emphasizing the omnibox as "where you go to search".
100 int usage_count; 101 int usage_count;
101 102
103 // The type of the search engine.
104 SearchEngineType engine_type;
105
102 // If this TemplateURL comes from prepopulated data the prepopulate_id is > 0. 106 // If this TemplateURL comes from prepopulated data the prepopulate_id is > 0.
103 int prepopulate_id; 107 int prepopulate_id;
104 108
105 // The primary unique identifier for Sync. This set on all TemplateURLs 109 // The primary unique identifier for Sync. This set on all TemplateURLs
106 // regardless of whether they have been associated with Sync. 110 // regardless of whether they have been associated with Sync.
107 std::string sync_guid; 111 std::string sync_guid;
108 112
109 // A list of URL patterns that can be used, in addition to |url_|, to extract 113 // A list of URL patterns that can be used, in addition to |url_|, to extract
110 // search terms from a URL. 114 // search terms from a URL.
111 std::vector<std::string> alternate_urls; 115 std::vector<std::string> alternate_urls;
112 116
113 // A parameter that, if present in the query or ref parameters of a search_url 117 // A parameter that, if present in the query or ref parameters of a search_url
114 // or instant_url, causes Chrome to replace the URL with the search term. 118 // or instant_url, causes Chrome to replace the URL with the search term.
115 std::string search_terms_replacement_key; 119 std::string search_terms_replacement_key;
116 120
117 private: 121 private:
118 // Private so we can enforce using the setters and thus enforce that these 122 // Private so we can enforce using the setters and thus enforce that these
119 // fields are never empty. 123 // fields are never empty.
120 base::string16 short_name_; 124 base::string16 short_name_;
121 base::string16 keyword_; 125 base::string16 keyword_;
122 std::string url_; 126 std::string url_;
123 }; 127 };
124 128
125 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_ 129 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698