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

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

Issue 242613004: Replace NOTIFICATION_EXTENSION_LOADED to NOTIFICATION_EXTENSION_LOADED_DEPRECATED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" 5 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
6 6
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 make_scoped_ptr(new base::ListValue()))); 172 make_scoped_ptr(new base::ListValue())));
173 event->restrict_to_browser_context = profile; 173 event->restrict_to_browser_context = profile;
174 ExtensionSystem::Get(profile)->event_router()-> 174 ExtensionSystem::Get(profile)->event_router()->
175 DispatchEventToExtension(extension_id, event.Pass()); 175 DispatchEventToExtension(extension_id, event.Pass());
176 } 176 }
177 177
178 OmniboxAPI::OmniboxAPI(content::BrowserContext* context) 178 OmniboxAPI::OmniboxAPI(content::BrowserContext* context)
179 : profile_(Profile::FromBrowserContext(context)), 179 : profile_(Profile::FromBrowserContext(context)),
180 url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) { 180 url_service_(TemplateURLServiceFactory::GetForProfile(profile_)) {
181 registrar_.Add(this, 181 registrar_.Add(this,
182 chrome::NOTIFICATION_EXTENSION_LOADED, 182 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
183 content::Source<Profile>(profile_)); 183 content::Source<Profile>(profile_));
184 registrar_.Add(this, 184 registrar_.Add(this,
185 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 185 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
186 content::Source<Profile>(profile_)); 186 content::Source<Profile>(profile_));
187 if (url_service_) { 187 if (url_service_) {
188 template_url_sub_ = url_service_->RegisterOnLoadedCallback( 188 template_url_sub_ = url_service_->RegisterOnLoadedCallback(
189 base::Bind(&OmniboxAPI::OnTemplateURLsLoaded, 189 base::Bind(&OmniboxAPI::OnTemplateURLsLoaded,
190 base::Unretained(this))); 190 base::Unretained(this)));
191 } 191 }
192 192
(...skipping 20 matching lines...) Expand all
213 } 213 }
214 214
215 // static 215 // static
216 OmniboxAPI* OmniboxAPI::Get(content::BrowserContext* context) { 216 OmniboxAPI* OmniboxAPI::Get(content::BrowserContext* context) {
217 return BrowserContextKeyedAPIFactory<OmniboxAPI>::Get(context); 217 return BrowserContextKeyedAPIFactory<OmniboxAPI>::Get(context);
218 } 218 }
219 219
220 void OmniboxAPI::Observe(int type, 220 void OmniboxAPI::Observe(int type,
221 const content::NotificationSource& source, 221 const content::NotificationSource& source,
222 const content::NotificationDetails& details) { 222 const content::NotificationDetails& details) {
223 if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { 223 if (type == chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED) {
224 const Extension* extension = 224 const Extension* extension =
225 content::Details<const Extension>(details).ptr(); 225 content::Details<const Extension>(details).ptr();
226 const std::string& keyword = OmniboxInfo::GetKeyword(extension); 226 const std::string& keyword = OmniboxInfo::GetKeyword(extension);
227 if (!keyword.empty()) { 227 if (!keyword.empty()) {
228 // Load the omnibox icon so it will be ready to display in the URL bar. 228 // Load the omnibox icon so it will be ready to display in the URL bar.
229 omnibox_popup_icon_manager_.LoadIcon(profile_, extension); 229 omnibox_popup_icon_manager_.LoadIcon(profile_, extension);
230 omnibox_icon_manager_.LoadIcon(profile_, extension); 230 omnibox_icon_manager_.LoadIcon(profile_, extension);
231 231
232 if (url_service_) { 232 if (url_service_) {
233 url_service_->Load(); 233 url_service_->Load();
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 for (size_t i = 0; i < description_styles.size(); ++i) { 398 for (size_t i = 0; i < description_styles.size(); ++i) {
399 if (description_styles[i].offset > placeholder) 399 if (description_styles[i].offset > placeholder)
400 description_styles[i].offset += replacement.length() - 2; 400 description_styles[i].offset += replacement.length() - 2;
401 } 401 }
402 } 402 }
403 403
404 match->contents.assign(description); 404 match->contents.assign(description);
405 } 405 }
406 406
407 } // namespace extensions 407 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698