OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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> |
| 8 |
7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
8 #include "base/string_util.h" | 10 #include "base/string_util.h" |
9 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 11 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
10 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 12 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
11 #include "chrome/browser/autocomplete/keyword_provider.h" | 13 #include "chrome/browser/autocomplete/keyword_provider.h" |
12 #include "chrome/browser/metrics/user_metrics.h" | 14 #include "chrome/browser/metrics/user_metrics.h" |
13 #include "chrome/browser/net/dns_global.h" | 15 #include "chrome/browser/net/dns_global.h" |
14 #include "chrome/browser/net/url_fixer_upper.h" | 16 #include "chrome/browser/net/url_fixer_upper.h" |
15 #include "chrome/browser/profile.h" | 17 #include "chrome/browser/profile.h" |
16 #include "chrome/browser/search_engines/template_url.h" | 18 #include "chrome/browser/search_engines/template_url.h" |
(...skipping 12 matching lines...) Expand all Loading... |
29 // for every edit because this will always be accessed on the main thread, so we | 31 // for every edit because this will always be accessed on the main thread, so we |
30 // won't have thread-safety problems. | 32 // won't have thread-safety problems. |
31 static AutocompleteController* synchronous_controller = NULL; | 33 static AutocompleteController* synchronous_controller = NULL; |
32 static int synchronous_controller_refcount = 0; | 34 static int synchronous_controller_refcount = 0; |
33 | 35 |
34 AutocompleteEditModel::AutocompleteEditModel( | 36 AutocompleteEditModel::AutocompleteEditModel( |
35 AutocompleteEditView* view, | 37 AutocompleteEditView* view, |
36 AutocompleteEditController* controller, | 38 AutocompleteEditController* controller, |
37 Profile* profile) | 39 Profile* profile) |
38 : view_(view), | 40 : view_(view), |
| 41 popup_(NULL), |
39 controller_(controller), | 42 controller_(controller), |
40 has_focus_(false), | 43 has_focus_(false), |
41 user_input_in_progress_(false), | 44 user_input_in_progress_(false), |
42 just_deleted_text_(false), | 45 just_deleted_text_(false), |
43 has_temporary_text_(false), | 46 has_temporary_text_(false), |
| 47 original_keyword_ui_state_(NORMAL), |
44 paste_state_(NONE), | 48 paste_state_(NONE), |
45 control_key_state_(UP), | 49 control_key_state_(UP), |
46 is_keyword_hint_(false), | 50 is_keyword_hint_(false), |
47 keyword_ui_state_(NORMAL), | 51 keyword_ui_state_(NORMAL), |
48 show_search_hint_(true), | 52 show_search_hint_(true), |
| 53 paste_and_go_transition_(PageTransition::TYPED), |
49 profile_(profile) { | 54 profile_(profile) { |
50 if (++synchronous_controller_refcount == 1) { | 55 if (++synchronous_controller_refcount == 1) { |
51 // We don't have a controller yet, so create one. No profile is set since | 56 // We don't have a controller yet, so create one. No profile is set since |
52 // we'll set this before each call to the controller. | 57 // we'll set this before each call to the controller. |
53 synchronous_controller = new AutocompleteController(NULL); | 58 synchronous_controller = new AutocompleteController(NULL); |
54 } | 59 } |
55 } | 60 } |
56 | 61 |
57 AutocompleteEditModel::~AutocompleteEditModel() { | 62 AutocompleteEditModel::~AutocompleteEditModel() { |
58 if (--synchronous_controller_refcount == 0) | 63 if (--synchronous_controller_refcount == 0) |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 // Get the URLs for the default match. | 628 // Get the URLs for the default match. |
624 const AutocompleteResult::const_iterator match = result.default_match(); | 629 const AutocompleteResult::const_iterator match = result.default_match(); |
625 if (transition) | 630 if (transition) |
626 *transition = match->transition; | 631 *transition = match->transition; |
627 if (is_history_what_you_typed_match) | 632 if (is_history_what_you_typed_match) |
628 *is_history_what_you_typed_match = match->is_history_what_you_typed_match; | 633 *is_history_what_you_typed_match = match->is_history_what_you_typed_match; |
629 if (alternate_nav_url) | 634 if (alternate_nav_url) |
630 *alternate_nav_url = result.alternate_nav_url(); | 635 *alternate_nav_url = result.alternate_nav_url(); |
631 return match->destination_url; | 636 return match->destination_url; |
632 } | 637 } |
OLD | NEW |