Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 11198074: Initial implementation of dedupping search provider's URLs. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Add a missing include. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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(&current_match, NULL); 591 GetInfoForCurrentText(&current_match, NULL);
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/popup_blocker_browsertest.cc ('k') | chrome/browser/ui/omnibox/omnibox_popup_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698