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/management/management_api.h" | 5 #include "chrome/browser/extensions/api/management/management_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 } | 200 } |
201 | 201 |
202 return info.Pass(); | 202 return info.Pass(); |
203 } | 203 } |
204 | 204 |
205 void AddExtensionInfo(const ExtensionSet& extensions, | 205 void AddExtensionInfo(const ExtensionSet& extensions, |
206 ExtensionSystem* system, | 206 ExtensionSystem* system, |
207 ExtensionInfoList* extension_list) { | 207 ExtensionInfoList* extension_list) { |
208 for (ExtensionSet::const_iterator iter = extensions.begin(); | 208 for (ExtensionSet::const_iterator iter = extensions.begin(); |
209 iter != extensions.end(); ++iter) { | 209 iter != extensions.end(); ++iter) { |
210 const Extension& extension = **iter; | 210 const Extension& extension = *iter->get(); |
211 | 211 |
212 if (extension.location() == Manifest::COMPONENT) | 212 if (extension.location() == Manifest::COMPONENT) |
213 continue; // Skip built-in extensions. | 213 continue; // Skip built-in extensions. |
214 | 214 |
215 extension_list->push_back(make_linked_ptr<management::ExtensionInfo>( | 215 extension_list->push_back(make_linked_ptr<management::ExtensionInfo>( |
216 CreateExtensionInfo(extension, system).release())); | 216 CreateExtensionInfo(extension, system).release())); |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 } // namespace | 220 } // namespace |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 void Start() { | 290 void Start() { |
291 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 291 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
292 BrowserThread::PostTask( | 292 BrowserThread::PostTask( |
293 BrowserThread::IO, | 293 BrowserThread::IO, |
294 FROM_HERE, | 294 FROM_HERE, |
295 base::Bind(&SafeManifestJSONParser::StartWorkOnIOThread, this)); | 295 base::Bind(&SafeManifestJSONParser::StartWorkOnIOThread, this)); |
296 } | 296 } |
297 | 297 |
298 void StartWorkOnIOThread() { | 298 void StartWorkOnIOThread() { |
299 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 299 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
300 UtilityProcessHost* host = | 300 UtilityProcessHost* host = UtilityProcessHost::Create( |
301 UtilityProcessHost::Create( | 301 this, base::MessageLoopProxy::current().get()); |
302 this, | |
303 base::MessageLoopProxy::current()); | |
304 host->EnableZygote(); | 302 host->EnableZygote(); |
305 host->Send(new ChromeUtilityMsg_ParseJSON(manifest_)); | 303 host->Send(new ChromeUtilityMsg_ParseJSON(manifest_)); |
306 } | 304 } |
307 | 305 |
308 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 306 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
309 bool handled = true; | 307 bool handled = true; |
310 IPC_BEGIN_MESSAGE_MAP(SafeManifestJSONParser, message) | 308 IPC_BEGIN_MESSAGE_MAP(SafeManifestJSONParser, message) |
311 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Succeeded, | 309 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Succeeded, |
312 OnJSONParseSucceeded) | 310 OnJSONParseSucceeded) |
313 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Failed, | 311 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Failed, |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { | 715 ProfileKeyedAPIFactory<ManagementAPI>* ManagementAPI::GetFactoryInstance() { |
718 return &g_factory.Get(); | 716 return &g_factory.Get(); |
719 } | 717 } |
720 | 718 |
721 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { | 719 void ManagementAPI::OnListenerAdded(const EventListenerInfo& details) { |
722 management_event_router_.reset(new ManagementEventRouter(profile_)); | 720 management_event_router_.reset(new ManagementEventRouter(profile_)); |
723 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 721 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
724 } | 722 } |
725 | 723 |
726 } // namespace extensions | 724 } // namespace extensions |
OLD | NEW |