| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 error_ = ExtensionErrorUtils::FormatErrorMessage( | 241 error_ = ExtensionErrorUtils::FormatErrorMessage( |
| 242 kUserCantDisableError, extension_id); | 242 kUserCantDisableError, extension_id); |
| 243 return false; | 243 return false; |
| 244 } | 244 } |
| 245 | 245 |
| 246 service()->UninstallExtension(extension_id, false /* external_uninstall */, | 246 service()->UninstallExtension(extension_id, false /* external_uninstall */, |
| 247 NULL); | 247 NULL); |
| 248 return true; | 248 return true; |
| 249 } | 249 } |
| 250 | 250 |
| 251 // static | |
| 252 ExtensionManagementEventRouter* ExtensionManagementEventRouter::GetInstance() { | |
| 253 return Singleton<ExtensionManagementEventRouter>::get(); | |
| 254 } | |
| 255 | |
| 256 ExtensionManagementEventRouter::ExtensionManagementEventRouter() {} | 251 ExtensionManagementEventRouter::ExtensionManagementEventRouter() {} |
| 257 | 252 |
| 258 ExtensionManagementEventRouter::~ExtensionManagementEventRouter() {} | 253 ExtensionManagementEventRouter::~ExtensionManagementEventRouter() {} |
| 259 | 254 |
| 260 void ExtensionManagementEventRouter::Init() { | 255 void ExtensionManagementEventRouter::Init() { |
| 261 NotificationType::Type types[] = { | 256 NotificationType::Type types[] = { |
| 262 NotificationType::EXTENSION_INSTALLED, | 257 NotificationType::EXTENSION_INSTALLED, |
| 263 NotificationType::EXTENSION_UNINSTALLED, | 258 NotificationType::EXTENSION_UNINSTALLED, |
| 264 NotificationType::EXTENSION_LOADED, | 259 NotificationType::EXTENSION_LOADED, |
| 265 NotificationType::EXTENSION_UNLOADED | 260 NotificationType::EXTENSION_UNLOADED |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; | 313 bool enabled = service->GetExtensionById(extension->id(), false) != NULL; |
| 319 args.Append(CreateExtensionInfo(*extension, enabled)); | 314 args.Append(CreateExtensionInfo(*extension, enabled)); |
| 320 } | 315 } |
| 321 | 316 |
| 322 std::string args_json; | 317 std::string args_json; |
| 323 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); | 318 base::JSONWriter::Write(&args, false /* pretty_print */, &args_json); |
| 324 | 319 |
| 325 profile->GetExtensionEventRouter()->DispatchEventToRenderers( | 320 profile->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 326 event_name, args_json, NULL, GURL()); | 321 event_name, args_json, NULL, GURL()); |
| 327 } | 322 } |
| OLD | NEW |