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

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

Issue 54903004: Make HistoryURLProvider::SuggestExactInput() non-static, and take only the (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // typed. If we can successfully generate a URL_WHAT_YOU_TYPED match doing 576 // typed. If we can successfully generate a URL_WHAT_YOU_TYPED match doing
577 // that, then we use this. These matches are marked as generated by the 577 // that, then we use this. These matches are marked as generated by the
578 // HistoryURLProvider so we only generate them if this provider is present. 578 // HistoryURLProvider so we only generate them if this provider is present.
579 if (control_key_state_ == DOWN_WITHOUT_CHANGE && !KeywordIsSelected() && 579 if (control_key_state_ == DOWN_WITHOUT_CHANGE && !KeywordIsSelected() &&
580 autocomplete_controller()->history_url_provider()) { 580 autocomplete_controller()->history_url_provider()) {
581 // Generate a new AutocompleteInput, copying the latest one but using "com" 581 // Generate a new AutocompleteInput, copying the latest one but using "com"
582 // as the desired TLD. Then use this autocomplete input to generate a 582 // as the desired TLD. Then use this autocomplete input to generate a
583 // URL_WHAT_YOU_TYPED AutocompleteMatch. Note that using the most recent 583 // URL_WHAT_YOU_TYPED AutocompleteMatch. Note that using the most recent
584 // input instead of the currently visible text means we'll ignore any 584 // input instead of the currently visible text means we'll ignore any
585 // visible inline autocompletion: if a user types "foo" and is autocompleted 585 // visible inline autocompletion: if a user types "foo" and is autocompleted
586 // to "foodnetwork.com", ctrl-enter will navigate to "foo.com", not 586 // to "foodnetwork.com", ctrl-enter will navigate to "foo.com", not
587 // "foodnetwork.com". At the time of writing, this behavior matches 587 // "foodnetwork.com". At the time of writing, this behavior matches
588 // Internet Explorer, but not Firefox. 588 // Internet Explorer, but not Firefox.
589 const AutocompleteInput& old_input = autocomplete_controller()->input(); 589 const AutocompleteInput& old_input = autocomplete_controller()->input();
590 AutocompleteInput input( 590 AutocompleteInput input(
591 has_temporary_text_ ? 591 has_temporary_text_ ?
592 UserTextFromDisplayText(view_->GetText()) : old_input.text(), 592 UserTextFromDisplayText(view_->GetText()) : old_input.text(),
593 old_input.cursor_position(), ASCIIToUTF16("com"), 593 old_input.cursor_position(), ASCIIToUTF16("com"),
594 GURL(), old_input.current_page_classification(), 594 GURL(), old_input.current_page_classification(),
595 old_input.prevent_inline_autocomplete(), old_input.prefer_keyword(), 595 old_input.prevent_inline_autocomplete(), old_input.prefer_keyword(),
596 old_input.allow_exact_keyword_match(), old_input.matches_requested()); 596 old_input.allow_exact_keyword_match(), old_input.matches_requested());
597 AutocompleteMatch url_match = HistoryURLProvider::SuggestExactInput( 597 AutocompleteMatch url_match(
598 autocomplete_controller()->history_url_provider(), input, true); 598 autocomplete_controller()->history_url_provider()->SuggestExactInput(
599 input.text(), input.canonicalized_url(), false));
599 600
600 if (url_match.destination_url.is_valid()) { 601 if (url_match.destination_url.is_valid()) {
601 // We have a valid URL, we use this newly generated AutocompleteMatch. 602 // We have a valid URL, we use this newly generated AutocompleteMatch.
602 match = url_match; 603 match = url_match;
603 alternate_nav_url = GURL(); 604 alternate_nav_url = GURL();
604 } 605 }
605 } 606 }
606 607
607 if (!match.destination_url.is_valid()) 608 if (!match.destination_url.is_valid())
608 return; 609 return;
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 instant->OmniboxFocusChanged(state, reason, NULL); 1386 instant->OmniboxFocusChanged(state, reason, NULL);
1386 1387
1387 // Update state and notify view if the omnibox has focus and the caret 1388 // Update state and notify view if the omnibox has focus and the caret
1388 // visibility changed. 1389 // visibility changed.
1389 const bool was_caret_visible = is_caret_visible(); 1390 const bool was_caret_visible = is_caret_visible();
1390 focus_state_ = state; 1391 focus_state_ = state;
1391 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1392 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1392 is_caret_visible() != was_caret_visible) 1393 is_caret_visible() != was_caret_visible)
1393 view_->ApplyCaretVisibility(); 1394 view_->ApplyCaretVisibility();
1394 } 1395 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698