| 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::Intersection(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 //////////////////////////////////////////////////////////////////////////////// | 454 //////////////////////////////////////////////////////////////////////////////// |
| 455 // ToolbarView, AccessiblePaneView overrides: | 455 // ToolbarView, AccessiblePaneView overrides: |
| 456 | 456 |
| 457 bool ToolbarView::SetPaneFocus(views::View* initial_focus) { | 457 bool ToolbarView::SetPaneFocus(views::View* initial_focus) { |
| 458 if (!AccessiblePaneView::SetPaneFocus(initial_focus)) | 458 if (!AccessiblePaneView::SetPaneFocus(initial_focus)) |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 // LocationBarContainer is not a child of the ToolbarView. | 1048 // LocationBarContainer is not a child of the ToolbarView. |
| 1049 gfx::Point origin(bounds.origin()); | 1049 gfx::Point origin(bounds.origin()); |
| 1050 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), | 1050 views::View::ConvertPointToTarget(this, location_bar_container_->parent(), |
| 1051 &origin); | 1051 &origin); |
| 1052 gfx::Rect target_bounds(origin, bounds.size()); | 1052 gfx::Rect target_bounds(origin, bounds.size()); |
| 1053 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1053 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
| 1054 location_bar_container_->SetInToolbar(true); | 1054 location_bar_container_->SetInToolbar(true); |
| 1055 location_bar_container_->SetBoundsRect(target_bounds); | 1055 location_bar_container_->SetBoundsRect(target_bounds); |
| 1056 } | 1056 } |
| 1057 } | 1057 } |
| OLD | NEW |