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.h" | 5 #include "chrome/browser/autocomplete/autocomplete.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/autocomplete/keyword_provider.h" | 23 #include "chrome/browser/autocomplete/keyword_provider.h" |
24 #include "chrome/browser/autocomplete/search_provider.h" | 24 #include "chrome/browser/autocomplete/search_provider.h" |
25 #include "chrome/browser/autocomplete/shortcuts_provider.h" | 25 #include "chrome/browser/autocomplete/shortcuts_provider.h" |
26 #include "chrome/browser/bookmarks/bookmark_model.h" | 26 #include "chrome/browser/bookmarks/bookmark_model.h" |
27 #include "chrome/browser/external_protocol/external_protocol_handler.h" | 27 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
28 #include "chrome/browser/net/url_fixer_upper.h" | 28 #include "chrome/browser/net/url_fixer_upper.h" |
29 #include "chrome/browser/prefs/pref_service.h" | 29 #include "chrome/browser/prefs/pref_service.h" |
30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
31 #include "chrome/browser/profiles/profile_io_data.h" | 31 #include "chrome/browser/profiles/profile_io_data.h" |
32 #include "chrome/browser/ui/webui/history_ui.h" | 32 #include "chrome/browser/ui/webui/history_ui.h" |
| 33 #include "chrome/common/chrome_notification_types.h" |
33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
35 #include "chrome/common/url_constants.h" | 36 #include "chrome/common/url_constants.h" |
36 #include "content/common/notification_service.h" | 37 #include "content/common/notification_service.h" |
37 #include "googleurl/src/gurl.h" | 38 #include "googleurl/src/gurl.h" |
38 #include "googleurl/src/url_canon_ip.h" | 39 #include "googleurl/src/url_canon_ip.h" |
39 #include "googleurl/src/url_util.h" | 40 #include "googleurl/src/url_util.h" |
40 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
41 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
42 #include "net/base/net_util.h" | 43 #include "net/base/net_util.h" |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 } | 978 } |
978 | 979 |
979 NotifyChanged(notify_default_match); | 980 NotifyChanged(notify_default_match); |
980 } | 981 } |
981 | 982 |
982 void AutocompleteController::NotifyChanged(bool notify_default_match) { | 983 void AutocompleteController::NotifyChanged(bool notify_default_match) { |
983 if (delegate_) | 984 if (delegate_) |
984 delegate_->OnResultChanged(notify_default_match); | 985 delegate_->OnResultChanged(notify_default_match); |
985 if (done_) { | 986 if (done_) { |
986 NotificationService::current()->Notify( | 987 NotificationService::current()->Notify( |
987 NotificationType::AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 988 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
988 Source<AutocompleteController>(this), | 989 Source<AutocompleteController>(this), |
989 NotificationService::NoDetails()); | 990 NotificationService::NoDetails()); |
990 } | 991 } |
991 } | 992 } |
992 | 993 |
993 void AutocompleteController::CheckIfDone() { | 994 void AutocompleteController::CheckIfDone() { |
994 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | 995 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); |
995 ++i) { | 996 ++i) { |
996 if (!(*i)->done()) { | 997 if (!(*i)->done()) { |
997 done_ = false; | 998 done_ = false; |
998 return; | 999 return; |
999 } | 1000 } |
1000 } | 1001 } |
1001 done_ = true; | 1002 done_ = true; |
1002 } | 1003 } |
1003 | 1004 |
1004 void AutocompleteController::StartExpireTimer() { | 1005 void AutocompleteController::StartExpireTimer() { |
1005 if (result_.HasCopiedMatches()) | 1006 if (result_.HasCopiedMatches()) |
1006 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), | 1007 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), |
1007 this, &AutocompleteController::ExpireCopiedEntries); | 1008 this, &AutocompleteController::ExpireCopiedEntries); |
1008 } | 1009 } |
OLD | NEW |