| OLD | NEW |
| 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(const TemplateURLData& other); |
| 21 ~TemplateURLData(); | 22 ~TemplateURLData(); |
| 22 | 23 |
| 23 // A short description of the template. This is the name we show to the user | 24 // 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 | 25 // in various places that use TemplateURLs. For example, the location bar |
| 25 // shows this when the user selects a substituting match. | 26 // shows this when the user selects a substituting match. |
| 26 void SetShortName(const base::string16& short_name); | 27 void SetShortName(const base::string16& short_name); |
| 27 const base::string16& short_name() const { return short_name_; } | 28 const base::string16& short_name() const { return short_name_; } |
| 28 | 29 |
| 29 // The shortcut for this TemplateURL. |keyword| must be non-empty. | 30 // The shortcut for this TemplateURL. |keyword| must be non-empty. |
| 30 void SetKeyword(const base::string16& keyword); | 31 void SetKeyword(const base::string16& keyword); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 116 |
| 116 private: | 117 private: |
| 117 // Private so we can enforce using the setters and thus enforce that these | 118 // Private so we can enforce using the setters and thus enforce that these |
| 118 // fields are never empty. | 119 // fields are never empty. |
| 119 base::string16 short_name_; | 120 base::string16 short_name_; |
| 120 base::string16 keyword_; | 121 base::string16 keyword_; |
| 121 std::string url_; | 122 std::string url_; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_ | 125 #endif // COMPONENTS_SEARCH_ENGINES_TEMPLATE_URL_DATA_H_ |
| OLD | NEW |