| 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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 //////////////////////////////////////////////////////////////////////////////// | 173 //////////////////////////////////////////////////////////////////////////////// |
| 174 // LocationBarView, public: | 174 // LocationBarView, public: |
| 175 | 175 |
| 176 void LocationBarView::Init() { | 176 void LocationBarView::Init() { |
| 177 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're | 177 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're |
| 178 // not prepared for that. | 178 // not prepared for that. |
| 179 DCHECK(GetWidget()); | 179 DCHECK(GetWidget()); |
| 180 | 180 |
| 181 const int kOmniboxPopupBorderImages[] = | 181 if (is_popup_mode_) { |
| 182 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); | 182 const int kOmniboxPopupBorderImages[] = |
| 183 const int kOmniboxBorderImages[] = IMAGE_GRID(IDR_TEXTFIELD); | 183 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); |
| 184 border_painter_.reset(views::Painter::CreateImageGridPainter( | 184 border_painter_.reset( |
| 185 is_popup_mode_ ? kOmniboxPopupBorderImages : kOmniboxBorderImages)); | 185 views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages)); |
| 186 } else { |
| 187 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 188 const gfx::Insets omnibox_border_insets(14, 9, 14, 9); |
| 189 border_painter_.reset(views::Painter::CreateImagePainter( |
| 190 *rb.GetImageSkiaNamed(IDR_OMNIBOX_BORDER), omnibox_border_insets)); |
| 191 } |
| 186 | 192 |
| 187 location_icon_view_ = new LocationIconView(this); | 193 location_icon_view_ = new LocationIconView(this); |
| 188 location_icon_view_->set_drag_controller(this); | 194 location_icon_view_->set_drag_controller(this); |
| 189 AddChildView(location_icon_view_); | 195 AddChildView(location_icon_view_); |
| 190 | 196 |
| 191 // Determine the main font. | 197 // Determine the main font. |
| 192 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList( | 198 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList( |
| 193 ResourceBundle::BaseFont); | 199 ResourceBundle::BaseFont); |
| 194 const int current_font_size = font_list.GetFontSize(); | 200 const int current_font_size = font_list.GetFontSize(); |
| 195 const int desired_font_size = browser_defaults::kOmniboxFontPixelSize; | 201 const int desired_font_size = browser_defaults::kOmniboxFontPixelSize; |
| (...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 | 1371 |
| 1366 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1372 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1367 const SearchModel::State& new_state) { | 1373 const SearchModel::State& new_state) { |
| 1368 const bool visible = !GetToolbarModel()->input_in_progress() && | 1374 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1369 new_state.voice_search_supported; | 1375 new_state.voice_search_supported; |
| 1370 if (mic_search_view_->visible() != visible) { | 1376 if (mic_search_view_->visible() != visible) { |
| 1371 mic_search_view_->SetVisible(visible); | 1377 mic_search_view_->SetVisible(visible); |
| 1372 Layout(); | 1378 Layout(); |
| 1373 } | 1379 } |
| 1374 } | 1380 } |
| OLD | NEW |