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/toolbar_view.h" | 5 #include "chrome/browser/ui/views/toolbar_view.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 location_bar_container_->SetInToolbar(false); | 437 location_bar_container_->SetInToolbar(false); |
438 location_container_bounds.set_height( | 438 location_container_bounds.set_height( |
439 location_bar_container_->GetPreferredSize().height()); | 439 location_bar_container_->GetPreferredSize().height()); |
440 | 440 |
441 // If bounds of |location_bar_container_| is not contained within its | 441 // If bounds of |location_bar_container_| is not contained within its |
442 // parent's, adjust the former's to within the latter's. This will clip its | 442 // parent's, adjust the former's to within the latter's. This will clip its |
443 // child |location_bar_view_| within its bounds without resizing it. | 443 // child |location_bar_view_| within its bounds without resizing it. |
444 // Note that parent of |location_bar_container_| i.e. BrowserView can't clip | 444 // Note that parent of |location_bar_container_| i.e. BrowserView can't clip |
445 // its children, else it loses the 3D shadows. | 445 // its children, else it loses the 3D shadows. |
446 gfx::Rect parent_rect = location_bar_container_->parent()->GetLocalBounds(); | 446 gfx::Rect parent_rect = location_bar_container_->parent()->GetLocalBounds(); |
447 gfx::Rect intersect_rect = parent_rect; | 447 gfx::Rect intersect_rect = |
448 intersect_rect.Intersect(location_container_bounds); | 448 gfx::IntersectRects(parent_rect, location_container_bounds); |
449 // If the two bounds don't intersect, set bounds of |location_bar_container_| | 449 // If the two bounds don't intersect, set bounds of |location_bar_container_| |
450 // to 0. | 450 // to 0. |
451 location_bar_container_->SetBoundsRect(intersect_rect); | 451 location_bar_container_->SetBoundsRect(intersect_rect); |
452 } | 452 } |
453 | 453 |
454 views::View* ToolbarView::GetBookmarkBubbleAnchor() { | 454 views::View* ToolbarView::GetBookmarkBubbleAnchor() { |
455 views::View* star_view = location_bar()->star_view(); | 455 views::View* star_view = location_bar()->star_view(); |
456 if (star_view && star_view->visible()) | 456 if (star_view && star_view->visible()) |
457 return star_view; | 457 return star_view; |
458 return app_menu_; | 458 return app_menu_; |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 // LocationBarContainer is not a child of the ToolbarView. | 1055 // LocationBarContainer is not a child of the ToolbarView. |
1056 gfx::Point origin(bounds.origin()); | 1056 gfx::Point origin(bounds.origin()); |
1057 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), | 1057 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), |
1058 &origin); | 1058 &origin); |
1059 gfx::Rect target_bounds(origin, bounds.size()); | 1059 gfx::Rect target_bounds(origin, bounds.size()); |
1060 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1060 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
1061 location_bar_container_->SetInToolbar(true); | 1061 location_bar_container_->SetInToolbar(true); |
1062 location_bar_container_->SetBoundsRect(target_bounds); | 1062 location_bar_container_->SetBoundsRect(target_bounds); |
1063 } | 1063 } |
1064 } | 1064 } |
OLD | NEW |