| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/profile.h" | 22 #include "chrome/browser/profile.h" |
| 23 #include "chrome/browser/search_engines/template_url.h" | 23 #include "chrome/browser/search_engines/template_url.h" |
| 24 #include "chrome/browser/search_engines/template_url_model.h" | 24 #include "chrome/browser/search_engines/template_url_model.h" |
| 25 #include "chrome/common/notification_service.h" | 25 #include "chrome/common/notification_service.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
| 28 #include "googleurl/src/url_util.h" | 28 #include "googleurl/src/url_util.h" |
| 29 #include "third_party/skia/include/core/SkBitmap.h" | 29 #include "third_party/skia/include/core/SkBitmap.h" |
| 30 | 30 |
| 31 /////////////////////////////////////////////////////////////////////////////// | 31 /////////////////////////////////////////////////////////////////////////////// |
| 32 // AutocompleteEditController |
| 33 |
| 34 AutocompleteEditController::~AutocompleteEditController() { |
| 35 } |
| 36 |
| 37 /////////////////////////////////////////////////////////////////////////////// |
| 38 // AutocompleteEditModel::State |
| 39 |
| 40 AutocompleteEditModel::State::State(bool user_input_in_progress, |
| 41 const std::wstring& user_text, |
| 42 const std::wstring& keyword, |
| 43 bool is_keyword_hint, |
| 44 KeywordUIState keyword_ui_state) |
| 45 : user_input_in_progress(user_input_in_progress), |
| 46 user_text(user_text), |
| 47 keyword(keyword), |
| 48 is_keyword_hint(is_keyword_hint), |
| 49 keyword_ui_state(keyword_ui_state) { |
| 50 } |
| 51 |
| 52 AutocompleteEditModel::State::~State() { |
| 53 } |
| 54 |
| 55 /////////////////////////////////////////////////////////////////////////////// |
| 32 // AutocompleteEditModel | 56 // AutocompleteEditModel |
| 33 | 57 |
| 34 AutocompleteEditModel::AutocompleteEditModel( | 58 AutocompleteEditModel::AutocompleteEditModel( |
| 35 AutocompleteEditView* view, | 59 AutocompleteEditView* view, |
| 36 AutocompleteEditController* controller, | 60 AutocompleteEditController* controller, |
| 37 Profile* profile) | 61 Profile* profile) |
| 38 : view_(view), | 62 : view_(view), |
| 39 popup_(NULL), | 63 popup_(NULL), |
| 40 controller_(controller), | 64 controller_(controller), |
| 41 has_focus_(false), | 65 has_focus_(false), |
| 42 user_input_in_progress_(false), | 66 user_input_in_progress_(false), |
| 43 just_deleted_text_(false), | 67 just_deleted_text_(false), |
| 44 has_temporary_text_(false), | 68 has_temporary_text_(false), |
| 45 original_keyword_ui_state_(NORMAL), | 69 original_keyword_ui_state_(NORMAL), |
| 46 paste_state_(NONE), | 70 paste_state_(NONE), |
| 47 control_key_state_(UP), | 71 control_key_state_(UP), |
| 48 is_keyword_hint_(false), | 72 is_keyword_hint_(false), |
| 49 keyword_ui_state_(NORMAL), | 73 keyword_ui_state_(NORMAL), |
| 50 paste_and_go_transition_(PageTransition::TYPED), | 74 paste_and_go_transition_(PageTransition::TYPED), |
| 51 profile_(profile) { | 75 profile_(profile) { |
| 52 } | 76 } |
| 53 | 77 |
| 78 AutocompleteEditModel::~AutocompleteEditModel() { |
| 79 } |
| 80 |
| 54 void AutocompleteEditModel::SetPopupModel(AutocompletePopupModel* popup_model) { | 81 void AutocompleteEditModel::SetPopupModel(AutocompletePopupModel* popup_model) { |
| 55 popup_ = popup_model; | 82 popup_ = popup_model; |
| 56 registrar_.Add(this, | 83 registrar_.Add(this, |
| 57 NotificationType::AUTOCOMPLETE_CONTROLLER_DEFAULT_MATCH_UPDATED, | 84 NotificationType::AUTOCOMPLETE_CONTROLLER_DEFAULT_MATCH_UPDATED, |
| 58 Source<AutocompleteController>(popup_->autocomplete_controller())); | 85 Source<AutocompleteController>(popup_->autocomplete_controller())); |
| 59 } | 86 } |
| 60 | 87 |
| 61 void AutocompleteEditModel::SetProfile(Profile* profile) { | 88 void AutocompleteEditModel::SetProfile(Profile* profile) { |
| 62 DCHECK(profile); | 89 DCHECK(profile); |
| 63 profile_ = profile; | 90 profile_ = profile; |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 AutocompleteMatch* match, | 703 AutocompleteMatch* match, |
| 677 GURL* alternate_nav_url) const { | 704 GURL* alternate_nav_url) const { |
| 678 if (popup_->IsOpen() || query_in_progress()) { | 705 if (popup_->IsOpen() || query_in_progress()) { |
| 679 popup_->InfoForCurrentSelection(match, alternate_nav_url); | 706 popup_->InfoForCurrentSelection(match, alternate_nav_url); |
| 680 } else { | 707 } else { |
| 681 profile_->GetAutocompleteClassifier()->Classify( | 708 profile_->GetAutocompleteClassifier()->Classify( |
| 682 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(), match, | 709 UserTextFromDisplayText(view_->GetText()), GetDesiredTLD(), match, |
| 683 alternate_nav_url); | 710 alternate_nav_url); |
| 684 } | 711 } |
| 685 } | 712 } |
| OLD | NEW |