| 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 OmniboxPopupModel::kNoMatch); | 637 OmniboxPopupModel::kNoMatch); |
| 638 } | 638 } |
| 639 | 639 |
| 640 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, | 640 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, |
| 641 WindowOpenDisposition disposition, | 641 WindowOpenDisposition disposition, |
| 642 const GURL& alternate_nav_url, | 642 const GURL& alternate_nav_url, |
| 643 size_t index) { | 643 size_t index) { |
| 644 const string16& user_text = | 644 const string16& user_text = |
| 645 user_input_in_progress_ ? user_text_ : permanent_text_; | 645 user_input_in_progress_ ? user_text_ : permanent_text_; |
| 646 scoped_ptr<OmniboxNavigationObserver> observer( | 646 scoped_ptr<OmniboxNavigationObserver> observer( |
| 647 new OmniboxNavigationObserver(profile_, user_text, match, | 647 new OmniboxNavigationObserver( |
| 648 alternate_nav_url)); | 648 profile_, user_text, match, |
| 649 autocomplete_controller()->history_url_provider()->SuggestExactInput( |
| 650 user_text, alternate_nav_url, |
| 651 AutocompleteInput::HasHTTPScheme(user_text)))); |
| 649 | 652 |
| 650 // We only care about cases where there is a selection (i.e. the popup is | 653 // We only care about cases where there is a selection (i.e. the popup is |
| 651 // open). | 654 // open). |
| 652 if (popup_model()->IsOpen()) { | 655 if (popup_model()->IsOpen()) { |
| 653 const base::TimeTicks& now(base::TimeTicks::Now()); | 656 const base::TimeTicks& now(base::TimeTicks::Now()); |
| 654 base::TimeDelta elapsed_time_since_user_first_modified_omnibox( | 657 base::TimeDelta elapsed_time_since_user_first_modified_omnibox( |
| 655 now - time_user_first_modified_omnibox_); | 658 now - time_user_first_modified_omnibox_); |
| 656 base::TimeDelta elapsed_time_since_last_change_to_default_match( | 659 base::TimeDelta elapsed_time_since_last_change_to_default_match( |
| 657 now - autocomplete_controller()->last_time_default_match_changed()); | 660 now - autocomplete_controller()->last_time_default_match_changed()); |
| 658 // These elapsed times don't really make sense for ZeroSuggest matches | 661 // These elapsed times don't really make sense for ZeroSuggest matches |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 instant->OmniboxFocusChanged(state, reason, NULL); | 1387 instant->OmniboxFocusChanged(state, reason, NULL); |
| 1385 | 1388 |
| 1386 // Update state and notify view if the omnibox has focus and the caret | 1389 // Update state and notify view if the omnibox has focus and the caret |
| 1387 // visibility changed. | 1390 // visibility changed. |
| 1388 const bool was_caret_visible = is_caret_visible(); | 1391 const bool was_caret_visible = is_caret_visible(); |
| 1389 focus_state_ = state; | 1392 focus_state_ = state; |
| 1390 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1393 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1391 is_caret_visible() != was_caret_visible) | 1394 is_caret_visible() != was_caret_visible) |
| 1392 view_->ApplyCaretVisibility(); | 1395 view_->ApplyCaretVisibility(); |
| 1393 } | 1396 } |
| OLD | NEW |