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/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 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 448 const views::ImageView* image = location_icon_view_->GetImageView(); |
| 449 const int icon_padding = GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING); | 449 // The -1 in the next line creates a 1-px gap between icon and arrow tip. |
|
Evan Stade
2016/01/22 23:58:37
I've no idea why this calculation made sense as th
Peter Kasting
2016/01/23 00:13:41
In pre-MD, the ICON_LABEL_VIEW_TRAILING_PADDING wa
Evan Stade
2016/01/23 00:37:26
This CL is attempting to fix a regression and is d
Peter Kasting
2016/01/23 01:25:28
If you want to merge, then don't touch the calcula
| |
| 450 gfx::Point icon_bottom( | 450 int icon_bottom = image->GetImageBounds().bottom() - 1; |
| 451 0, location_icon_view_->GetImageBounds().bottom() - icon_padding + 1); | 451 gfx::Point icon_center(image->GetImageBounds().CenterPoint()); |
| 452 gfx::Point icon_center(location_icon_view_->GetImageBounds().CenterPoint()); | 452 gfx::Point point(icon_center.x(), icon_bottom); |
| 453 gfx::Point point(icon_center.x(), icon_bottom.y()); | 453 ConvertPointToTarget(image, this, &point); |
| 454 ConvertPointToTarget(location_icon_view_, this, &point); | |
| 455 return point; | 454 return point; |
| 456 } | 455 } |
| 457 | 456 |
| 458 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 457 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 459 int total_height = | 458 int total_height = |
| 460 use_preferred_size ? GetPreferredSize().height() : height(); | 459 use_preferred_size ? GetPreferredSize().height() : height(); |
| 461 return std::max(total_height - (VerticalPadding() * 2), 0); | 460 return std::max(total_height - (VerticalPadding() * 2), 0); |
| 462 } | 461 } |
| 463 | 462 |
| 464 void LocationBarView::GetOmniboxPopupPositioningInfo( | 463 void LocationBarView::GetOmniboxPopupPositioningInfo( |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1346 | 1345 |
| 1347 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { | 1346 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { |
| 1348 AnimationProgressed(animation); | 1347 AnimationProgressed(animation); |
| 1349 } | 1348 } |
| 1350 | 1349 |
| 1351 //////////////////////////////////////////////////////////////////////////////// | 1350 //////////////////////////////////////////////////////////////////////////////// |
| 1352 // LocationBarView, private OmniboxEditController implementation: | 1351 // LocationBarView, private OmniboxEditController implementation: |
| 1353 | 1352 |
| 1354 void LocationBarView::OnChanged() { | 1353 void LocationBarView::OnChanged() { |
| 1355 RefreshLocationIcon(); | 1354 RefreshLocationIcon(); |
| 1356 location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty()); | 1355 location_icon_view_->set_show_tooltip(!GetOmniboxView()->IsEditingOrEmpty()); |
| 1357 Layout(); | 1356 Layout(); |
| 1358 SchedulePaint(); | 1357 SchedulePaint(); |
| 1359 } | 1358 } |
| 1360 | 1359 |
| 1361 void LocationBarView::OnSetFocus() { | 1360 void LocationBarView::OnSetFocus() { |
| 1362 GetFocusManager()->SetFocusedView(this); | 1361 GetFocusManager()->SetFocusedView(this); |
| 1363 } | 1362 } |
| 1364 | 1363 |
| 1365 const ToolbarModel* LocationBarView::GetToolbarModel() const { | 1364 const ToolbarModel* LocationBarView::GetToolbarModel() const { |
| 1366 return delegate_->GetToolbarModel(); | 1365 return delegate_->GetToolbarModel(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1377 // LocationBarView, private TemplateURLServiceObserver implementation: | 1376 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1378 | 1377 |
| 1379 void LocationBarView::OnTemplateURLServiceChanged() { | 1378 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1380 template_url_service_->RemoveObserver(this); | 1379 template_url_service_->RemoveObserver(this); |
| 1381 template_url_service_ = nullptr; | 1380 template_url_service_ = nullptr; |
| 1382 // If the browser is no longer active, let's not show the info bubble, as this | 1381 // 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. | 1382 // would make the browser the active window again. |
| 1384 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1383 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1385 ShowFirstRunBubble(); | 1384 ShowFirstRunBubble(); |
| 1386 } | 1385 } |
| OLD | NEW |