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

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

Issue 13141002: Use Instant suggested match type for Instant temporary text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_extended_browsertest.cc » ('j') | 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 return AutocompleteMatch::IsSearchType(match.type); 542 return AutocompleteMatch::IsSearchType(match.type);
543 } 543 }
544 544
545 void OmniboxEditModel::AcceptInput(WindowOpenDisposition disposition, 545 void OmniboxEditModel::AcceptInput(WindowOpenDisposition disposition,
546 bool for_drop) { 546 bool for_drop) {
547 // Get the URL and transition type for the selected entry. 547 // Get the URL and transition type for the selected entry.
548 AutocompleteMatch match; 548 AutocompleteMatch match;
549 GURL alternate_nav_url; 549 GURL alternate_nav_url;
550 GetInfoForCurrentText(&match, &alternate_nav_url); 550 GetInfoForCurrentText(&match, &alternate_nav_url);
551 551
552 // If Instant provided the current match, let it decide whether it should be
553 // treated as a navigation or search. http://crbug.com/224522.
554 if (is_temporary_text_set_by_instant_)
555 match.transition = content::PAGE_TRANSITION_GENERATED;
Peter Kasting 2013/03/28 20:35:00 It's not at all clear to me why this fixes the pro
556
552 // If CTRL is down it means the user wants to append ".com" to the text he 557 // If CTRL is down it means the user wants to append ".com" to the text he
553 // typed. If we can successfully generate a URL_WHAT_YOU_TYPED match doing 558 // typed. If we can successfully generate a URL_WHAT_YOU_TYPED match doing
554 // that, then we use this. 559 // that, then we use this.
555 if (control_key_state_ == DOWN_WITHOUT_CHANGE && !KeywordIsSelected()) { 560 if (control_key_state_ == DOWN_WITHOUT_CHANGE && !KeywordIsSelected()) {
556 // Generate a new AutocompleteInput, copying the latest one but using "com" 561 // Generate a new AutocompleteInput, copying the latest one but using "com"
557 // as the desired TLD. Then use this autocomplete input to generate a 562 // as the desired TLD. Then use this autocomplete input to generate a
558 // URL_WHAT_YOU_TYPED AutocompleteMatch. Note that using the most recent 563 // URL_WHAT_YOU_TYPED AutocompleteMatch. Note that using the most recent
559 // input instead of the currently visible text means we'll ignore any 564 // input instead of the currently visible text means we'll ignore any
560 // visible inline autocompletion: if a user types "foo" and is autocompleted 565 // visible inline autocompletion: if a user types "foo" and is autocompleted
561 // to "foodnetwork.com", ctrl-enter will navigate to "foo.com", not 566 // to "foodnetwork.com", ctrl-enter will navigate to "foo.com", not
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 instant->OmniboxFocusChanged(state, reason, NULL); 1388 instant->OmniboxFocusChanged(state, reason, NULL);
1384 1389
1385 // Update state and notify view if the omnibox has focus and the caret 1390 // Update state and notify view if the omnibox has focus and the caret
1386 // visibility changed. 1391 // visibility changed.
1387 const bool was_caret_visible = is_caret_visible(); 1392 const bool was_caret_visible = is_caret_visible();
1388 focus_state_ = state; 1393 focus_state_ = state;
1389 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1394 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1390 is_caret_visible() != was_caret_visible) 1395 is_caret_visible() != was_caret_visible)
1391 view_->ApplyCaretVisibility(); 1396 view_->ApplyCaretVisibility();
1392 } 1397 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/search/instant_extended_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698