OLD | NEW |
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 performed_instant = omnibox_controller_->DoInstant( | 297 performed_instant = omnibox_controller_->DoInstant( |
298 current_match, user_text, view_->GetText(), start, end, | 298 current_match, user_text, view_->GetText(), start, end, |
299 user_input_in_progress_, in_escape_handler_, | 299 user_input_in_progress_, in_escape_handler_, |
300 view_->DeleteAtEndPressed() || just_deleted_text_, | 300 view_->DeleteAtEndPressed() || just_deleted_text_, |
301 KeywordIsSelected()); | 301 KeywordIsSelected()); |
302 } | 302 } |
303 | 303 |
304 if (!performed_instant) { | 304 if (!performed_instant) { |
305 // Hide any suggestions we might be showing. | 305 // Hide any suggestions we might be showing. |
306 view_->SetInstantSuggestion(string16()); | 306 view_->SetInstantSuggestion(string16()); |
307 | |
308 // No need to wait any longer for Instant. | |
309 omnibox_controller_->FinalizeInstantQuery(string16(), InstantSuggestion()); | |
310 } | 307 } |
311 | 308 |
312 switch (recommended_action) { | 309 switch (recommended_action) { |
313 case AutocompleteActionPredictor::ACTION_PRERENDER: | 310 case AutocompleteActionPredictor::ACTION_PRERENDER: |
314 // It's possible that there is no current page, for instance if the tab | 311 // It's possible that there is no current page, for instance if the tab |
315 // has been closed or on return from a sleep state. | 312 // has been closed or on return from a sleep state. |
316 // (http://crbug.com/105689) | 313 // (http://crbug.com/105689) |
317 if (!delegate_->CurrentPageExists()) | 314 if (!delegate_->CurrentPageExists()) |
318 break; | 315 break; |
319 // Ask for prerendering if the destination URL is different than the | 316 // Ask for prerendering if the destination URL is different than the |
(...skipping 1091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 instant->OmniboxFocusChanged(state, reason, NULL); | 1408 instant->OmniboxFocusChanged(state, reason, NULL); |
1412 | 1409 |
1413 // Update state and notify view if the omnibox has focus and the caret | 1410 // Update state and notify view if the omnibox has focus and the caret |
1414 // visibility changed. | 1411 // visibility changed. |
1415 const bool was_caret_visible = is_caret_visible(); | 1412 const bool was_caret_visible = is_caret_visible(); |
1416 focus_state_ = state; | 1413 focus_state_ = state; |
1417 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1414 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1418 is_caret_visible() != was_caret_visible) | 1415 is_caret_visible() != was_caret_visible) |
1419 view_->ApplyCaretVisibility(); | 1416 view_->ApplyCaretVisibility(); |
1420 } | 1417 } |
OLD | NEW |