| 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 481 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 482 int total_height = | 482 int total_height = |
| 483 use_preferred_size ? GetPreferredSize().height() : height(); | 483 use_preferred_size ? GetPreferredSize().height() : height(); |
| 484 return std::max(total_height - (VerticalPadding() * 2), 0); | 484 return std::max(total_height - (VerticalPadding() * 2), 0); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void LocationBarView::GetOmniboxPopupPositioningInfo( | 487 void LocationBarView::GetOmniboxPopupPositioningInfo( |
| 488 gfx::Point* top_left_screen_coord, | 488 gfx::Point* top_left_screen_coord, |
| 489 int* popup_width, | 489 int* popup_width, |
| 490 int* left_margin, | 490 int* left_margin, |
| 491 int* right_margin) { | 491 int* right_margin, |
| 492 // Because the popup might appear atop the attached bookmark bar, there won't | 492 int top_edge_overlap) { |
| 493 // necessarily be a client edge separating it from the rest of the toolbar. | 493 *top_left_screen_coord = gfx::Point(0, parent()->height() - top_edge_overlap); |
| 494 // Therefore we position the popup high enough so it can draw its own client | |
| 495 // edge at the top, in the same place the toolbar would normally draw the | |
| 496 // client edge. | |
| 497 *top_left_screen_coord = gfx::Point( | |
| 498 0, | |
| 499 parent()->height() - views::NonClientFrameView::kClientEdgeThickness); | |
| 500 views::View::ConvertPointToScreen(parent(), top_left_screen_coord); | 494 views::View::ConvertPointToScreen(parent(), top_left_screen_coord); |
| 495 |
| 501 *popup_width = parent()->width(); | 496 *popup_width = parent()->width(); |
| 502 | |
| 503 gfx::Rect location_bar_bounds(bounds()); | 497 gfx::Rect location_bar_bounds(bounds()); |
| 504 location_bar_bounds.Inset(kNormalEdgeThickness, 0); | 498 location_bar_bounds.Inset(kNormalEdgeThickness, 0); |
| 505 *left_margin = location_bar_bounds.x(); | 499 *left_margin = location_bar_bounds.x(); |
| 506 *right_margin = *popup_width - location_bar_bounds.right(); | 500 *right_margin = *popup_width - location_bar_bounds.right(); |
| 507 } | 501 } |
| 508 | 502 |
| 509 //////////////////////////////////////////////////////////////////////////////// | 503 //////////////////////////////////////////////////////////////////////////////// |
| 510 // LocationBarView, public LocationBar implementation: | 504 // LocationBarView, public LocationBar implementation: |
| 511 | 505 |
| 512 void LocationBarView::FocusLocation(bool select_all) { | 506 void LocationBarView::FocusLocation(bool select_all) { |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 | 1403 |
| 1410 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1404 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1411 const SearchModel::State& new_state) { | 1405 const SearchModel::State& new_state) { |
| 1412 const bool visible = !GetToolbarModel()->input_in_progress() && | 1406 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1413 new_state.voice_search_supported; | 1407 new_state.voice_search_supported; |
| 1414 if (mic_search_view_->visible() != visible) { | 1408 if (mic_search_view_->visible() != visible) { |
| 1415 mic_search_view_->SetVisible(visible); | 1409 mic_search_view_->SetVisible(visible); |
| 1416 Layout(); | 1410 Layout(); |
| 1417 } | 1411 } |
| 1418 } | 1412 } |
| OLD | NEW |