OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_edit.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 const AutocompleteResult& AutocompleteEditModel::result() const { | 578 const AutocompleteResult& AutocompleteEditModel::result() const { |
579 return autocomplete_controller_->result(); | 579 return autocomplete_controller_->result(); |
580 } | 580 } |
581 | 581 |
582 void AutocompleteEditModel::OnSetFocus(bool control_down) { | 582 void AutocompleteEditModel::OnSetFocus(bool control_down) { |
583 has_focus_ = true; | 583 has_focus_ = true; |
584 control_key_state_ = control_down ? DOWN_WITHOUT_CHANGE : UP; | 584 control_key_state_ = control_down ? DOWN_WITHOUT_CHANGE : UP; |
585 NotificationService::current()->Notify(NotificationType::OMNIBOX_FOCUSED, | 585 NotificationService::current()->Notify(NotificationType::OMNIBOX_FOCUSED, |
586 Source<AutocompleteEditModel>(this), | 586 Source<AutocompleteEditModel>(this), |
587 NotificationService::NoDetails()); | 587 NotificationService::NoDetails()); |
| 588 InstantController* instant = controller_->GetInstant(); |
| 589 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); |
| 590 if (instant && tab) |
| 591 instant->OnAutocompleteGotFocus(tab); |
588 } | 592 } |
589 | 593 |
590 void AutocompleteEditModel::OnWillKillFocus( | 594 void AutocompleteEditModel::OnWillKillFocus( |
591 gfx::NativeView view_gaining_focus) { | 595 gfx::NativeView view_gaining_focus) { |
592 SetSuggestedText(string16(), INSTANT_COMPLETE_NOW); | 596 SetSuggestedText(string16(), INSTANT_COMPLETE_NOW); |
593 | 597 |
594 InstantController* instant = controller_->GetInstant(); | 598 InstantController* instant = controller_->GetInstant(); |
595 if (instant) | 599 if (instant) |
596 instant->OnAutocompleteLostFocus(view_gaining_focus); | 600 instant->OnAutocompleteLostFocus(view_gaining_focus); |
597 } | 601 } |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 // static | 1010 // static |
1007 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { | 1011 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { |
1008 switch (c) { | 1012 switch (c) { |
1009 case 0x0020: // Space | 1013 case 0x0020: // Space |
1010 case 0x3000: // Ideographic Space | 1014 case 0x3000: // Ideographic Space |
1011 return true; | 1015 return true; |
1012 default: | 1016 default: |
1013 return false; | 1017 return false; |
1014 } | 1018 } |
1015 } | 1019 } |
OLD | NEW |