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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 bool keyword_is_selected = KeywordIsSelected(); | 495 bool keyword_is_selected = KeywordIsSelected(); |
496 omnibox_controller_->StartAutocomplete( | 496 omnibox_controller_->StartAutocomplete( |
497 user_text_, | 497 user_text_, |
498 cursor_position, | 498 cursor_position, |
499 current_url, | 499 current_url, |
500 ClassifyPage(), | 500 ClassifyPage(), |
501 prevent_inline_autocomplete || just_deleted_text_ || | 501 prevent_inline_autocomplete || just_deleted_text_ || |
502 (has_selected_text && inline_autocomplete_text_.empty()) || | 502 (has_selected_text && inline_autocomplete_text_.empty()) || |
503 (paste_state_ != NONE), | 503 (paste_state_ != NONE), |
504 keyword_is_selected, | 504 keyword_is_selected, |
505 keyword_is_selected || allow_exact_keyword_match_, | 505 keyword_is_selected || allow_exact_keyword_match_); |
506 controller_->GetOmniboxBounds().x()); | |
507 } | 506 } |
508 | 507 |
509 void OmniboxEditModel::StopAutocomplete() { | 508 void OmniboxEditModel::StopAutocomplete() { |
510 autocomplete_controller()->Stop(true); | 509 autocomplete_controller()->Stop(true); |
511 } | 510 } |
512 | 511 |
513 bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { | 512 bool OmniboxEditModel::CanPasteAndGo(const string16& text) const { |
514 if (!view_->command_updater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL)) | 513 if (!view_->command_updater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL)) |
515 return false; | 514 return false; |
516 | 515 |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 instant->OmniboxFocusChanged(state, reason, NULL); | 1321 instant->OmniboxFocusChanged(state, reason, NULL); |
1323 | 1322 |
1324 // Update state and notify view if the omnibox has focus and the caret | 1323 // Update state and notify view if the omnibox has focus and the caret |
1325 // visibility changed. | 1324 // visibility changed. |
1326 const bool was_caret_visible = is_caret_visible(); | 1325 const bool was_caret_visible = is_caret_visible(); |
1327 focus_state_ = state; | 1326 focus_state_ = state; |
1328 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1327 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1329 is_caret_visible() != was_caret_visible) | 1328 is_caret_visible() != was_caret_visible) |
1330 view_->ApplyCaretVisibility(); | 1329 view_->ApplyCaretVisibility(); |
1331 } | 1330 } |
OLD | NEW |