| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/compiler_specific.h" |
| 12 #include "base/string16.h" | 13 #include "base/string16.h" |
| 13 | 14 |
| 14 class Profile; | 15 class Profile; |
| 15 | 16 |
| 16 // All data needed by TemplateURLRef::ReplaceSearchTerms which typically may | 17 // All data needed by TemplateURLRef::ReplaceSearchTerms which typically may |
| 17 // only be accessed on the UI thread. | 18 // only be accessed on the UI thread. |
| 18 class SearchTermsData { | 19 class SearchTermsData { |
| 19 public: | 20 public: |
| 20 SearchTermsData(); | 21 SearchTermsData(); |
| 21 virtual ~SearchTermsData(); | 22 virtual ~SearchTermsData(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 48 // Implementation of SearchTermsData that is only usable on the UI thread. | 49 // Implementation of SearchTermsData that is only usable on the UI thread. |
| 49 class UIThreadSearchTermsData : public SearchTermsData { | 50 class UIThreadSearchTermsData : public SearchTermsData { |
| 50 public: | 51 public: |
| 51 UIThreadSearchTermsData(); | 52 UIThreadSearchTermsData(); |
| 52 | 53 |
| 53 // Callers who need an accurate answer from InstantFieldTrialUrlParam() must | 54 // Callers who need an accurate answer from InstantFieldTrialUrlParam() must |
| 54 // set the profile here before calling that. | 55 // set the profile here before calling that. |
| 55 void set_profile(Profile* profile) { profile_ = profile; } | 56 void set_profile(Profile* profile) { profile_ = profile; } |
| 56 | 57 |
| 57 // Implementation of SearchTermsData. | 58 // Implementation of SearchTermsData. |
| 58 virtual std::string GoogleBaseURLValue() const; | 59 virtual std::string GoogleBaseURLValue() const OVERRIDE; |
| 59 virtual std::string GetApplicationLocale() const; | 60 virtual std::string GetApplicationLocale() const OVERRIDE; |
| 60 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 61 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
| 61 virtual string16 GetRlzParameterValue() const; | 62 virtual string16 GetRlzParameterValue() const OVERRIDE; |
| 62 #endif | 63 #endif |
| 63 | 64 |
| 64 // This returns the empty string unless set_profile() has been called with a | 65 // This returns the empty string unless set_profile() has been called with a |
| 65 // non-NULL Profile. | 66 // non-NULL Profile. |
| 66 virtual std::string InstantFieldTrialUrlParam() const; | 67 virtual std::string InstantFieldTrialUrlParam() const OVERRIDE; |
| 67 | 68 |
| 68 // Used by tests to set the value for the Google base url. This takes | 69 // Used by tests to set the value for the Google base url. This takes |
| 69 // ownership of the given std::string. | 70 // ownership of the given std::string. |
| 70 static void SetGoogleBaseURL(std::string* google_base_url); | 71 static void SetGoogleBaseURL(std::string* google_base_url); |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 static std::string* google_base_url_; | 74 static std::string* google_base_url_; |
| 74 Profile* profile_; | 75 Profile* profile_; |
| 75 | 76 |
| 76 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData); | 77 DISALLOW_COPY_AND_ASSIGN(UIThreadSearchTermsData); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ | 80 #endif // CHROME_BROWSER_SEARCH_ENGINES_SEARCH_TERMS_DATA_H_ |
| OLD | NEW |