| 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/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // treat this as a reload. | 520 // treat this as a reload. |
| 521 match.transition = content::PAGE_TRANSITION_RELOAD; | 521 match.transition = content::PAGE_TRANSITION_RELOAD; |
| 522 } else if (for_drop || ((paste_state_ != NONE) && | 522 } else if (for_drop || ((paste_state_ != NONE) && |
| 523 match.is_history_what_you_typed_match)) { | 523 match.is_history_what_you_typed_match)) { |
| 524 // When the user pasted in a URL and hit enter, score it like a link click | 524 // When the user pasted in a URL and hit enter, score it like a link click |
| 525 // rather than a normal typed URL, so it doesn't get inline autocompleted | 525 // rather than a normal typed URL, so it doesn't get inline autocompleted |
| 526 // as aggressively later. | 526 // as aggressively later. |
| 527 match.transition = content::PAGE_TRANSITION_LINK; | 527 match.transition = content::PAGE_TRANSITION_LINK; |
| 528 } | 528 } |
| 529 | 529 |
| 530 const TemplateURL* template_url = match.GetTemplateURL(profile_); | 530 const TemplateURL* template_url = match.GetTemplateURL(profile_, false); |
| 531 if (template_url && template_url->url_ref().HasGoogleBaseURLs()) | 531 if (template_url && template_url->url_ref().HasGoogleBaseURLs()) |
| 532 GoogleURLTracker::GoogleURLSearchCommitted(profile_); | 532 GoogleURLTracker::GoogleURLSearchCommitted(profile_); |
| 533 | 533 |
| 534 view_->OpenMatch(match, disposition, alternate_nav_url, | 534 view_->OpenMatch(match, disposition, alternate_nav_url, |
| 535 OmniboxPopupModel::kNoMatch); | 535 OmniboxPopupModel::kNoMatch); |
| 536 } | 536 } |
| 537 | 537 |
| 538 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, | 538 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, |
| 539 WindowOpenDisposition disposition, | 539 WindowOpenDisposition disposition, |
| 540 const GURL& alternate_nav_url, | 540 const GURL& alternate_nav_url, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 571 controller_->GetTabContents()->web_contents())->session_id().id(); | 571 controller_->GetTabContents()->web_contents())->session_id().id(); |
| 572 } | 572 } |
| 573 autocomplete_controller_->AddProvidersInfo(&log.providers_info); | 573 autocomplete_controller_->AddProvidersInfo(&log.providers_info); |
| 574 content::NotificationService::current()->Notify( | 574 content::NotificationService::current()->Notify( |
| 575 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 575 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 576 content::Source<Profile>(profile_), | 576 content::Source<Profile>(profile_), |
| 577 content::Details<AutocompleteLog>(&log)); | 577 content::Details<AutocompleteLog>(&log)); |
| 578 HISTOGRAM_ENUMERATION("Omnibox.EventCount", 1, 2); | 578 HISTOGRAM_ENUMERATION("Omnibox.EventCount", 1, 2); |
| 579 } | 579 } |
| 580 | 580 |
| 581 TemplateURL* template_url = match.GetTemplateURL(profile_); | 581 TemplateURL* template_url = match.GetTemplateURL(profile_, false); |
| 582 if (template_url) { | 582 if (template_url) { |
| 583 if (match.transition == content::PAGE_TRANSITION_KEYWORD) { | 583 if (match.transition == content::PAGE_TRANSITION_KEYWORD) { |
| 584 // The user is using a non-substituting keyword or is explicitly in | 584 // The user is using a non-substituting keyword or is explicitly in |
| 585 // keyword mode. | 585 // keyword mode. |
| 586 | 586 |
| 587 // Special case for extension keywords. Don't increment usage count for | 587 // Special case for extension keywords. Don't increment usage count for |
| 588 // these. | 588 // these. |
| 589 if (template_url->IsExtensionKeyword()) { | 589 if (template_url->IsExtensionKeyword()) { |
| 590 AutocompleteMatch current_match; | 590 AutocompleteMatch current_match; |
| 591 GetInfoForCurrentText(¤t_match, NULL); | 591 GetInfoForCurrentText(¤t_match, NULL); |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 void OmniboxEditModel::ClassifyStringForPasteAndGo( | 1293 void OmniboxEditModel::ClassifyStringForPasteAndGo( |
| 1294 const string16& text, | 1294 const string16& text, |
| 1295 AutocompleteMatch* match, | 1295 AutocompleteMatch* match, |
| 1296 GURL* alternate_nav_url) const { | 1296 GURL* alternate_nav_url) const { |
| 1297 DCHECK(match); | 1297 DCHECK(match); |
| 1298 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, | 1298 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, |
| 1299 string16(), false, false, match, alternate_nav_url); | 1299 string16(), false, false, match, alternate_nav_url); |
| 1300 } | 1300 } |
| OLD | NEW |