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

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

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/template_url_id.h" 13 #include "components/search_engines/template_url_id.h"
14 #include "url/gurl.h" 14 #include "url/gurl.h"
15 15
16 // The data for the TemplateURL. Separating this into its own class allows most 16 // 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 17 // users to do SSA-style usage of TemplateURL: construct a TemplateURLData with
18 // whatever fields are desired, then create an immutable TemplateURL from it. 18 // whatever fields are desired, then create an immutable TemplateURL from it.
19 struct TemplateURLData { 19 struct TemplateURLData {
20 TemplateURLData(); 20 TemplateURLData();
21 ~TemplateURLData(); 21 ~TemplateURLData();
22 22
23 // A short description of the template. This is the name we show to the user 23 // A short description of the template. This is the name we show to the user
24 // in various places that use TemplateURLs. For example, the location bar 24 // in various places that use TemplateURLs. For example, the location bar
25 // shows this when the user selects a substituting match. 25 // shows this when the user selects a substituting match.
26 base::string16 short_name; 26 void SetShortName(const base::string16& shortname);
Peter Kasting 2015/05/11 23:53:17 Nit: Call the arg |short_name|
Mark P 2015/05/12 04:37:38 Done.
27 const base::string16& short_name() const { return short_name_; }
27 28
28 // The shortcut for this TemplateURL. |keyword| must be non-empty. 29 // The shortcut for this TemplateURL. |keyword| must be non-empty.
29 void SetKeyword(const base::string16& keyword); 30 void SetKeyword(const base::string16& keyword);
30 const base::string16& keyword() const { return keyword_; } 31 const base::string16& keyword() const { return keyword_; }
31 32
32 // The raw URL for the TemplateURL, which may not be valid as-is (e.g. because 33 // The raw URL for the TemplateURL, which may not be valid as-is (e.g. because
33 // it requires substitutions first). This must be non-empty. 34 // it requires substitutions first). This must be non-empty.
34 void SetURL(const std::string& url); 35 void SetURL(const std::string& url);
35 const std::string& url() const { return url_; } 36 const std::string& url() const { return url_; }
36 37
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // search terms from a URL. 109 // search terms from a URL.
109 std::vector<std::string> alternate_urls; 110 std::vector<std::string> alternate_urls;
110 111
111 // A parameter that, if present in the query or ref parameters of a search_url 112 // A parameter that, if present in the query or ref parameters of a search_url
112 // or instant_url, causes Chrome to replace the URL with the search term. 113 // or instant_url, causes Chrome to replace the URL with the search term.
113 std::string search_terms_replacement_key; 114 std::string search_terms_replacement_key;
114 115
115 private: 116 private:
116 // Private so we can enforce using the setters and thus enforce that these 117 // Private so we can enforce using the setters and thus enforce that these
117 // fields are never empty. 118 // fields are never empty.
119 base::string16 short_name_;
118 base::string16 keyword_; 120 base::string16 keyword_;
119 std::string url_; 121 std::string url_;
120 }; 122 };
121 123
122 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_ 124 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_
OLDNEW
« no previous file with comments | « components/search_engines/template_url.cc ('k') | components/search_engines/template_url_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698