Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C, | 151 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_C, |
| 152 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R, | 152 IDR_OMNIBOX_EV_BUBBLE_BACKGROUND_R, |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 static const int kSelectedKeywordBackgroundImages[] = { | 155 static const int kSelectedKeywordBackgroundImages[] = { |
| 156 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L, | 156 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L, |
| 157 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C, | 157 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C, |
| 158 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R, | 158 IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R, |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 // TODO(gbillock): replace these with web-intents images when available. | |
| 162 static const int kWIBubbleBackgroundImages[] = { | 161 static const int kWIBubbleBackgroundImages[] = { |
| 163 IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_L, | 162 IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_L, |
| 164 IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_C, | 163 IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_C, |
| 165 IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_R, | 164 IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_R, |
| 166 }; | 165 }; |
| 167 | 166 |
| 168 #if defined(USE_AURA) | 167 #if defined(USE_AURA) |
| 169 LocationBarView::FadeAnimationObserver::FadeAnimationObserver( | 168 LocationBarView::FadeAnimationObserver::FadeAnimationObserver( |
| 170 LocationBarView* location_bar_view) | 169 LocationBarView* location_bar_view) |
| 171 : location_bar_view_(location_bar_view) { | 170 : location_bar_view_(location_bar_view) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 | 283 |
| 285 keyword_hint_view_ = new KeywordHintView(profile_); | 284 keyword_hint_view_ = new KeywordHintView(profile_); |
| 286 AddChildView(keyword_hint_view_); | 285 AddChildView(keyword_hint_view_); |
| 287 keyword_hint_view_->SetVisible(false); | 286 keyword_hint_view_->SetVisible(false); |
| 288 keyword_hint_view_->SetFont(font_); | 287 keyword_hint_view_->SetFont(font_); |
| 289 | 288 |
| 290 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 289 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 291 ContentSettingImageView* content_blocked_view = | 290 ContentSettingImageView* content_blocked_view = |
| 292 new ContentSettingImageView(static_cast<ContentSettingsType>(i), | 291 new ContentSettingImageView(static_cast<ContentSettingsType>(i), |
| 293 kCSBubbleBackgroundImages, this); | 292 kCSBubbleBackgroundImages, this); |
| 293 content_blocked_view->SetFont(font_); | |
| 294 content_setting_views_.push_back(content_blocked_view); | 294 content_setting_views_.push_back(content_blocked_view); |
| 295 AddChildView(content_blocked_view); | 295 AddChildView(content_blocked_view); |
| 296 content_blocked_view->SetVisible(false); | 296 content_blocked_view->SetVisible(false); |
| 297 } | 297 } |
| 298 | 298 |
| 299 zoom_view_ = new ZoomView(model_, delegate_); | 299 zoom_view_ = new ZoomView(model_, delegate_); |
| 300 AddChildView(zoom_view_); | 300 AddChildView(zoom_view_); |
| 301 | 301 |
| 302 web_intents_button_view_ = | 302 web_intents_button_view_ = |
| 303 new WebIntentsButtonView(this, kWIBubbleBackgroundImages); | 303 new WebIntentsButtonView(this, kWIBubbleBackgroundImages); |
| 304 web_intents_button_view_->SetFont(font_); | |
| 304 AddChildView(web_intents_button_view_); | 305 AddChildView(web_intents_button_view_); |
| 305 | 306 |
| 306 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 307 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
| 307 // Note: condition above means that the star icon is hidden in popups and in | 308 // Note: condition above means that the star icon is hidden in popups and in |
| 308 // the app launcher. | 309 // the app launcher. |
| 309 star_view_ = new StarView(command_updater_); | 310 star_view_ = new StarView(command_updater_); |
| 310 AddChildView(star_view_); | 311 AddChildView(star_view_); |
| 311 star_view_->SetVisible(true); | 312 star_view_->SetVisible(true); |
| 312 } | 313 } |
| 313 if (extensions::switch_utils::IsActionBoxEnabled() && browser_) { | 314 if (extensions::switch_utils::IsActionBoxEnabled() && browser_) { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 815 offset -= GetItemPadding() - (*i)->GetBuiltInHorizontalPadding(); | 816 offset -= GetItemPadding() - (*i)->GetBuiltInHorizontalPadding(); |
| 816 } | 817 } |
| 817 } | 818 } |
| 818 | 819 |
| 819 // Now the web intents button | 820 // Now the web intents button |
| 820 if (web_intents_button_view_->visible()) { | 821 if (web_intents_button_view_->visible()) { |
| 821 offset += web_intents_button_view_->GetBuiltInHorizontalPadding(); | 822 offset += web_intents_button_view_->GetBuiltInHorizontalPadding(); |
| 822 int width = web_intents_button_view_->GetPreferredSize().width(); | 823 int width = web_intents_button_view_->GetPreferredSize().width(); |
| 823 offset -= width; | 824 offset -= width; |
| 824 web_intents_button_view_->SetBounds( | 825 web_intents_button_view_->SetBounds( |
| 825 offset, location_y, width, location_height); | 826 offset, location_y, width, location_height); |
|
Greg Billock
2012/09/15 04:58:20
found it...
| |
| 826 offset -= GetItemPadding() - | 827 offset -= GetItemPadding() - |
| 827 web_intents_button_view_->GetBuiltInHorizontalPadding(); | 828 web_intents_button_view_->GetBuiltInHorizontalPadding(); |
| 828 } | 829 } |
| 829 | 830 |
| 830 // Now lay out items to the left of the edit field. | 831 // Now lay out items to the left of the edit field. |
| 831 if (location_icon_view_->visible()) { | 832 if (location_icon_view_->visible()) { |
| 832 location_icon_view_->SetBounds( | 833 location_icon_view_->SetBounds( |
| 833 kEdgeThickness + GetEdgeItemPadding() - | 834 kEdgeThickness + GetEdgeItemPadding() - |
| 834 location_icon_view_->GetBuiltInHorizontalPadding(), | 835 location_icon_view_->GetBuiltInHorizontalPadding(), |
| 835 location_y, location_icon_width, location_height); | 836 location_y, location_icon_width, location_height); |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1551 } | 1552 } |
| 1552 | 1553 |
| 1553 void LocationBarView::CleanupFadeAnimation() { | 1554 void LocationBarView::CleanupFadeAnimation() { |
| 1554 // Since we're no longer animating we don't need our layer. | 1555 // Since we're no longer animating we don't need our layer. |
| 1555 SetPaintToLayer(false); | 1556 SetPaintToLayer(false); |
| 1556 // Bubble labels don't need a transparent background anymore. | 1557 // Bubble labels don't need a transparent background anymore. |
| 1557 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1558 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1558 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1559 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1559 } | 1560 } |
| 1560 #endif // USE_AURA | 1561 #endif // USE_AURA |
| OLD | NEW |