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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 return color_utils::GetReadableColor( | 420 return color_utils::GetReadableColor( |
421 color, GetColor(security_level, BACKGROUND)); | 421 color, GetColor(security_level, BACKGROUND)); |
422 } | 422 } |
423 | 423 |
424 default: | 424 default: |
425 NOTREACHED(); | 425 NOTREACHED(); |
426 return GetColor(security_level, TEXT); | 426 return GetColor(security_level, TEXT); |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 void LocationBarView::GetOmniboxPopupPositioningInfo( | |
431 gfx::Point* top_left_screen_coord, | |
432 int* popup_width, | |
433 int* left_margin, | |
434 int* right_margin) { | |
435 gfx::Rect location_bar_bounds(parent()->GetContentsBounds()); | |
436 | |
437 // The location bar is drawn using a background graphic that includes the | |
438 // border, so we inset by enough to make the edges line up, and the bubble | |
439 // appear at the same height as the Star bubble. | |
Peter Kasting
2013/06/06 22:52:04
Nit: I'd just nuke this comment (and the blank lin
| |
440 location_bar_bounds.Inset(kNormalEdgeThickness, 0); | |
441 | |
442 *top_left_screen_coord = gfx::Point(0, parent()->height()); | |
443 views::View::ConvertPointToScreen(parent(), top_left_screen_coord); | |
444 *popup_width = parent()->width(); | |
445 | |
446 gfx::Point location_bar_in_toolbar(location_bar_bounds.origin()); | |
447 views::View::ConvertPointToTarget(this, parent(), &location_bar_in_toolbar); | |
448 *left_margin = location_bar_in_toolbar.x(); | |
449 *right_margin = *popup_width - *left_margin - location_bar_bounds.width(); | |
450 } | |
451 | |
430 // static | 452 // static |
431 int LocationBarView::GetItemPadding() { | 453 int LocationBarView::GetItemPadding() { |
432 const int kTouchItemPadding = 8; | 454 const int kTouchItemPadding = 8; |
433 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) | 455 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) |
434 return kTouchItemPadding; | 456 return kTouchItemPadding; |
435 | 457 |
436 const int kDesktopScriptBadgeItemPadding = 9; | 458 const int kDesktopScriptBadgeItemPadding = 9; |
437 const int kDesktopItemPadding = 3; | 459 const int kDesktopItemPadding = 3; |
438 return extensions::FeatureSwitch::script_badges()->IsEnabled() ? | 460 return extensions::FeatureSwitch::script_badges()->IsEnabled() ? |
439 kDesktopScriptBadgeItemPadding : kDesktopItemPadding; | 461 kDesktopScriptBadgeItemPadding : kDesktopItemPadding; |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1533 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1555 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
1534 int total_height = | 1556 int total_height = |
1535 use_preferred_size ? GetPreferredSize().height() : height(); | 1557 use_preferred_size ? GetPreferredSize().height() : height(); |
1536 return std::max(total_height - (vertical_edge_thickness() * 2), 0); | 1558 return std::max(total_height - (vertical_edge_thickness() * 2), 0); |
1537 } | 1559 } |
1538 | 1560 |
1539 bool LocationBarView::HasValidSuggestText() const { | 1561 bool LocationBarView::HasValidSuggestText() const { |
1540 return suggested_text_view_->visible() && | 1562 return suggested_text_view_->visible() && |
1541 !suggested_text_view_->size().IsEmpty(); | 1563 !suggested_text_view_->size().IsEmpty(); |
1542 } | 1564 } |
OLD | NEW |