| 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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 << "default match changed."; | 599 << "default match changed."; |
| 600 if (index != OmniboxPopupModel::kNoMatch) | 600 if (index != OmniboxPopupModel::kNoMatch) |
| 601 log.selected_index = index; | 601 log.selected_index = index; |
| 602 if (match.inline_autocomplete_offset != string16::npos) { | 602 if (match.inline_autocomplete_offset != string16::npos) { |
| 603 DCHECK_GE(match.fill_into_edit.length(), | 603 DCHECK_GE(match.fill_into_edit.length(), |
| 604 match.inline_autocomplete_offset); | 604 match.inline_autocomplete_offset); |
| 605 log.completed_length = | 605 log.completed_length = |
| 606 match.fill_into_edit.length() - match.inline_autocomplete_offset; | 606 match.fill_into_edit.length() - match.inline_autocomplete_offset; |
| 607 } | 607 } |
| 608 | 608 |
| 609 if (disposition == CURRENT_TAB) { | 609 if ((disposition == CURRENT_TAB) && delegate_->CurrentPageExists()) { |
| 610 // If we know the destination is being opened in the current tab, | 610 // If we know the destination is being opened in the current tab, |
| 611 // we can easily get the tab ID. (If it's being opened in a new | 611 // we can easily get the tab ID. (If it's being opened in a new |
| 612 // tab, we don't know the tab ID yet.) | 612 // tab, we don't know the tab ID yet.) |
| 613 log.tab_id = SessionTabHelper::FromWebContents( | 613 log.tab_id = SessionTabHelper::FromWebContents( |
| 614 controller_->GetWebContents())->session_id().id(); | 614 controller_->GetWebContents())->session_id().id(); |
| 615 } | 615 } |
| 616 autocomplete_controller_->AddProvidersInfo(&log.providers_info); | 616 autocomplete_controller_->AddProvidersInfo(&log.providers_info); |
| 617 content::NotificationService::current()->Notify( | 617 content::NotificationService::current()->Notify( |
| 618 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, | 618 chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| 619 content::Source<Profile>(profile_), | 619 content::Source<Profile>(profile_), |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 instant->OmniboxFocusChanged(state, reason, NULL); | 1343 instant->OmniboxFocusChanged(state, reason, NULL); |
| 1344 | 1344 |
| 1345 // Update state and notify view if the omnibox has focus and the caret | 1345 // Update state and notify view if the omnibox has focus and the caret |
| 1346 // visibility changed. | 1346 // visibility changed. |
| 1347 const bool was_caret_visible = is_caret_visible(); | 1347 const bool was_caret_visible = is_caret_visible(); |
| 1348 focus_state_ = state; | 1348 focus_state_ = state; |
| 1349 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1349 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1350 is_caret_visible() != was_caret_visible) | 1350 is_caret_visible() != was_caret_visible) |
| 1351 view_->ApplyCaretVisibility(); | 1351 view_->ApplyCaretVisibility(); |
| 1352 } | 1352 } |
| OLD | NEW |