| 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/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/google_util.h" | 10 #include "chrome/browser/google_util.h" |
| 11 #include "chrome/browser/profile.h" | 11 #include "chrome/browser/profile.h" |
| 12 #include "chrome/browser/template_url_model.h" | 12 #include "chrome/browser/template_url_model.h" |
| 13 #include "chrome/common/json_value_serializer.h" | 13 #include "chrome/common/json_value_serializer.h" |
| 14 #include "chrome/common/l10n_util.h" | 14 #include "chrome/common/l10n_util.h" |
| 15 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/common/pref_service.h" | 16 #include "chrome/common/pref_service.h" |
| 17 #include "googleurl/src/url_util.h" | 17 #include "googleurl/src/url_util.h" |
| 18 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
| 19 | 19 |
| 20 #include "generated_resources.h" | 20 #include "generated_resources.h" |
| 21 | 21 |
| 22 using base::Time; |
| 23 using base::TimeDelta; |
| 24 |
| 22 const int SearchProvider::kQueryDelayMs = 200; | 25 const int SearchProvider::kQueryDelayMs = 200; |
| 23 | 26 |
| 24 void SearchProvider::Start(const AutocompleteInput& input, | 27 void SearchProvider::Start(const AutocompleteInput& input, |
| 25 bool minimal_changes) { | 28 bool minimal_changes) { |
| 26 matches_.clear(); | 29 matches_.clear(); |
| 27 | 30 |
| 28 // Can't return search/suggest results for bogus input or if there is no | 31 // Can't return search/suggest results for bogus input or if there is no |
| 29 // profile. | 32 // profile. |
| 30 if (!profile_ || (input.type() == AutocompleteInput::INVALID)) { | 33 if (!profile_ || (input.type() == AutocompleteInput::INVALID)) { |
| 31 Stop(); | 34 Stop(); |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 const size_t after_slashes = std::min(url->length(), | 599 const size_t after_slashes = std::min(url->length(), |
| 597 static_cast<size_t>(scheme.end() + 3)); | 600 static_cast<size_t>(scheme.end() + 3)); |
| 598 while ((prefix_len < after_slashes) && ((*url)[prefix_len] == L'/')) | 601 while ((prefix_len < after_slashes) && ((*url)[prefix_len] == L'/')) |
| 599 ++prefix_len; | 602 ++prefix_len; |
| 600 if (prefix_len == url->length()) | 603 if (prefix_len == url->length()) |
| 601 url->clear(); | 604 url->clear(); |
| 602 else | 605 else |
| 603 url->erase(url->begin(), url->begin() + prefix_len); | 606 url->erase(url->begin(), url->begin() + prefix_len); |
| 604 return prefix_len; | 607 return prefix_len; |
| 605 } | 608 } |
| OLD | NEW |