| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_edit.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/app/chrome_dll_resource.h" | 13 #include "chrome/app/chrome_dll_resource.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 14 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 15 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 15 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
| 16 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 16 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 17 #include "chrome/browser/autocomplete/keyword_provider.h" | 17 #include "chrome/browser/autocomplete/keyword_provider.h" |
| 18 #include "chrome/browser/browser_list.h" |
| 18 #include "chrome/browser/command_updater.h" | 19 #include "chrome/browser/command_updater.h" |
| 19 #include "chrome/browser/extensions/extension_omnibox_api.h" | 20 #include "chrome/browser/extensions/extension_omnibox_api.h" |
| 21 #include "chrome/browser/google_url_tracker.h" |
| 20 #include "chrome/browser/metrics/user_metrics.h" | 22 #include "chrome/browser/metrics/user_metrics.h" |
| 21 #include "chrome/browser/net/predictor_api.h" | 23 #include "chrome/browser/net/predictor_api.h" |
| 22 #include "chrome/browser/net/url_fixer_upper.h" | 24 #include "chrome/browser/net/url_fixer_upper.h" |
| 23 #include "chrome/browser/profile.h" | 25 #include "chrome/browser/profile.h" |
| 24 #include "chrome/browser/search_engines/template_url.h" | 26 #include "chrome/browser/search_engines/template_url.h" |
| 25 #include "chrome/browser/search_engines/template_url_model.h" | 27 #include "chrome/browser/search_engines/template_url_model.h" |
| 26 #include "chrome/common/notification_service.h" | 28 #include "chrome/common/notification_service.h" |
| 27 #include "chrome/common/url_constants.h" | 29 #include "chrome/common/url_constants.h" |
| 28 #include "googleurl/src/gurl.h" | 30 #include "googleurl/src/gurl.h" |
| 29 #include "googleurl/src/url_util.h" | 31 #include "googleurl/src/url_util.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // retyping it) as reloads too. | 315 // retyping it) as reloads too. |
| 314 match.transition = PageTransition::RELOAD; | 316 match.transition = PageTransition::RELOAD; |
| 315 } else if (for_drop || ((paste_state_ != NONE) && | 317 } else if (for_drop || ((paste_state_ != NONE) && |
| 316 match.is_history_what_you_typed_match)) { | 318 match.is_history_what_you_typed_match)) { |
| 317 // When the user pasted in a URL and hit enter, score it like a link click | 319 // When the user pasted in a URL and hit enter, score it like a link click |
| 318 // rather than a normal typed URL, so it doesn't get inline autocompleted | 320 // rather than a normal typed URL, so it doesn't get inline autocompleted |
| 319 // as aggressively later. | 321 // as aggressively later. |
| 320 match.transition = PageTransition::LINK; | 322 match.transition = PageTransition::LINK; |
| 321 } | 323 } |
| 322 | 324 |
| 325 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || |
| 326 match.type == AutocompleteMatch::SEARCH_HISTORY || |
| 327 match.type == AutocompleteMatch::SEARCH_SUGGEST) { |
| 328 const TemplateURL* default_provider = |
| 329 profile_->GetTemplateURLModel()->GetDefaultSearchProvider(); |
| 330 if (default_provider && default_provider->url() && |
| 331 default_provider->url()->HasGoogleBaseURLs()) |
| 332 GoogleURLTracker::GoogleURLSearchCommitted(); |
| 333 } |
| 323 view_->OpenURL(match.destination_url, disposition, match.transition, | 334 view_->OpenURL(match.destination_url, disposition, match.transition, |
| 324 alternate_nav_url, AutocompletePopupModel::kNoMatch, | 335 alternate_nav_url, AutocompletePopupModel::kNoMatch, |
| 325 is_keyword_hint_ ? std::wstring() : keyword_); | 336 is_keyword_hint_ ? std::wstring() : keyword_); |
| 326 } | 337 } |
| 327 | 338 |
| 328 void AutocompleteEditModel::OpenURL(const GURL& url, | 339 void AutocompleteEditModel::OpenURL(const GURL& url, |
| 329 WindowOpenDisposition disposition, | 340 WindowOpenDisposition disposition, |
| 330 PageTransition::Type transition, | 341 PageTransition::Type transition, |
| 331 const GURL& alternate_nav_url, | 342 const GURL& alternate_nav_url, |
| 332 size_t index, | 343 size_t index, |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 AutocompleteMatch* match, | 723 AutocompleteMatch* match, |
| 713 GURL* alternate_nav_url) const { | 724 GURL* alternate_nav_url) const { |
| 714 if (popup_->IsOpen() || query_in_progress()) { | 725 if (popup_->IsOpen() || query_in_progress()) { |
| 715 popup_->InfoForCurrentSelection(match, alternate_nav_url); | 726 popup_->InfoForCurrentSelection(match, alternate_nav_url); |
| 716 } else { | 727 } else { |
| 717 profile_->GetAutocompleteClassifier()->Classify( | 728 profile_->GetAutocompleteClassifier()->Classify( |
| 718 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(), match, | 729 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(), match, |
| 719 alternate_nav_url); | 730 alternate_nav_url); |
| 720 } | 731 } |
| 721 } | 732 } |
| OLD | NEW |