| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/autocomplete/autocomplete_popup.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Figure the coordinates of the popup: | 167 // Figure the coordinates of the popup: |
| 168 // Get the coordinates of the location bar view; these are returned relative | 168 // Get the coordinates of the location bar view; these are returned relative |
| 169 // to its parent. | 169 // to its parent. |
| 170 // TODO(pkasting): http://b/1345937 All this use of editor accessors should | 170 // TODO(pkasting): http://b/1345937 All this use of editor accessors should |
| 171 // die once this class is a true ChromeView. | 171 // die once this class is a true ChromeView. |
| 172 CRect rc = edit_view_->parent_view()->bounds().ToRECT(); | 172 CRect rc = edit_view_->parent_view()->bounds().ToRECT(); |
| 173 // Subtract the top left corner to make the coordinates relative to the | 173 // Subtract the top left corner to make the coordinates relative to the |
| 174 // location bar view itself, and convert to screen coordinates. | 174 // location bar view itself, and convert to screen coordinates. |
| 175 CPoint top_left(-rc.TopLeft()); | 175 gfx::Point top_left(-rc.TopLeft()); |
| 176 ChromeViews::View::ConvertPointToScreen(edit_view_->parent_view(), &top_left); | 176 ChromeViews::View::ConvertPointToScreen(edit_view_->parent_view(), &top_left); |
| 177 rc.OffsetRect(top_left); | 177 rc.OffsetRect(top_left.ToPOINT()); |
| 178 // Expand by one pixel on each side since that's the amount the location bar | 178 // Expand by one pixel on each side since that's the amount the location bar |
| 179 // view is inset from the divider line that edges the adjacent buttons. | 179 // view is inset from the divider line that edges the adjacent buttons. |
| 180 // Deflate the top and bottom by the height of the extra graphics around the | 180 // Deflate the top and bottom by the height of the extra graphics around the |
| 181 // edit. | 181 // edit. |
| 182 // TODO(pkasting): http://b/972786 This shouldn't be hardcoded to rely on | 182 // TODO(pkasting): http://b/972786 This shouldn't be hardcoded to rely on |
| 183 // LocationBarView constants. Instead we should just make the edit be "at the | 183 // LocationBarView constants. Instead we should just make the edit be "at the |
| 184 // right coordinates", or something else generic. | 184 // right coordinates", or something else generic. |
| 185 rc.InflateRect(1, -LocationBarView::kTextVertMargin); | 185 rc.InflateRect(1, -LocationBarView::kTextVertMargin); |
| 186 // Now rc is the exact width we want and is positioned like the edit would | 186 // Now rc is the exact width we want and is positioned like the edit would |
| 187 // be, so shift the top and bottom downwards so the new top is where the old | 187 // be, so shift the top and bottom downwards so the new top is where the old |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 } | 1033 } |
| 1034 edit_model_->OnPopupDataChanged(inline_autocomplete_text, false, keyword, | 1034 edit_model_->OnPopupDataChanged(inline_autocomplete_text, false, keyword, |
| 1035 is_keyword_hint, can_show_search_hint); | 1035 is_keyword_hint, can_show_search_hint); |
| 1036 return; | 1036 return; |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 default: | 1039 default: |
| 1040 NOTREACHED(); | 1040 NOTREACHED(); |
| 1041 } | 1041 } |
| 1042 } | 1042 } |
| OLD | NEW |