| OLD | NEW |
| 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/string16.h" | 10 #include "base/string16.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 events::kOnInputCancelled, make_scoped_ptr(new ListValue()))); | 125 events::kOnInputCancelled, make_scoped_ptr(new ListValue()))); |
| 126 event->restrict_to_profile = profile; | 126 event->restrict_to_profile = profile; |
| 127 ExtensionSystem::Get(profile)->event_router()-> | 127 ExtensionSystem::Get(profile)->event_router()-> |
| 128 DispatchEventToExtension(extension_id, event.Pass()); | 128 DispatchEventToExtension(extension_id, event.Pass()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 OmniboxAPI::OmniboxAPI(Profile* profile) | 131 OmniboxAPI::OmniboxAPI(Profile* profile) |
| 132 : profile_(profile), | 132 : profile_(profile), |
| 133 url_service_(TemplateURLServiceFactory::GetForProfile(profile)) { | 133 url_service_(TemplateURLServiceFactory::GetForProfile(profile)) { |
| 134 ManifestHandler::Register(extension_manifest_keys::kOmnibox, | 134 ManifestHandler::Register(extension_manifest_keys::kOmnibox, |
| 135 new OmniboxHandler); | 135 make_linked_ptr(new OmniboxHandler)); |
| 136 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 136 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
| 137 content::Source<Profile>(profile)); | 137 content::Source<Profile>(profile)); |
| 138 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 138 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 139 content::Source<Profile>(profile)); | 139 content::Source<Profile>(profile)); |
| 140 if (url_service_) { | 140 if (url_service_) { |
| 141 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, | 141 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, |
| 142 content::Source<TemplateURLService>(url_service_)); | 142 content::Source<TemplateURLService>(url_service_)); |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Use monochrome icons for Omnibox icons. | 145 // Use monochrome icons for Omnibox icons. |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 for (size_t i = 0; i < description_styles.size(); ++i) { | 416 for (size_t i = 0; i < description_styles.size(); ++i) { |
| 417 if (description_styles[i].offset > placeholder) | 417 if (description_styles[i].offset > placeholder) |
| 418 description_styles[i].offset += replacement.length() - 2; | 418 description_styles[i].offset += replacement.length() - 2; |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 | 421 |
| 422 match->contents.assign(description); | 422 match->contents.assign(description); |
| 423 } | 423 } |
| 424 | 424 |
| 425 } // namespace extensions | 425 } // namespace extensions |
| OLD | NEW |