OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 // treat this as a reload. | 462 // treat this as a reload. |
463 match.transition = PageTransition::RELOAD; | 463 match.transition = PageTransition::RELOAD; |
464 } else if (for_drop || ((paste_state_ != NONE) && | 464 } else if (for_drop || ((paste_state_ != NONE) && |
465 match.is_history_what_you_typed_match)) { | 465 match.is_history_what_you_typed_match)) { |
466 // When the user pasted in a URL and hit enter, score it like a link click | 466 // When the user pasted in a URL and hit enter, score it like a link click |
467 // rather than a normal typed URL, so it doesn't get inline autocompleted | 467 // rather than a normal typed URL, so it doesn't get inline autocompleted |
468 // as aggressively later. | 468 // as aggressively later. |
469 match.transition = PageTransition::LINK; | 469 match.transition = PageTransition::LINK; |
470 } | 470 } |
471 | 471 |
472 if (match.type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED || | 472 if (match.template_url && match.template_url->url() && |
473 match.type == AutocompleteMatch::SEARCH_HISTORY || | 473 match.template_url->url()->HasGoogleBaseURLs()) { |
474 match.type == AutocompleteMatch::SEARCH_SUGGEST) { | 474 GoogleURLTracker::GoogleURLSearchCommitted(); |
475 const TemplateURL* default_provider = | |
476 TemplateURLServiceFactory::GetForProfile(profile_)-> | |
477 GetDefaultSearchProvider(); | |
478 if (default_provider && default_provider->url() && | |
479 default_provider->url()->HasGoogleBaseURLs()) { | |
480 GoogleURLTracker::GoogleURLSearchCommitted(); | |
481 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | 475 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) |
482 // TODO(pastarmovj): Remove these metrics once we have proven that (close | 476 // TODO(pastarmovj): Remove these metrics once we have proven that (close |
483 // to) none searches that should have RLZ are sent out without one. | 477 // to) none searches that should have RLZ are sent out without one. |
484 default_provider->url()->CollectRLZMetrics(); | 478 match.template_url->url()->CollectRLZMetrics(); |
485 #endif | 479 #endif |
486 } | |
487 } | 480 } |
488 | 481 |
489 view_->OpenMatch(match, disposition, alternate_nav_url, | 482 view_->OpenMatch(match, disposition, alternate_nav_url, |
490 AutocompletePopupModel::kNoMatch, | 483 AutocompletePopupModel::kNoMatch, |
491 is_keyword_hint_ ? string16() : keyword_); | 484 is_keyword_hint_ ? string16() : keyword_); |
492 } | 485 } |
493 | 486 |
494 void AutocompleteEditModel::OpenMatch(const AutocompleteMatch& match, | 487 void AutocompleteEditModel::OpenMatch(const AutocompleteMatch& match, |
495 WindowOpenDisposition disposition, | 488 WindowOpenDisposition disposition, |
496 const GURL& alternate_nav_url, | 489 const GURL& alternate_nav_url, |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 // static | 1018 // static |
1026 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { | 1019 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { |
1027 switch (c) { | 1020 switch (c) { |
1028 case 0x0020: // Space | 1021 case 0x0020: // Space |
1029 case 0x3000: // Ideographic Space | 1022 case 0x3000: // Ideographic Space |
1030 return true; | 1023 return true; |
1031 default: | 1024 default: |
1032 return false; | 1025 return false; |
1033 } | 1026 } |
1034 } | 1027 } |
OLD | NEW |