OLD | NEW |
1 // Copyright (c) 2011 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_TERMS_DATA_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 // All data needed by TemplateURLRef::ReplaceSearchTerms which typically may | 13 // All data needed by TemplateURLRef::ReplaceSearchTerms which typically may |
14 // only be accessed on the UI thread. | 14 // only be accessed on the UI thread. |
15 class SearchTermsData { | 15 class SearchTermsData { |
16 public: | 16 public: |
17 SearchTermsData(); | 17 SearchTermsData(); |
18 virtual ~SearchTermsData(); | 18 virtual ~SearchTermsData(); |
19 | 19 |
20 // Returns the value for the GOOGLE_BASE_SUGGEST_URL term. | 20 // Returns the value for the GOOGLE_BASE_SUGGEST_URL term. |
21 std::string GoogleBaseSuggestURLValue() const; | 21 std::string GoogleBaseSuggestURLValue() const; |
22 | 22 |
23 // Returns the value to use for replacements of type GOOGLE_BASE_URL. | 23 // Returns the value to use for replacements of type GOOGLE_BASE_URL. |
24 virtual std::string GoogleBaseURLValue() const = 0; | 24 virtual std::string GoogleBaseURLValue() const = 0; |
25 | 25 |
26 // Returns the locale used by the application. | 26 // Returns the locale used by the application. |
27 virtual std::string GetApplicationLocale() const = 0; | 27 virtual std::string GetApplicationLocale() const = 0; |
28 | 28 |
29 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 29 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
30 // Returns the value for the Chrome Omnibox rlz. | 30 // Returns the value for the Chrome Omnibox rlz. |
31 virtual string16 GetRlzParameterValue() const = 0; | 31 virtual std::wstring GetRlzParameterValue() const = 0; |
32 #endif | 32 #endif |
33 | 33 |
34 private: | 34 private: |
35 DISALLOW_COPY_AND_ASSIGN(SearchTermsData); | 35 DISALLOW_COPY_AND_ASSIGN(SearchTermsData); |
36 }; | 36 }; |
37 | 37 |
38 // Implementation of SearchTermsData that is only usable on the UI thread. | 38 // Implementation of SearchTermsData that is only usable on the UI thread. |
39 class UIThreadSearchTermsData : public SearchTermsData { | 39 class UIThreadSearchTermsData : public SearchTermsData { |
40 public: | 40 public: |
41 UIThreadSearchTermsData(); | 41 UIThreadSearchTermsData(); |
42 | 42 |
43 // Implementation of SearchTermsData. | 43 // Implementation of SearchTermsData. |
44 virtual std::string GoogleBaseURLValue() const; | 44 virtual std::string GoogleBaseURLValue() const; |
45 virtual std::string GetApplicationLocale() const; | 45 virtual std::string GetApplicationLocale() const; |
46 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 46 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
47 virtual string16 GetRlzParameterValue() const; | 47 virtual std::wstring GetRlzParameterValue() const; |
48 #endif | 48 #endif |
49 | 49 |
50 // Used by tests to set the value for the Google base url. This takes | 50 // Used by tests to set the value for the Google base url. This takes |
51 // ownership of the given std::string. | 51 // ownership of the given std::string. |
52 static void SetGoogleBaseURL(std::string* google_base_url); | 52 static void SetGoogleBaseURL(std::string* google_base_url); |
53 | 53 |
54 private: | 54 private: |
55 static std::string* google_base_url_; | 55 static std::string* google_base_url_; |
56 | 56 |
57 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData); | 57 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData); |
58 }; | 58 }; |
59 | 59 |
60 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ | 60 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ |
OLD | NEW |