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

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

Issue 12450022: Don't call AcceptCurrentInstantPreview() when the user hits Tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 // Assume that the gray text we are committing is a search suggestion. 261 // Assume that the gray text we are committing is a search suggestion.
262 FinalizeInstantQuery(view_->GetText(), 262 FinalizeInstantQuery(view_->GetText(),
263 InstantSuggestion(suggestion, 263 InstantSuggestion(suggestion,
264 INSTANT_COMPLETE_NOW, 264 INSTANT_COMPLETE_NOW,
265 INSTANT_SUGGESTION_SEARCH), 265 INSTANT_SUGGESTION_SEARCH),
266 skip_inline_autocomplete); 266 skip_inline_autocomplete);
267 return true; 267 return true;
268 } 268 }
269 269
270 bool OmniboxEditModel::AcceptCurrentInstantPreview() {
271 return controller_->GetInstant() &&
272 controller_->GetInstant()->CommitIfPossible(INSTANT_COMMIT_PRESSED_ENTER);
273 }
274
275 void OmniboxEditModel::OnChanged() { 270 void OmniboxEditModel::OnChanged() {
276 // Don't call CurrentMatch() when there's no editing, as in this case we'll 271 // Don't call CurrentMatch() when there's no editing, as in this case we'll
277 // never actually use it. This avoids running the autocomplete providers (and 272 // never actually use it. This avoids running the autocomplete providers (and
278 // any systems they then spin up) during startup. 273 // any systems they then spin up) during startup.
279 const AutocompleteMatch& current_match = user_input_in_progress_ ? 274 const AutocompleteMatch& current_match = user_input_in_progress_ ?
280 CurrentMatch() : AutocompleteMatch(); 275 CurrentMatch() : AutocompleteMatch();
281 276
282 AutocompleteActionPredictor::Action recommended_action = 277 AutocompleteActionPredictor::Action recommended_action =
283 AutocompleteActionPredictor::ACTION_NONE; 278 AutocompleteActionPredictor::ACTION_NONE;
284 AutocompleteActionPredictor* action_predictor = 279 AutocompleteActionPredictor* action_predictor =
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 instant->OmniboxFocusChanged(state, reason, NULL); 1365 instant->OmniboxFocusChanged(state, reason, NULL);
1371 1366
1372 // Update state and notify view if the omnibox has focus and the caret 1367 // Update state and notify view if the omnibox has focus and the caret
1373 // visibility changed. 1368 // visibility changed.
1374 const bool was_caret_visible = is_caret_visible(); 1369 const bool was_caret_visible = is_caret_visible();
1375 focus_state_ = state; 1370 focus_state_ = state;
1376 if (focus_state_ != OMNIBOX_FOCUS_NONE && 1371 if (focus_state_ != OMNIBOX_FOCUS_NONE &&
1377 is_caret_visible() != was_caret_visible) 1372 is_caret_visible() != was_caret_visible)
1378 view_->ApplyCaretVisibility(); 1373 view_->ApplyCaretVisibility();
1379 } 1374 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698