Chromium Code Reviews| Index: chrome/browser/ui/webui/instant_ui.cc |
| diff --git a/chrome/browser/ui/webui/instant_ui.cc b/chrome/browser/ui/webui/instant_ui.cc |
| index e066dc591e91950a6bf18439082ffc4189224acf..e257a6946e6a79c0c096f7223dd7b8871117f5c5 100644 |
| --- a/chrome/browser/ui/webui/instant_ui.cc |
| +++ b/chrome/browser/ui/webui/instant_ui.cc |
| @@ -43,6 +43,10 @@ class InstantUIMessageHandler |
| return slow_animation_scale_factor_; |
| } |
| + static int show_search_provider_logo() { |
|
sky
2012/09/14 21:35:30
bool
kuan
2012/09/14 22:34:09
Done.
|
| + return show_search_provider_logo_; |
| + } |
| + |
| private: |
| void GetPreferenceValue(const base::ListValue* args); |
| void SetPreferenceValue(const base::ListValue* args); |
| @@ -50,11 +54,15 @@ class InstantUIMessageHandler |
| // Slows down Instant animations by a time factor. |
| static int slow_animation_scale_factor_; |
| + // if search provider logo should be shown. |
| + static bool show_search_provider_logo_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(InstantUIMessageHandler); |
| }; |
| // static |
| int InstantUIMessageHandler::slow_animation_scale_factor_ = 1; |
| +bool InstantUIMessageHandler::show_search_provider_logo_ = false; |
| InstantUIMessageHandler::InstantUIMessageHandler() {} |
| @@ -79,6 +87,8 @@ void InstantUIMessageHandler::GetPreferenceValue(const base::ListValue* args) { |
| #if defined(TOOLKIT_VIEWS) |
| if (pref_name == prefs::kInstantAnimationScaleFactor) |
| value = slow_animation_scale_factor_; |
| + else if (pref_name == prefs::kInstantShowSearchProviderLogo) |
| + value = show_search_provider_logo_; |
| #endif |
| base::StringValue arg1(pref_name); |
| @@ -93,14 +103,19 @@ void InstantUIMessageHandler::SetPreferenceValue(const base::ListValue* args) { |
| std::string pref_name; |
| if (!args->GetString(0, &pref_name)) return; |
| - double value; |
| - if (!args->GetDouble(1, &value)) return; |
| - |
| #if defined(TOOLKIT_VIEWS) |
| if (pref_name == prefs::kInstantAnimationScaleFactor) { |
| + double value; |
| + if (!args->GetDouble(1, &value)) |
| + return; |
| // Clamp to something reasonable. |
| - value = std::max(0.1, std::min(value, 10.0)); |
| + value = std::max(0.1, std::min(value, 20.0)); |
| slow_animation_scale_factor_ = static_cast<int>(value); |
| + } else if (pref_name == prefs::kInstantShowSearchProviderLogo) { |
| + bool value; |
| + if (!args->GetBoolean(1, &value)) |
| + return; |
| + show_search_provider_logo_ = value; |
| } |
| #else |
| NOTIMPLEMENTED(); |
| @@ -124,3 +139,8 @@ InstantUI::InstantUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| int InstantUI::GetSlowAnimationScaleFactor() { |
| return InstantUIMessageHandler::slow_animation_scale_factor(); |
| } |
| + |
| +// static |
| +int InstantUI::ShouldShowSearchProviderLogo() { |
|
dhollowa
2012/09/14 22:01:56
bool
kuan
2012/09/14 22:34:09
Done.
|
| + return InstantUIMessageHandler::show_search_provider_logo(); |
| +} |