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

Side by Side Diff: chrome/browser/autocomplete/keyword_provider.cc

Issue 10909130: autocomplete: Add AutocompleteProvider::Type enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/keyword_provider.h" 5 #include "chrome/browser/autocomplete/keyword_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 27 matching lines...) Expand all
38 38
39 void StayInKeywordMode() { 39 void StayInKeywordMode() {
40 provider_ = NULL; 40 provider_ = NULL;
41 } 41 }
42 private: 42 private:
43 KeywordProvider* provider_; 43 KeywordProvider* provider_;
44 }; 44 };
45 45
46 KeywordProvider::KeywordProvider(AutocompleteProviderListener* listener, 46 KeywordProvider::KeywordProvider(AutocompleteProviderListener* listener,
47 Profile* profile) 47 Profile* profile)
48 : AutocompleteProvider(listener, profile, "Keyword"), 48 : AutocompleteProvider(listener,
49 profile,
50 AutocompleteProvider::TYPE_KEYWORD),
49 model_(NULL), 51 model_(NULL),
50 current_input_id_(0) { 52 current_input_id_(0) {
51 // Extension suggestions always come from the original profile, since that's 53 // Extension suggestions always come from the original profile, since that's
52 // where extensions run. We use the input ID to distinguish whether the 54 // where extensions run. We use the input ID to distinguish whether the
53 // suggestions are meant for us. 55 // suggestions are meant for us.
54 registrar_.Add(this, 56 registrar_.Add(this,
55 chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY, 57 chrome::NOTIFICATION_EXTENSION_OMNIBOX_SUGGESTIONS_READY,
56 content::Source<Profile>(profile->GetOriginalProfile())); 58 content::Source<Profile>(profile->GetOriginalProfile()));
57 registrar_.Add( 59 registrar_.Add(
58 this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED, 60 this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_DEFAULT_SUGGESTION_CHANGED,
59 content::Source<Profile>(profile->GetOriginalProfile())); 61 content::Source<Profile>(profile->GetOriginalProfile()));
60 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED, 62 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_OMNIBOX_INPUT_ENTERED,
61 content::Source<Profile>(profile)); 63 content::Source<Profile>(profile));
62 } 64 }
63 65
64 KeywordProvider::KeywordProvider(AutocompleteProviderListener* listener, 66 KeywordProvider::KeywordProvider(AutocompleteProviderListener* listener,
65 TemplateURLService* model) 67 TemplateURLService* model)
66 : AutocompleteProvider(listener, NULL, "Keyword"), 68 : AutocompleteProvider(listener, NULL, AutocompleteProvider::TYPE_KEYWORD),
67 model_(model), 69 model_(model),
68 current_input_id_(0) { 70 current_input_id_(0) {
69 } 71 }
70 72
71 73
72 namespace { 74 namespace {
73 75
74 // Helper functor for Start(), for sorting keyword matches by quality. 76 // Helper functor for Start(), for sorting keyword matches by quality.
75 class CompareQuality { 77 class CompareQuality {
76 public: 78 public:
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 } 583 }
582 584
583 void KeywordProvider::MaybeEndExtensionKeywordMode() { 585 void KeywordProvider::MaybeEndExtensionKeywordMode() {
584 if (!current_keyword_extension_id_.empty()) { 586 if (!current_keyword_extension_id_.empty()) {
585 extensions::ExtensionOmniboxEventRouter::OnInputCancelled( 587 extensions::ExtensionOmniboxEventRouter::OnInputCancelled(
586 profile_, current_keyword_extension_id_); 588 profile_, current_keyword_extension_id_);
587 589
588 current_keyword_extension_id_.clear(); 590 current_keyword_extension_id_.clear();
589 } 591 }
590 } 592 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698