| 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 "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 7 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| 8 #include "chrome/browser/defaults.h" | 8 #include "chrome/browser/defaults.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 gfx::Point tab_loc_in_host; | 174 gfx::Point tab_loc_in_host; |
| 175 ConvertPointToTarget(tabstrip(), this, &tab_loc_in_host); | 175 ConvertPointToTarget(tabstrip(), this, &tab_loc_in_host); |
| 176 return event.y() < tab_loc_in_host.y() + tabstrip()->height(); | 176 return event.y() < tab_loc_in_host.y() + tabstrip()->height(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 ui::DropTargetEvent* BrowserRootView::MapEventToTabStrip( | 179 ui::DropTargetEvent* BrowserRootView::MapEventToTabStrip( |
| 180 const ui::DropTargetEvent& event, | 180 const ui::DropTargetEvent& event, |
| 181 const ui::OSExchangeData& data) { | 181 const ui::OSExchangeData& data) { |
| 182 gfx::Point tab_strip_loc(event.location()); | 182 gfx::Point tab_strip_loc(event.location()); |
| 183 ConvertPointToTarget(this, tabstrip(), &tab_strip_loc); | 183 ConvertPointToTarget(this, tabstrip(), &tab_strip_loc); |
| 184 return new ui::DropTargetEvent(data, tab_strip_loc, tab_strip_loc, | 184 return new ui::DropTargetEvent(data, gfx::PointF(tab_strip_loc), |
| 185 gfx::PointF(tab_strip_loc), |
| 185 event.source_operations()); | 186 event.source_operations()); |
| 186 } | 187 } |
| 187 | 188 |
| 188 TabStrip* BrowserRootView::tabstrip() const { | 189 TabStrip* BrowserRootView::tabstrip() const { |
| 189 return browser_view_->tabstrip(); | 190 return browser_view_->tabstrip(); |
| 190 } | 191 } |
| 191 | 192 |
| 192 bool BrowserRootView::GetPasteAndGoURL(const ui::OSExchangeData& data, | 193 bool BrowserRootView::GetPasteAndGoURL(const ui::OSExchangeData& data, |
| 193 GURL* url) { | 194 GURL* url) { |
| 194 if (!data.HasString()) | 195 if (!data.HasString()) |
| 195 return false; | 196 return false; |
| 196 | 197 |
| 197 base::string16 text; | 198 base::string16 text; |
| 198 if (!data.GetString(&text) || text.empty()) | 199 if (!data.GetString(&text) || text.empty()) |
| 199 return false; | 200 return false; |
| 200 text = AutocompleteMatch::SanitizeString(text); | 201 text = AutocompleteMatch::SanitizeString(text); |
| 201 | 202 |
| 202 AutocompleteMatch match; | 203 AutocompleteMatch match; |
| 203 AutocompleteClassifierFactory::GetForProfile( | 204 AutocompleteClassifierFactory::GetForProfile( |
| 204 browser_view_->browser()->profile())->Classify( | 205 browser_view_->browser()->profile())->Classify( |
| 205 text, false, false, metrics::OmniboxEventProto::INVALID_SPEC, &match, | 206 text, false, false, metrics::OmniboxEventProto::INVALID_SPEC, &match, |
| 206 nullptr); | 207 nullptr); |
| 207 if (!match.destination_url.is_valid()) | 208 if (!match.destination_url.is_valid()) |
| 208 return false; | 209 return false; |
| 209 | 210 |
| 210 if (url) | 211 if (url) |
| 211 *url = match.destination_url; | 212 *url = match.destination_url; |
| 212 return true; | 213 return true; |
| 213 } | 214 } |
| OLD | NEW |