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

Side by Side Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 3152029: Ctrl-based actions should take precedence over ctrl-enter (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Cleaning things up Created 10 years, 4 months 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
OLDNEW
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/history_url_provider.h" 5 #include "chrome/browser/autocomplete/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // * and the user has specified a TLD, 396 // * and the user has specified a TLD,
397 // * and the input _without_ the TLD _is_ in the history DB, 397 // * and the input _without_ the TLD _is_ in the history DB,
398 // * ...then just before pressing "ctrl" the best match we supplied was the 398 // * ...then just before pressing "ctrl" the best match we supplied was the
399 // what-you-typed match, so stick with it by promoting this. 399 // what-you-typed match, so stick with it by promoting this.
400 history::URLRow info; 400 history::URLRow info;
401 if (!db->GetRowForURL(match->destination_url, &info)) { 401 if (!db->GetRowForURL(match->destination_url, &info)) {
402 if (input.desired_tld().empty()) 402 if (input.desired_tld().empty())
403 return false; 403 return false;
404 GURL destination_url(URLFixerUpper::FixupURL(WideToUTF8(input.text()), 404 GURL destination_url(URLFixerUpper::FixupURL(WideToUTF8(input.text()),
405 std::string())); 405 std::string()));
406 if (!db->GetRowForURL(destination_url, &info)) 406 if (!db->GetRowForURL(destination_url, NULL))
407 return false; 407 return false;
408
409 // If we got here, then we hit the tricky corner case. Make sure that
410 // |info| corresponds to the right URL.
411 info = history::URLRow(match->destination_url);
408 } else { 412 } else {
409 // We have data for this match, use it. 413 // We have data for this match, use it.
410 match->deletable = true; 414 match->deletable = true;
411 match->description = UTF16ToWide(info.title()); 415 match->description = UTF16ToWide(info.title());
412 AutocompleteMatch::ClassifyMatchInString(input.text(), 416 AutocompleteMatch::ClassifyMatchInString(input.text(),
413 UTF16ToWide(info.title()), 417 UTF16ToWide(info.title()),
414 ACMatchClassification::NONE, &match->description_class); 418 ACMatchClassification::NONE, &match->description_class);
415 } 419 }
416 420
417 // Promote as an exact match. 421 // Promote as an exact match.
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 &match.contents_class); 906 &match.contents_class);
903 } 907 }
904 match.description = UTF16ToWide(info.title()); 908 match.description = UTF16ToWide(info.title());
905 AutocompleteMatch::ClassifyMatchInString(params->input.text(), 909 AutocompleteMatch::ClassifyMatchInString(params->input.text(),
906 UTF16ToWide(info.title()), 910 UTF16ToWide(info.title()),
907 ACMatchClassification::NONE, 911 ACMatchClassification::NONE,
908 &match.description_class); 912 &match.description_class);
909 913
910 return match; 914 return match;
911 } 915 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698