| 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 void LocationBarView::SetShowFocusRect(bool show) { | 438 void LocationBarView::SetShowFocusRect(bool show) { |
| 439 show_focus_rect_ = show; | 439 show_focus_rect_ = show; |
| 440 SchedulePaint(); | 440 SchedulePaint(); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void LocationBarView::SelectAll() { | 443 void LocationBarView::SelectAll() { |
| 444 omnibox_view_->SelectAll(true); | 444 omnibox_view_->SelectAll(true); |
| 445 } | 445 } |
| 446 | 446 |
| 447 gfx::Point LocationBarView::GetLocationBarAnchorPoint() const { | 447 gfx::Point LocationBarView::GetLocationBarAnchorPoint() const { |
| 448 const views::ImageView* image = location_icon_view_->GetImageView(); |
| 448 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 449 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 449 const int icon_padding = GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING); | 450 int icon_bottom = image->GetImageBounds().bottom() - |
| 450 gfx::Point icon_bottom( | 451 GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING) + 1; |
| 451 0, location_icon_view_->GetImageBounds().bottom() - icon_padding + 1); | 452 gfx::Point icon_center(image->GetImageBounds().CenterPoint()); |
| 452 gfx::Point icon_center(location_icon_view_->GetImageBounds().CenterPoint()); | 453 gfx::Point point(icon_center.x(), icon_bottom); |
| 453 gfx::Point point(icon_center.x(), icon_bottom.y()); | 454 ConvertPointToTarget(image, this, &point); |
| 454 ConvertPointToTarget(location_icon_view_, this, &point); | |
| 455 return point; | 455 return point; |
| 456 } | 456 } |
| 457 | 457 |
| 458 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 458 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 459 int total_height = | 459 int total_height = |
| 460 use_preferred_size ? GetPreferredSize().height() : height(); | 460 use_preferred_size ? GetPreferredSize().height() : height(); |
| 461 return std::max(total_height - (VerticalPadding() * 2), 0); | 461 return std::max(total_height - (VerticalPadding() * 2), 0); |
| 462 } | 462 } |
| 463 | 463 |
| 464 void LocationBarView::GetOmniboxPopupPositioningInfo( | 464 void LocationBarView::GetOmniboxPopupPositioningInfo( |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 | 1346 |
| 1347 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { | 1347 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { |
| 1348 AnimationProgressed(animation); | 1348 AnimationProgressed(animation); |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 //////////////////////////////////////////////////////////////////////////////// | 1351 //////////////////////////////////////////////////////////////////////////////// |
| 1352 // LocationBarView, private OmniboxEditController implementation: | 1352 // LocationBarView, private OmniboxEditController implementation: |
| 1353 | 1353 |
| 1354 void LocationBarView::OnChanged() { | 1354 void LocationBarView::OnChanged() { |
| 1355 RefreshLocationIcon(); | 1355 RefreshLocationIcon(); |
| 1356 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty()); | 1356 location_icon_view_->set_show_tooltip(!GetOmniboxView()->IsEditingOrEmpty()); |
| 1357 Layout(); | 1357 Layout(); |
| 1358 SchedulePaint(); | 1358 SchedulePaint(); |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 void LocationBarView::OnSetFocus() { | 1361 void LocationBarView::OnSetFocus() { |
| 1362 GetFocusManager()->SetFocusedView(this); | 1362 GetFocusManager()->SetFocusedView(this); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 const ToolbarModel* LocationBarView::GetToolbarModel() const { | 1365 const ToolbarModel* LocationBarView::GetToolbarModel() const { |
| 1366 return delegate_->GetToolbarModel(); | 1366 return delegate_->GetToolbarModel(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1377 // LocationBarView, private TemplateURLServiceObserver implementation: | 1377 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1378 | 1378 |
| 1379 void LocationBarView::OnTemplateURLServiceChanged() { | 1379 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1380 template_url_service_->RemoveObserver(this); | 1380 template_url_service_->RemoveObserver(this); |
| 1381 template_url_service_ = nullptr; | 1381 template_url_service_ = nullptr; |
| 1382 // If the browser is no longer active, let's not show the info bubble, as this | 1382 // If the browser is no longer active, let's not show the info bubble, as this |
| 1383 // would make the browser the active window again. | 1383 // would make the browser the active window again. |
| 1384 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1384 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1385 ShowFirstRunBubble(); | 1385 ShowFirstRunBubble(); |
| 1386 } | 1386 } |
| OLD | NEW |