| 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_management_api.h" | 5 #include "chrome/browser/extensions/extension_management_api.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 202 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 203 BrowserThread::PostTask( | 203 BrowserThread::PostTask( |
| 204 BrowserThread::IO, | 204 BrowserThread::IO, |
| 205 FROM_HERE, | 205 FROM_HERE, |
| 206 NewRunnableMethod(this, &SafeManifestJSONParser::StartWorkOnIOThread)); | 206 NewRunnableMethod(this, &SafeManifestJSONParser::StartWorkOnIOThread)); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void StartWorkOnIOThread() { | 209 void StartWorkOnIOThread() { |
| 210 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 210 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 211 utility_host_ = new UtilityProcessHost(this, BrowserThread::IO); | 211 utility_host_ = new UtilityProcessHost(this, BrowserThread::IO); |
| 212 utility_host_->Send(new UtilityMsg_ParseJSON(manifest_)); | 212 utility_host_->Send(new ChromeUtilityMsg_ParseJSON(manifest_)); |
| 213 } | 213 } |
| 214 | 214 |
| 215 virtual bool OnMessageReceived(const IPC::Message& message) { | 215 virtual bool OnMessageReceived(const IPC::Message& message) { |
| 216 bool handled = true; | 216 bool handled = true; |
| 217 IPC_BEGIN_MESSAGE_MAP(SafeManifestJSONParser, message) | 217 IPC_BEGIN_MESSAGE_MAP(SafeManifestJSONParser, message) |
| 218 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseJSON_Succeeded, | 218 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Succeeded, |
| 219 OnJSONParseSucceeded) | 219 OnJSONParseSucceeded) |
| 220 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseJSON_Failed, OnJSONParseFailed) | 220 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseJSON_Failed, |
| 221 OnJSONParseFailed) |
| 221 IPC_MESSAGE_UNHANDLED(handled = false) | 222 IPC_MESSAGE_UNHANDLED(handled = false) |
| 222 IPC_END_MESSAGE_MAP() | 223 IPC_END_MESSAGE_MAP() |
| 223 return handled; | 224 return handled; |
| 224 } | 225 } |
| 225 | 226 |
| 226 void OnJSONParseSucceeded(const ListValue& wrapper) { | 227 void OnJSONParseSucceeded(const ListValue& wrapper) { |
| 227 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 228 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 228 Value* value = NULL; | 229 Value* value = NULL; |
| 229 CHECK(wrapper.Get(0, &value)); | 230 CHECK(wrapper.Get(0, &value)); |
| 230 if (value->IsType(Value::TYPE_DICTIONARY)) | 231 if (value->IsType(Value::TYPE_DICTIONARY)) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; | 474 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; |
| 474 args.Append(CreateExtensionInfo(*extension, enabled)); | 475 args.Append(CreateExtensionInfo(*extension, enabled)); |
| 475 } | 476 } |
| 476 | 477 |
| 477 std::string args_json; | 478 std::string args_json; |
| 478 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); | 479 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); |
| 479 | 480 |
| 480 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 481 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 481 event_name, args_json, NULL, GURL()); | 482 event_name, args_json, NULL, GURL()); |
| 482 } | 483 } |
| OLD | NEW |