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

Side by Side Diff: chrome/browser/extensions/extension_omnibox_api.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments + rebase Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 23 matching lines...) Expand all
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<PropertyAccessor<ExtensionOmniboxSuggestion> >
44 g_extension_omnibox_suggestion_property_accessor(base::LINKER_INITIALIZED); 44 g_extension_omnibox_suggestion_property_accessor =
45 LAZY_INSTANCE_INITIALIZER;
45 46
46 PropertyAccessor<ExtensionOmniboxSuggestion>& GetPropertyAccessor() { 47 PropertyAccessor<ExtensionOmniboxSuggestion>& GetPropertyAccessor() {
47 return g_extension_omnibox_suggestion_property_accessor.Get(); 48 return g_extension_omnibox_suggestion_property_accessor.Get();
48 } 49 }
49 50
50 // Returns the suggestion object set by the extension via the 51 // Returns the suggestion object set by the extension via the
51 // omnibox.setDefaultSuggestion call, or NULL if it was never set. 52 // omnibox.setDefaultSuggestion call, or NULL if it was never set.
52 const ExtensionOmniboxSuggestion* GetDefaultSuggestionForExtension( 53 const ExtensionOmniboxSuggestion* GetDefaultSuggestionForExtension(
53 Profile* profile, const std::string& extension_id) { 54 Profile* profile, const std::string& extension_id) {
54 const Extension* extension = 55 const Extension* extension =
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 287 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
287 288
288 // 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
289 // preference is set, launch as a regular tab. 290 // preference is set, launch as a regular tab.
290 extension_misc::LaunchContainer launch_container = 291 extension_misc::LaunchContainer launch_container =
291 service->extension_prefs()->GetLaunchContainer( 292 service->extension_prefs()->GetLaunchContainer(
292 extension, ExtensionPrefs::LAUNCH_REGULAR); 293 extension, ExtensionPrefs::LAUNCH_REGULAR);
293 294
294 Browser::OpenApplication(profile, extension, launch_container, disposition); 295 Browser::OpenApplication(profile, extension, launch_container, disposition);
295 } 296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698