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/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 | 201 |
202 OmniboxAPI::~OmniboxAPI() { | 202 OmniboxAPI::~OmniboxAPI() { |
203 } | 203 } |
204 | 204 |
205 static base::LazyInstance<ProfileKeyedAPIFactory<OmniboxAPI> > | 205 static base::LazyInstance<ProfileKeyedAPIFactory<OmniboxAPI> > |
206 g_factory = LAZY_INSTANCE_INITIALIZER; | 206 g_factory = LAZY_INSTANCE_INITIALIZER; |
207 | 207 |
208 // static | 208 // static |
209 ProfileKeyedAPIFactory<OmniboxAPI>* OmniboxAPI::GetFactoryInstance() { | 209 ProfileKeyedAPIFactory<OmniboxAPI>* OmniboxAPI::GetFactoryInstance() { |
210 return &g_factory.Get(); | 210 return g_factory.Pointer(); |
211 } | 211 } |
212 | 212 |
213 // static | 213 // static |
214 OmniboxAPI* OmniboxAPI::Get(Profile* profile) { | 214 OmniboxAPI* OmniboxAPI::Get(Profile* profile) { |
215 return ProfileKeyedAPIFactory<OmniboxAPI>::GetForProfile(profile); | 215 return ProfileKeyedAPIFactory<OmniboxAPI>::GetForProfile(profile); |
216 } | 216 } |
217 | 217 |
218 void OmniboxAPI::Observe(int type, | 218 void OmniboxAPI::Observe(int type, |
219 const content::NotificationSource& source, | 219 const content::NotificationSource& source, |
220 const content::NotificationDetails& details) { | 220 const content::NotificationDetails& details) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 for (size_t i = 0; i < description_styles.size(); ++i) { | 395 for (size_t i = 0; i < description_styles.size(); ++i) { |
396 if (description_styles[i].offset > placeholder) | 396 if (description_styles[i].offset > placeholder) |
397 description_styles[i].offset += replacement.length() - 2; | 397 description_styles[i].offset += replacement.length() - 2; |
398 } | 398 } |
399 } | 399 } |
400 | 400 |
401 match->contents.assign(description); | 401 match->contents.assign(description); |
402 } | 402 } |
403 | 403 |
404 } // namespace extensions | 404 } // namespace extensions |
OLD | NEW |