Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: chrome/browser/ui/webui/instant_ui.cc

Issue 10910286: alternate ntp: show search provider logo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased, merged conflicts Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/instant_ui.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 427bc3c48f2e46cf44bc59e1ff12242f76cdab48..57ce618e817e19b9ebbb356d709ebae0d24fcee2 100644
--- a/chrome/browser/ui/webui/instant_ui.cc
+++ b/chrome/browser/ui/webui/instant_ui.cc
@@ -44,6 +44,10 @@ class InstantUIMessageHandler
return slow_animation_scale_factor_;
}
+ static bool show_search_provider_logo() {
+ return show_search_provider_logo_;
+ }
+
private:
void GetPreferenceValue(const base::ListValue* args);
void SetPreferenceValue(const base::ListValue* args);
@@ -51,11 +55,15 @@ class InstantUIMessageHandler
// Slows down Instant animations by a time factor.
static int slow_animation_scale_factor_;
+ // True 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() {}
@@ -85,6 +93,10 @@ void InstantUIMessageHandler::GetPreferenceValue(const base::ListValue* args) {
base::FundamentalValue arg(value);
web_ui()->CallJavascriptFunction(
"instantConfig.getPreferenceValueResult", pref_name_value, arg);
+ } else if (pref_name == prefs::kInstantShowSearchProviderLogo) {
+ base::FundamentalValue arg(show_search_provider_logo_);
+ web_ui()->CallJavascriptFunction(
+ "instantConfig.getPreferenceValueResult", pref_name_value, arg);
} else if (pref_name == prefs::kExperimentalZeroSuggestUrlPrefix) {
PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
base::StringValue arg(prefs->GetString(pref_name.c_str()));
@@ -99,17 +111,24 @@ void InstantUIMessageHandler::SetPreferenceValue(const base::ListValue* args) {
if (pref_name == prefs::kInstantAnimationScaleFactor) {
double value;
- if (!args->GetDouble(1, &value)) return;
+ if (!args->GetDouble(1, &value))
+ return;
#if defined(TOOLKIT_VIEWS)
// 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
NOTIMPLEMENTED();
-#endif
+#endif // defined(TOOLKIT_VIEWS)
+ } else if (pref_name == prefs::kInstantShowSearchProviderLogo) {
+ bool value;
+ if (!args->GetBoolean(1, &value))
+ return;
+ show_search_provider_logo_ = value;
} else if (pref_name == prefs::kExperimentalZeroSuggestUrlPrefix) {
std::string value;
- if (!args->GetString(1, &value)) return;
+ if (!args->GetString(1, &value))
+ return;
PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
prefs->SetString(pref_name.c_str(), value);
}
@@ -132,3 +151,8 @@ InstantUI::InstantUI(content::WebUI* web_ui) : WebUIController(web_ui) {
int InstantUI::GetSlowAnimationScaleFactor() {
return InstantUIMessageHandler::slow_animation_scale_factor();
}
+
+// static
+bool InstantUI::ShouldShowSearchProviderLogo() {
+ return InstantUIMessageHandler::show_search_provider_logo();
+}
« no previous file with comments | « chrome/browser/ui/webui/instant_ui.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698