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

Side by Side Diff: chrome/browser/extensions/api/omnibox/omnibox_api.h

Issue 666153002: Standardize usage of virtual/override/final in chrome/browser/extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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 #ifndef CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 private: 71 private:
72 DISALLOW_COPY_AND_ASSIGN(ExtensionOmniboxEventRouter); 72 DISALLOW_COPY_AND_ASSIGN(ExtensionOmniboxEventRouter);
73 }; 73 };
74 74
75 class OmniboxSendSuggestionsFunction : public ChromeSyncExtensionFunction { 75 class OmniboxSendSuggestionsFunction : public ChromeSyncExtensionFunction {
76 public: 76 public:
77 DECLARE_EXTENSION_FUNCTION("omnibox.sendSuggestions", OMNIBOX_SENDSUGGESTIONS) 77 DECLARE_EXTENSION_FUNCTION("omnibox.sendSuggestions", OMNIBOX_SENDSUGGESTIONS)
78 78
79 protected: 79 protected:
80 virtual ~OmniboxSendSuggestionsFunction() {} 80 ~OmniboxSendSuggestionsFunction() override {}
81 81
82 // ExtensionFunction: 82 // ExtensionFunction:
83 virtual bool RunSync() override; 83 bool RunSync() override;
84 }; 84 };
85 85
86 class OmniboxAPI : public BrowserContextKeyedAPI, 86 class OmniboxAPI : public BrowserContextKeyedAPI,
87 public ExtensionRegistryObserver { 87 public ExtensionRegistryObserver {
88 public: 88 public:
89 explicit OmniboxAPI(content::BrowserContext* context); 89 explicit OmniboxAPI(content::BrowserContext* context);
90 virtual ~OmniboxAPI(); 90 ~OmniboxAPI() override;
91 91
92 // BrowserContextKeyedAPI implementation. 92 // BrowserContextKeyedAPI implementation.
93 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance(); 93 static BrowserContextKeyedAPIFactory<OmniboxAPI>* GetFactoryInstance();
94 94
95 // Convenience method to get the OmniboxAPI for a profile. 95 // Convenience method to get the OmniboxAPI for a profile.
96 static OmniboxAPI* Get(content::BrowserContext* context); 96 static OmniboxAPI* Get(content::BrowserContext* context);
97 97
98 // KeyedService implementation. 98 // KeyedService implementation.
99 virtual void Shutdown() override; 99 void Shutdown() override;
100 100
101 // Returns the icon to display in the omnibox for the given extension. 101 // Returns the icon to display in the omnibox for the given extension.
102 gfx::Image GetOmniboxIcon(const std::string& extension_id); 102 gfx::Image GetOmniboxIcon(const std::string& extension_id);
103 103
104 // Returns the icon to display in the omnibox popup window for the given 104 // Returns the icon to display in the omnibox popup window for the given
105 // extension. 105 // extension.
106 gfx::Image GetOmniboxPopupIcon(const std::string& extension_id); 106 gfx::Image GetOmniboxPopupIcon(const std::string& extension_id);
107 107
108 private: 108 private:
109 friend class BrowserContextKeyedAPIFactory<OmniboxAPI>; 109 friend class BrowserContextKeyedAPIFactory<OmniboxAPI>;
110 110
111 typedef std::set<const Extension*> PendingExtensions; 111 typedef std::set<const Extension*> PendingExtensions;
112 112
113 void OnTemplateURLsLoaded(); 113 void OnTemplateURLsLoaded();
114 114
115 // ExtensionRegistryObserver implementation. 115 // ExtensionRegistryObserver implementation.
116 virtual void OnExtensionLoaded(content::BrowserContext* browser_context, 116 void OnExtensionLoaded(content::BrowserContext* browser_context,
117 const Extension* extension) override; 117 const Extension* extension) override;
118 virtual void OnExtensionUnloaded( 118 void OnExtensionUnloaded(content::BrowserContext* browser_context,
119 content::BrowserContext* browser_context, 119 const Extension* extension,
120 const Extension* extension, 120 UnloadedExtensionInfo::Reason reason) override;
121 UnloadedExtensionInfo::Reason reason) override;
122 121
123 // BrowserContextKeyedAPI implementation. 122 // BrowserContextKeyedAPI implementation.
124 static const char* service_name() { 123 static const char* service_name() {
125 return "OmniboxAPI"; 124 return "OmniboxAPI";
126 } 125 }
127 static const bool kServiceRedirectedInIncognito = true; 126 static const bool kServiceRedirectedInIncognito = true;
128 127
129 Profile* profile_; 128 Profile* profile_;
130 129
131 TemplateURLService* url_service_; 130 TemplateURLService* url_service_;
(...skipping 17 matching lines...) Expand all
149 148
150 template <> 149 template <>
151 void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies(); 150 void BrowserContextKeyedAPIFactory<OmniboxAPI>::DeclareFactoryDependencies();
152 151
153 class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction { 152 class OmniboxSetDefaultSuggestionFunction : public ChromeSyncExtensionFunction {
154 public: 153 public:
155 DECLARE_EXTENSION_FUNCTION("omnibox.setDefaultSuggestion", 154 DECLARE_EXTENSION_FUNCTION("omnibox.setDefaultSuggestion",
156 OMNIBOX_SETDEFAULTSUGGESTION) 155 OMNIBOX_SETDEFAULTSUGGESTION)
157 156
158 protected: 157 protected:
159 virtual ~OmniboxSetDefaultSuggestionFunction() {} 158 ~OmniboxSetDefaultSuggestionFunction() override {}
160 159
161 // ExtensionFunction: 160 // ExtensionFunction:
162 virtual bool RunSync() override; 161 bool RunSync() override;
163 }; 162 };
164 163
165 // If the extension has set a custom default suggestion via 164 // If the extension has set a custom default suggestion via
166 // omnibox.setDefaultSuggestion, apply that to |match|. Otherwise, do nothing. 165 // omnibox.setDefaultSuggestion, apply that to |match|. Otherwise, do nothing.
167 void ApplyDefaultSuggestionForExtensionKeyword( 166 void ApplyDefaultSuggestionForExtensionKeyword(
168 Profile* profile, 167 Profile* profile,
169 const TemplateURL* keyword, 168 const TemplateURL* keyword,
170 const base::string16& remaining_input, 169 const base::string16& remaining_input,
171 AutocompleteMatch* match); 170 AutocompleteMatch* match);
172 171
173 // This function converts style information populated by the JSON schema 172 // This function converts style information populated by the JSON schema
174 // // compiler into an ACMatchClassifications object. 173 // // compiler into an ACMatchClassifications object.
175 ACMatchClassifications StyleTypesToACMatchClassifications( 174 ACMatchClassifications StyleTypesToACMatchClassifications(
176 const api::omnibox::SuggestResult &suggestion); 175 const api::omnibox::SuggestResult &suggestion);
177 176
178 } // namespace extensions 177 } // namespace extensions
179 178
180 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_ 179 #endif // CHROME_BROWSER_EXTENSIONS_API_OMNIBOX_OMNIBOX_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698