OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_TEMPLATE_URL_H__ | 5 #ifndef CHROME_BROWSER_TEMPLATE_URL_H__ |
6 #define CHROME_BROWSER_TEMPLATE_URL_H__ | 6 #define CHROME_BROWSER_TEMPLATE_URL_H__ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "chrome/common/l10n_util.h" | |
13 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
14 | 13 |
15 class TemplateURL; | 14 class TemplateURL; |
16 | 15 |
17 // TemplateURL represents the relevant portions of the Open Search Description | 16 // TemplateURL represents the relevant portions of the Open Search Description |
18 // Document (http://www.opensearch.org/Specifications/OpenSearch). | 17 // Document (http://www.opensearch.org/Specifications/OpenSearch). |
19 // The main use case for TemplateURL is to use the TemplateURLRef returned by | 18 // The main use case for TemplateURL is to use the TemplateURLRef returned by |
20 // suggestions_url or url for keyword/suggestion expansion: | 19 // suggestions_url or url for keyword/suggestion expansion: |
21 // . suggestions_url describes a URL that is ideal for as you type suggestions. | 20 // . suggestions_url describes a URL that is ideal for as you type suggestions. |
22 // The returned results are in the mime type application/x-suggestions+json. | 21 // The returned results are in the mime type application/x-suggestions+json. |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 return &url_; | 299 return &url_; |
301 } | 300 } |
302 | 301 |
303 // URL to the OSD file this came from. May be empty. | 302 // URL to the OSD file this came from. May be empty. |
304 void set_originating_url(const GURL& url) { | 303 void set_originating_url(const GURL& url) { |
305 originating_url_ = url; | 304 originating_url_ = url; |
306 } | 305 } |
307 const GURL& originating_url() const { return originating_url_; } | 306 const GURL& originating_url() const { return originating_url_; } |
308 | 307 |
309 // The shortcut for this template url. May be empty. | 308 // The shortcut for this template url. May be empty. |
310 void set_keyword(const std::wstring& keyword) { | 309 void set_keyword(const std::wstring& keyword); |
311 // Case sensitive keyword matching is confusing. As such, we force all | |
312 // keywords to be lower case. | |
313 keyword_ = l10n_util::ToLower(keyword); | |
314 autogenerate_keyword_ = false; | |
315 } | |
316 const std::wstring& keyword() const; | 310 const std::wstring& keyword() const; |
317 | 311 |
318 // Whether to autogenerate a keyword from the url() in GetKeyword(). Most | 312 // Whether to autogenerate a keyword from the url() in GetKeyword(). Most |
319 // consumers should not need this. | 313 // consumers should not need this. |
320 // NOTE: Calling set_keyword() turns this back off. Manual and automatic | 314 // NOTE: Calling set_keyword() turns this back off. Manual and automatic |
321 // keywords are mutually exclusive. | 315 // keywords are mutually exclusive. |
322 void set_autogenerate_keyword(bool autogenerate_keyword) { | 316 void set_autogenerate_keyword(bool autogenerate_keyword) { |
323 autogenerate_keyword_ = autogenerate_keyword; | 317 autogenerate_keyword_ = autogenerate_keyword; |
324 if (autogenerate_keyword_) | 318 if (autogenerate_keyword_) |
325 keyword_.clear(); | 319 keyword_.clear(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 IDType id_; | 427 IDType id_; |
434 Time date_created_; | 428 Time date_created_; |
435 int usage_count_; | 429 int usage_count_; |
436 int prepopulate_id_; | 430 int prepopulate_id_; |
437 | 431 |
438 // TODO(sky): Add date last parsed OSD file. | 432 // TODO(sky): Add date last parsed OSD file. |
439 }; | 433 }; |
440 | 434 |
441 #endif // CHROME_BROWSER_TEMPLATE_URL_PARSER_H__ | 435 #endif // CHROME_BROWSER_TEMPLATE_URL_PARSER_H__ |
442 | 436 |
OLD | NEW |