OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_omnibox_api.h" | 5 #include "chrome/browser/extensions/extension_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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 "Suggestion descriptionStyles contains an offset longer than the" | 33 "Suggestion descriptionStyles contains an offset longer than the" |
34 " description text"; | 34 " description text"; |
35 | 35 |
36 const char kSuggestionContent[] = "content"; | 36 const char kSuggestionContent[] = "content"; |
37 const char kSuggestionDescription[] = "description"; | 37 const char kSuggestionDescription[] = "description"; |
38 const char kSuggestionDescriptionStyles[] = "descriptionStyles"; | 38 const char kSuggestionDescriptionStyles[] = "descriptionStyles"; |
39 const char kDescriptionStylesType[] = "type"; | 39 const char kDescriptionStylesType[] = "type"; |
40 const char kDescriptionStylesOffset[] = "offset"; | 40 const char kDescriptionStylesOffset[] = "offset"; |
41 const char kDescriptionStylesLength[] = "length"; | 41 const char kDescriptionStylesLength[] = "length"; |
42 | 42 |
43 static base::LazyInstance<PropertyAccessor<ExtensionOmniboxSuggestion> > | 43 static base::LazyInstance<base::PropertyAccessor<ExtensionOmniboxSuggestion> > |
44 g_extension_omnibox_suggestion_property_accessor = | 44 g_extension_omnibox_suggestion_property_accessor = |
45 LAZY_INSTANCE_INITIALIZER; | 45 LAZY_INSTANCE_INITIALIZER; |
46 | 46 |
47 PropertyAccessor<ExtensionOmniboxSuggestion>& GetPropertyAccessor() { | 47 base::PropertyAccessor<ExtensionOmniboxSuggestion>& GetPropertyAccessor() { |
48 return g_extension_omnibox_suggestion_property_accessor.Get(); | 48 return g_extension_omnibox_suggestion_property_accessor.Get(); |
49 } | 49 } |
50 | 50 |
51 // Returns the suggestion object set by the extension via the | 51 // Returns the suggestion object set by the extension via the |
52 // omnibox.setDefaultSuggestion call, or NULL if it was never set. | 52 // omnibox.setDefaultSuggestion call, or NULL if it was never set. |
53 const ExtensionOmniboxSuggestion* GetDefaultSuggestionForExtension( | 53 const ExtensionOmniboxSuggestion* GetDefaultSuggestionForExtension( |
54 Profile* profile, const std::string& extension_id) { | 54 Profile* profile, const std::string& extension_id) { |
55 const Extension* extension = | 55 const Extension* extension = |
56 profile->GetExtensionService()->GetExtensionById(extension_id, false); | 56 profile->GetExtensionService()->GetExtensionById(extension_id, false); |
57 if (!extension) | 57 if (!extension) |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 // Look at the preferences to find the right launch container. If no | 289 // Look at the preferences to find the right launch container. If no |
290 // preference is set, launch as a regular tab. | 290 // preference is set, launch as a regular tab. |
291 extension_misc::LaunchContainer launch_container = | 291 extension_misc::LaunchContainer launch_container = |
292 service->extension_prefs()->GetLaunchContainer( | 292 service->extension_prefs()->GetLaunchContainer( |
293 extension, ExtensionPrefs::LAUNCH_REGULAR); | 293 extension, ExtensionPrefs::LAUNCH_REGULAR); |
294 | 294 |
295 Browser::OpenApplication(profile, extension, launch_container, GURL(), | 295 Browser::OpenApplication(profile, extension, launch_container, GURL(), |
296 disposition); | 296 disposition); |
297 } | 297 } |
OLD | NEW |