Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: components/omnibox/autocomplete_provider.cc

Issue 985503002: Omnibox - Make Omnibox Extensions Ignore Stop() Calls Due to User Idleness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/omnibox/autocomplete_provider.h" 5 #include "components/omnibox/autocomplete_provider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/omnibox/autocomplete_input.h" 9 #include "components/omnibox/autocomplete_input.h"
10 #include "components/omnibox/autocomplete_match.h" 10 #include "components/omnibox/autocomplete_match.h"
(...skipping 27 matching lines...) Expand all
38 case TYPE_SHORTCUTS: 38 case TYPE_SHORTCUTS:
39 return "Shortcuts"; 39 return "Shortcuts";
40 case TYPE_ZERO_SUGGEST: 40 case TYPE_ZERO_SUGGEST:
41 return "ZeroSuggest"; 41 return "ZeroSuggest";
42 default: 42 default:
43 NOTREACHED() << "Unhandled AutocompleteProvider::Type " << type; 43 NOTREACHED() << "Unhandled AutocompleteProvider::Type " << type;
44 return "Unknown"; 44 return "Unknown";
45 } 45 }
46 } 46 }
47 47
48 void AutocompleteProvider::Stop(bool clear_cached_results) { 48 void AutocompleteProvider::Stop(bool clear_cached_results,
49 bool user_inactivity_timer) {
49 done_ = true; 50 done_ = true;
50 } 51 }
51 52
52 const char* AutocompleteProvider::GetName() const { 53 const char* AutocompleteProvider::GetName() const {
53 return TypeToString(type_); 54 return TypeToString(type_);
54 } 55 }
55 56
56 metrics::OmniboxEventProto_ProviderType AutocompleteProvider:: 57 metrics::OmniboxEventProto_ProviderType AutocompleteProvider::
57 AsOmniboxEventProviderType() const { 58 AsOmniboxEventProviderType() const {
58 switch (type_) { 59 switch (type_) {
(...skipping 24 matching lines...) Expand all
83 << "' has not implemented DeleteMatch."; 84 << "' has not implemented DeleteMatch.";
84 } 85 }
85 86
86 void AutocompleteProvider::AddProviderInfo(ProvidersInfo* provider_info) const { 87 void AutocompleteProvider::AddProviderInfo(ProvidersInfo* provider_info) const {
87 } 88 }
88 89
89 void AutocompleteProvider::ResetSession() { 90 void AutocompleteProvider::ResetSession() {
90 } 91 }
91 92
92 AutocompleteProvider::~AutocompleteProvider() { 93 AutocompleteProvider::~AutocompleteProvider() {
93 Stop(false); 94 Stop(false, false);
94 } 95 }
95 96
96 // static 97 // static
97 AutocompleteProvider::FixupReturn AutocompleteProvider::FixupUserInput( 98 AutocompleteProvider::FixupReturn AutocompleteProvider::FixupUserInput(
98 const AutocompleteInput& input) { 99 const AutocompleteInput& input) {
99 const base::string16& input_text = input.text(); 100 const base::string16& input_text = input.text();
100 const FixupReturn failed(false, input_text); 101 const FixupReturn failed(false, input_text);
101 102
102 // Fixup and canonicalize user input. 103 // Fixup and canonicalize user input.
103 const GURL canonical_gurl( 104 const GURL canonical_gurl(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 DCHECK_NE(base::string16::npos, scheme_pos); 177 DCHECK_NE(base::string16::npos, scheme_pos);
177 178
178 // Erase scheme plus up to two slashes. 179 // Erase scheme plus up to two slashes.
179 size_t prefix_end = scheme_pos + strlen(url::kHttpScheme) + 1; 180 size_t prefix_end = scheme_pos + strlen(url::kHttpScheme) + 1;
180 const size_t after_slashes = std::min(url->length(), prefix_end + 2); 181 const size_t after_slashes = std::min(url->length(), prefix_end + 2);
181 while ((prefix_end < after_slashes) && ((*url)[prefix_end] == '/')) 182 while ((prefix_end < after_slashes) && ((*url)[prefix_end] == '/'))
182 ++prefix_end; 183 ++prefix_end;
183 url->erase(scheme_pos, prefix_end - scheme_pos); 184 url->erase(scheme_pos, prefix_end - scheme_pos);
184 return (scheme_pos == 0) ? prefix_end : 0; 185 return (scheme_pos == 0) ? prefix_end : 0;
185 } 186 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698