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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 // BrowserWindow may not contain contents during startup on the lock screen. | 961 // BrowserWindow may not contain contents during startup on the lock screen. |
962 if (!browser_window || !browser_window->Contains(contents_view)) | 962 if (!browser_window || !browser_window->Contains(contents_view)) |
963 return; | 963 return; |
964 | 964 |
965 gfx::Size contents_size(contents_view->bounds().size()); | 965 gfx::Size contents_size(contents_view->bounds().size()); |
966 gfx::Rect location_rect = chrome::search::GetNTPOmniboxBounds(contents_size); | 966 gfx::Rect location_rect = chrome::search::GetNTPOmniboxBounds(contents_size); |
967 if (location_rect.width() == 0) | 967 if (location_rect.width() == 0) |
968 return; | 968 return; |
969 | 969 |
970 gfx::Point location_container_origin; | 970 gfx::Point location_container_origin; |
971 aura::Window::ConvertPointToWindow( | 971 aura::Window::ConvertPointToTarget( |
972 contents_view, browser_window, &location_container_origin); | 972 contents_view, browser_window, &location_container_origin); |
973 views::View::ConvertPointFromWidget(location_bar_container_->parent(), | 973 views::View::ConvertPointFromWidget(location_bar_container_->parent(), |
974 &location_container_origin); | 974 &location_container_origin); |
975 location_container_origin = | 975 location_container_origin = |
976 location_container_origin.Add(location_rect.origin()); | 976 location_container_origin.Add(location_rect.origin()); |
977 #else | 977 #else |
978 // Get screen bounds of web contents page. | 978 // Get screen bounds of web contents page. |
979 gfx::Rect web_rect_in_screen; | 979 gfx::Rect web_rect_in_screen; |
980 if (contents && contents->GetView()) | 980 if (contents && contents->GetView()) |
981 contents->GetView()->GetContainerBounds(&web_rect_in_screen); | 981 contents->GetView()->GetContainerBounds(&web_rect_in_screen); |
(...skipping 29 matching lines...) Expand all Loading... |
1011 // LocationBarContainer is not a child of the ToolbarView. | 1011 // LocationBarContainer is not a child of the ToolbarView. |
1012 gfx::Point origin(bounds.origin()); | 1012 gfx::Point origin(bounds.origin()); |
1013 views::View::ConvertPointToView(this, location_bar_container_->parent(), | 1013 views::View::ConvertPointToView(this, location_bar_container_->parent(), |
1014 &origin); | 1014 &origin); |
1015 gfx::Rect target_bounds(origin, bounds.size()); | 1015 gfx::Rect target_bounds(origin, bounds.size()); |
1016 if (location_bar_container_->GetTargetBounds() != target_bounds) { | 1016 if (location_bar_container_->GetTargetBounds() != target_bounds) { |
1017 location_bar_container_->SetInToolbar(true); | 1017 location_bar_container_->SetInToolbar(true); |
1018 location_bar_container_->SetBoundsRect(target_bounds); | 1018 location_bar_container_->SetBoundsRect(target_bounds); |
1019 } | 1019 } |
1020 } | 1020 } |
OLD | NEW |