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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 << "default match changed."; | 630 << "default match changed."; |
631 if (index != OmniboxPopupModel::kNoMatch) | 631 if (index != OmniboxPopupModel::kNoMatch) |
632 log.selected_index = index; | 632 log.selected_index = index; |
633 if (match.inline_autocomplete_offset != string16::npos) { | 633 if (match.inline_autocomplete_offset != string16::npos) { |
634 DCHECK_GE(match.fill_into_edit.length(), | 634 DCHECK_GE(match.fill_into_edit.length(), |
635 match.inline_autocomplete_offset); | 635 match.inline_autocomplete_offset); |
636 log.completed_length = | 636 log.completed_length = |
637 match.fill_into_edit.length() - match.inline_autocomplete_offset; | 637 match.fill_into_edit.length() - match.inline_autocomplete_offset; |
638 } | 638 } |
639 | 639 |
640 if (disposition == CURRENT_TAB) { | 640 if ((disposition == CURRENT_TAB) && delegate_->CurrentPageExists()) { |
641 // If we know the destination is being opened in the current tab, | 641 // If we know the destination is being opened in the current tab, |
642 // we can easily get the tab ID. (If it's being opened in a new | 642 // we can easily get the tab ID. (If it's being opened in a new |
643 // tab, we don't know the tab ID yet.) | 643 // tab, we don't know the tab ID yet.) |
644 log.tab_id = delegate_->GetSessionID().id(); | 644 log.tab_id = delegate_->GetSessionID().id(); |
645 } | 645 } |
646 autocomplete_controller_->AddProvidersInfo(&log.providers_info); | 646 autocomplete_controller_->AddProvidersInfo(&log.providers_info); |
647 content::NotificationService::current()->Notify( | 647 content::NotificationService::current()->Notify( |
648 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 648 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
649 content::Source<Profile>(profile_), | 649 content::Source<Profile>(profile_), |
650 content::Details<AutocompleteLog>(&log)); | 650 content::Details<AutocompleteLog>(&log)); |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 instant->OmniboxFocusChanged(state, reason, NULL); | 1370 instant->OmniboxFocusChanged(state, reason, NULL); |
1371 | 1371 |
1372 // Update state and notify view if the omnibox has focus and the caret | 1372 // Update state and notify view if the omnibox has focus and the caret |
1373 // visibility changed. | 1373 // visibility changed. |
1374 const bool was_caret_visible = is_caret_visible(); | 1374 const bool was_caret_visible = is_caret_visible(); |
1375 focus_state_ = state; | 1375 focus_state_ = state; |
1376 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1376 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
1377 is_caret_visible() != was_caret_visible) | 1377 is_caret_visible() != was_caret_visible) |
1378 view_->ApplyCaretVisibility(); | 1378 view_->ApplyCaretVisibility(); |
1379 } | 1379 } |
OLD | NEW |