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/runtime/runtime_api.h" | 5 #include "chrome/browser/extensions/api/runtime/runtime_api.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
| 9 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/extensions/extension_host.h" | 15 #include "chrome/browser/extensions/extension_host.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/updater/extension_updater.h" | 17 #include "chrome/browser/extensions/updater/extension_updater.h" |
17 #include "chrome/browser/omaha_query_params/omaha_query_params.h" | 18 #include "chrome/browser/omaha_query_params/omaha_query_params.h" |
18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 std::string url_string; | 132 std::string url_string; |
132 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string); | 133 prefs->ReadPrefAsString(extension_id, kUninstallUrl, &url_string); |
133 return url_string; | 134 return url_string; |
134 } | 135 } |
135 #endif // defined(ENABLE_EXTENSIONS) | 136 #endif // defined(ENABLE_EXTENSIONS) |
136 | 137 |
137 } // namespace | 138 } // namespace |
138 | 139 |
139 /////////////////////////////////////////////////////////////////////////////// | 140 /////////////////////////////////////////////////////////////////////////////// |
140 | 141 |
| 142 static base::LazyInstance<ProfileKeyedAPIFactory<RuntimeAPI> > g_factory = |
| 143 LAZY_INSTANCE_INITIALIZER; |
| 144 |
| 145 // static |
| 146 ProfileKeyedAPIFactory<RuntimeAPI>* RuntimeAPI::GetFactoryInstance() { |
| 147 return g_factory.Pointer(); |
| 148 } |
| 149 |
141 RuntimeAPI::RuntimeAPI(content::BrowserContext* context) | 150 RuntimeAPI::RuntimeAPI(content::BrowserContext* context) |
142 : browser_context_(context), | 151 : browser_context_(context), |
143 dispatch_chrome_updated_event_(false), | 152 dispatch_chrome_updated_event_(false), |
144 registered_for_updates_(false) { | 153 registered_for_updates_(false) { |
145 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, | 154 registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, |
146 content::Source<BrowserContext>(context)); | 155 content::Source<BrowserContext>(context)); |
147 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 156 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
148 content::Source<BrowserContext>(context)); | 157 content::Source<BrowserContext>(context)); |
149 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, | 158 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
150 content::Source<BrowserContext>(context)); | 159 content::Source<BrowserContext>(context)); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 content::ChildProcessSecurityPolicy::GetInstance(); | 591 content::ChildProcessSecurityPolicy::GetInstance(); |
583 policy->GrantReadFileSystem(renderer_id, filesystem_id); | 592 policy->GrantReadFileSystem(renderer_id, filesystem_id); |
584 base::DictionaryValue* dict = new base::DictionaryValue(); | 593 base::DictionaryValue* dict = new base::DictionaryValue(); |
585 SetResult(dict); | 594 SetResult(dict); |
586 dict->SetString("fileSystemId", filesystem_id); | 595 dict->SetString("fileSystemId", filesystem_id); |
587 dict->SetString("baseName", relative_path); | 596 dict->SetString("baseName", relative_path); |
588 return true; | 597 return true; |
589 } | 598 } |
590 | 599 |
591 } // namespace extensions | 600 } // namespace extensions |
OLD | NEW |