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 "components/omnibox/browser/omnibox_edit_model.h" | 5 #include "components/omnibox/browser/omnibox_edit_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 // we assume that the cursor is simply at the end of input. | 505 // we assume that the cursor is simply at the end of input. |
506 // One example is when user presses Ctrl key while having a highlighted | 506 // One example is when user presses Ctrl key while having a highlighted |
507 // inline autocomplete text. | 507 // inline autocomplete text. |
508 // TODO: Rethink how we are going to handle this case to avoid | 508 // TODO: Rethink how we are going to handle this case to avoid |
509 // inconsistent behavior when user presses Ctrl key. | 509 // inconsistent behavior when user presses Ctrl key. |
510 // See http://crbug.com/165961 and http://crbug.com/165968 for more details. | 510 // See http://crbug.com/165961 and http://crbug.com/165968 for more details. |
511 cursor_position = user_text_.length(); | 511 cursor_position = user_text_.length(); |
512 } | 512 } |
513 | 513 |
514 GURL current_url; | 514 GURL current_url; |
515 if (client_->CurrentPageExists() && view_->IsIndicatingQueryRefinement()) | 515 if (client_->CurrentPageExists()) |
516 current_url = client_->GetURL(); | 516 current_url = client_->GetURL(); |
517 input_ = AutocompleteInput( | 517 input_ = AutocompleteInput( |
518 user_text_, cursor_position, std::string(), current_url, ClassifyPage(), | 518 user_text_, cursor_position, std::string(), current_url, ClassifyPage(), |
519 prevent_inline_autocomplete || just_deleted_text_ || | 519 prevent_inline_autocomplete || just_deleted_text_ || |
520 (has_selected_text && inline_autocomplete_text_.empty()) || | 520 (has_selected_text && inline_autocomplete_text_.empty()) || |
521 (paste_state_ != NONE), | 521 (paste_state_ != NONE), |
522 is_keyword_selected(), | 522 is_keyword_selected(), |
523 is_keyword_selected() || allow_exact_keyword_match_, true, false, | 523 is_keyword_selected() || allow_exact_keyword_match_, true, false, |
524 client_->GetSchemeClassifier()); | 524 client_->GetSchemeClassifier()); |
525 | 525 |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 // Update state and notify view if the omnibox has focus and the caret | 1452 // Update state and notify view if the omnibox has focus and the caret |
1453 // visibility changed. | 1453 // visibility changed. |
1454 const bool was_caret_visible = is_caret_visible(); | 1454 const bool was_caret_visible = is_caret_visible(); |
1455 focus_state_ = state; | 1455 focus_state_ = state; |
1456 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1456 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1457 is_caret_visible() != was_caret_visible) | 1457 is_caret_visible() != was_caret_visible) |
1458 view_->ApplyCaretVisibility(); | 1458 view_->ApplyCaretVisibility(); |
1459 | 1459 |
1460 client_->OnFocusChanged(focus_state_, reason); | 1460 client_->OnFocusChanged(focus_state_, reason); |
1461 } | 1461 } |
OLD | NEW |