| 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/omnibox/omnibox_edit_model.h" | 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 if (popup_->IsOpen() && !in_revert_) { | 440 if (popup_->IsOpen() && !in_revert_) { |
| 441 InstantController* instant = controller_->GetInstant(); | 441 InstantController* instant = controller_->GetInstant(); |
| 442 if (instant && !instant->commit_on_pointer_release()) | 442 if (instant && !instant->commit_on_pointer_release()) |
| 443 instant->DestroyPreviewContents(); | 443 instant->DestroyPreviewContents(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 autocomplete_controller_->Stop(true); | 446 autocomplete_controller_->Stop(true); |
| 447 } | 447 } |
| 448 | 448 |
| 449 bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { | 449 bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { |
| 450 if (!view_->GetCommandUpdater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL)) | 450 if (!view_->command_updater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL)) |
| 451 return false; | 451 return false; |
| 452 | 452 |
| 453 AutocompleteMatch match; | 453 AutocompleteMatch match; |
| 454 ClassifyStringForPasteAndGo(text, &match, NULL); | 454 ClassifyStringForPasteAndGo(text, &match, NULL); |
| 455 return match.destination_url.is_valid(); | 455 return match.destination_url.is_valid(); |
| 456 } | 456 } |
| 457 | 457 |
| 458 void OmniboxEditModel::PasteAndGo(const string16& text) { | 458 void OmniboxEditModel::PasteAndGo(const string16& text) { |
| 459 DCHECK(CanPasteAndGo(text)); | 459 DCHECK(CanPasteAndGo(text)); |
| 460 view_->RevertAll(); | 460 view_->RevertAll(); |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 } | 1173 } |
| 1174 | 1174 |
| 1175 void OmniboxEditModel::ClassifyStringForPasteAndGo( | 1175 void OmniboxEditModel::ClassifyStringForPasteAndGo( |
| 1176 const string16& text, | 1176 const string16& text, |
| 1177 AutocompleteMatch* match, | 1177 AutocompleteMatch* match, |
| 1178 GURL* alternate_nav_url) const { | 1178 GURL* alternate_nav_url) const { |
| 1179 DCHECK(match); | 1179 DCHECK(match); |
| 1180 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, | 1180 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, |
| 1181 string16(), false, false, match, alternate_nav_url); | 1181 string16(), false, false, match, alternate_nav_url); |
| 1182 } | 1182 } |
| OLD | NEW |