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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 bool keyword_is_selected = KeywordIsSelected(); | 490 bool keyword_is_selected = KeywordIsSelected(); |
491 omnibox_controller_->StartAutocomplete( | 491 omnibox_controller_->StartAutocomplete( |
492 user_text_, | 492 user_text_, |
493 cursor_position, | 493 cursor_position, |
494 current_url, | 494 current_url, |
495 ClassifyPage(), | 495 ClassifyPage(), |
496 prevent_inline_autocomplete || just_deleted_text_ || | 496 prevent_inline_autocomplete || just_deleted_text_ || |
497 (has_selected_text && inline_autocomplete_text_.empty()) || | 497 (has_selected_text && inline_autocomplete_text_.empty()) || |
498 (paste_state_ != NONE), | 498 (paste_state_ != NONE), |
499 keyword_is_selected, | 499 keyword_is_selected, |
500 keyword_is_selected || allow_exact_keyword_match_, | 500 keyword_is_selected || allow_exact_keyword_match_); |
501 controller_->GetOmniboxBounds().x()); | |
502 } | 501 } |
503 | 502 |
504 void OmniboxEditModel::StopAutocomplete() { | 503 void OmniboxEditModel::StopAutocomplete() { |
505 autocomplete_controller()->Stop(true); | 504 autocomplete_controller()->Stop(true); |
506 } | 505 } |
507 | 506 |
508 bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { | 507 bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { |
509 if (!view_->command_updater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL)) | 508 if (!view_->command_updater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL)) |
510 return false; | 509 return false; |
511 | 510 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 instant->OmniboxFocusChanged(state, reason, NULL); | 1296 instant->OmniboxFocusChanged(state, reason, NULL); |
1298 | 1297 |
1299 // Update state and notify view if the omnibox has focus and the caret | 1298 // Update state and notify view if the omnibox has focus and the caret |
1300 // visibility changed. | 1299 // visibility changed. |
1301 const bool was_caret_visible = is_caret_visible(); | 1300 const bool was_caret_visible = is_caret_visible(); |
1302 focus_state_ = state; | 1301 focus_state_ = state; |
1303 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1302 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1304 is_caret_visible() != was_caret_visible) | 1303 is_caret_visible() != was_caret_visible) |
1305 view_->ApplyCaretVisibility(); | 1304 view_->ApplyCaretVisibility(); |
1306 } | 1305 } |
OLD | NEW |