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

Unified Diff: chrome/browser/ui/views/search_view_controller.cc

Issue 11091050: InstantExtended: Add js api for custom logo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
Index: chrome/browser/ui/views/search_view_controller.cc
diff --git a/chrome/browser/ui/views/search_view_controller.cc b/chrome/browser/ui/views/search_view_controller.cc
index 64105edcf733335406cc0ba0384b19fcf0f2f375..f32271b9bab00553b840ff77ec32a5fca70460ca 100644
--- a/chrome/browser/ui/views/search_view_controller.cc
+++ b/chrome/browser/ui/views/search_view_controller.cc
@@ -249,7 +249,8 @@ SearchViewController::SearchViewController(
search_container_(NULL),
ntp_container_(NULL),
content_view_(NULL),
- omnibox_popup_parent_(NULL) {
+ omnibox_popup_parent_(NULL),
+ instant_has_custom_logo_(false) {
omnibox_popup_parent_ = new internal::OmniboxPopupContainer(this);
}
@@ -339,6 +340,10 @@ gfx::Rect SearchViewController::GetNTPOmniboxBounds(views::View* destination) {
omnibox_width, chrome::search::kNTPOmniboxHeight);
}
+void SearchViewController::SetInstantHasCustomLogo(bool has_logo) {
+ instant_has_custom_logo_ = has_logo;
+}
+
void SearchViewController::OnImplicitAnimationsCompleted() {
DCHECK_EQ(STATE_NTP_ANIMATING, state_);
state_ = STATE_SUGGESTIONS;
@@ -500,7 +505,8 @@ void SearchViewController::CreateViews(State state) {
if (default_provider &&
InstantUI::ShouldShowSearchProviderLogo(browser_context_) &&
(TemplateURLPrepopulateData::GetEngineType(default_provider->url()) ==
- SEARCH_ENGINE_GOOGLE)) {
+ SEARCH_ENGINE_GOOGLE) &&
+ !instant_has_custom_logo_) {
default_provider_logo_.reset(new views::ImageView());
default_provider_logo_->set_owned_by_client();
default_provider_logo_->SetImage(ui::ResourceBundle::GetSharedInstance().
@@ -511,14 +517,17 @@ void SearchViewController::CreateViews(State state) {
if (!default_provider_logo_.get()) {
default_provider_name_.reset(new views::Label(
- default_provider ? default_provider->short_name() : string16()));
+ default_provider && !instant_has_custom_logo_ ?
+ default_provider->short_name() : string16()));
default_provider_name_->set_owned_by_client();
// TODO(msw): Use a transparent background color as a workaround to support
// using Labels' view layers via gfx::Canvas::NO_SUBPIXEL_RENDERING.
default_provider_name_->SetBackgroundColor(0x00000000);
- default_provider_name_->set_background(
- views::Background::CreateSolidBackground(SK_ColorRED));
- default_provider_name_->SetEnabledColor(SK_ColorRED);
+ if (!instant_has_custom_logo_) {
+ default_provider_name_->set_background(
+ views::Background::CreateSolidBackground(SK_ColorRED));
+ default_provider_name_->SetEnabledColor(SK_ColorRED);
+ }
default_provider_name_->SetFont(
default_provider_name_->font().DeriveFont(75, gfx::Font::BOLD));
default_provider_name_->SetPaintToLayer(true);

Powered by Google App Engine
This is Rietveld 408576698