OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 NewRunnableMethod( | 1385 NewRunnableMethod( |
1386 backend_.get(), &ExtensionsServiceBackend::CheckForExternalUpdates, | 1386 backend_.get(), &ExtensionsServiceBackend::CheckForExternalUpdates, |
1387 killed_extensions, scoped_refptr<ExtensionsService>(this))); | 1387 killed_extensions, scoped_refptr<ExtensionsService>(this))); |
1388 } | 1388 } |
1389 | 1389 |
1390 void ExtensionsService::UnloadExtension(const std::string& extension_id) { | 1390 void ExtensionsService::UnloadExtension(const std::string& extension_id) { |
1391 // Make sure the extension gets deleted after we return from this function. | 1391 // Make sure the extension gets deleted after we return from this function. |
1392 scoped_refptr<const Extension> extension( | 1392 scoped_refptr<const Extension> extension( |
1393 GetExtensionByIdInternal(extension_id, true, true)); | 1393 GetExtensionByIdInternal(extension_id, true, true)); |
1394 | 1394 |
1395 // Callers should not send us nonexistent extensions. | 1395 // This method can be called via PostTask, so the extension may have been |
1396 CHECK(extension.get()); | 1396 // unloaded by the time this runs. |
| 1397 if (!extension) |
| 1398 return; |
1397 | 1399 |
1398 // Keep information about the extension so that we can reload it later | 1400 // Keep information about the extension so that we can reload it later |
1399 // even if it's not permanently installed. | 1401 // even if it's not permanently installed. |
1400 unloaded_extension_paths_[extension->id()] = extension->path(); | 1402 unloaded_extension_paths_[extension->id()] = extension->path(); |
1401 | 1403 |
1402 // Clean up if the extension is meant to be enabled after a reload. | 1404 // Clean up if the extension is meant to be enabled after a reload. |
1403 disabled_extension_paths_.erase(extension->id()); | 1405 disabled_extension_paths_.erase(extension->id()); |
1404 | 1406 |
1405 // Clean up runtime data. | 1407 // Clean up runtime data. |
1406 extension_runtime_data_.erase(extension_id); | 1408 extension_runtime_data_.erase(extension_id); |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 } | 1944 } |
1943 | 1945 |
1944 bool ExtensionsService::IsBeingUpgraded(const Extension* extension) { | 1946 bool ExtensionsService::IsBeingUpgraded(const Extension* extension) { |
1945 return extension_runtime_data_[extension->id()].being_upgraded; | 1947 return extension_runtime_data_[extension->id()].being_upgraded; |
1946 } | 1948 } |
1947 | 1949 |
1948 void ExtensionsService::SetBeingUpgraded(const Extension* extension, | 1950 void ExtensionsService::SetBeingUpgraded(const Extension* extension, |
1949 bool value) { | 1951 bool value) { |
1950 extension_runtime_data_[extension->id()].being_upgraded = value; | 1952 extension_runtime_data_[extension->id()].being_upgraded = value; |
1951 } | 1953 } |
OLD | NEW |