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/frame/browser_root_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_root_view.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 9 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 bool BrowserRootView::ShouldForwardToTabStrip( | 126 bool BrowserRootView::ShouldForwardToTabStrip( |
127 const views::DropTargetEvent& event) { | 127 const views::DropTargetEvent& event) { |
128 if (!tabstrip()->visible()) | 128 if (!tabstrip()->visible()) |
129 return false; | 129 return false; |
130 | 130 |
131 // Allow the drop as long as the mouse is over the tabstrip or vertically | 131 // Allow the drop as long as the mouse is over the tabstrip or vertically |
132 // before it. | 132 // before it. |
133 gfx::Point tab_loc_in_host; | 133 gfx::Point tab_loc_in_host; |
134 ConvertPointToView(tabstrip(), this, &tab_loc_in_host); | 134 ConvertPointToTarget(tabstrip(), this, &tab_loc_in_host); |
135 return event.y() < tab_loc_in_host.y() + tabstrip()->height(); | 135 return event.y() < tab_loc_in_host.y() + tabstrip()->height(); |
136 } | 136 } |
137 | 137 |
138 views::DropTargetEvent* BrowserRootView::MapEventToTabStrip( | 138 views::DropTargetEvent* BrowserRootView::MapEventToTabStrip( |
139 const views::DropTargetEvent& event, | 139 const views::DropTargetEvent& event, |
140 const ui::OSExchangeData& data) { | 140 const ui::OSExchangeData& data) { |
141 gfx::Point tab_strip_loc(event.location()); | 141 gfx::Point tab_strip_loc(event.location()); |
142 ConvertPointToView(this, tabstrip(), &tab_strip_loc); | 142 ConvertPointToTarget(this, tabstrip(), &tab_strip_loc); |
143 return new views::DropTargetEvent(data, tab_strip_loc.x(), | 143 return new views::DropTargetEvent(data, tab_strip_loc.x(), |
144 tab_strip_loc.y(), | 144 tab_strip_loc.y(), |
145 event.source_operations()); | 145 event.source_operations()); |
146 } | 146 } |
147 | 147 |
148 TabStrip* BrowserRootView::tabstrip() const { | 148 TabStrip* BrowserRootView::tabstrip() const { |
149 return browser_view_->tabstrip(); | 149 return browser_view_->tabstrip(); |
150 } | 150 } |
151 | 151 |
152 bool BrowserRootView::GetPasteAndGoURL(const ui::OSExchangeData& data, | 152 bool BrowserRootView::GetPasteAndGoURL(const ui::OSExchangeData& data, |
(...skipping 10 matching lines...) Expand all Loading... |
163 AutocompleteClassifierFactory::GetForProfile( | 163 AutocompleteClassifierFactory::GetForProfile( |
164 browser_view_->browser()->profile())->Classify(text, string16(), false, | 164 browser_view_->browser()->profile())->Classify(text, string16(), false, |
165 false, &match, NULL); | 165 false, &match, NULL); |
166 if (!match.destination_url.is_valid()) | 166 if (!match.destination_url.is_valid()) |
167 return false; | 167 return false; |
168 | 168 |
169 if (url) | 169 if (url) |
170 *url = match.destination_url; | 170 *url = match.destination_url; |
171 return true; | 171 return true; |
172 } | 172 } |
OLD | NEW |