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 1856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1867 } | 1867 } |
1868 | 1868 |
1869 void ExtensionsService::Observe(NotificationType type, | 1869 void ExtensionsService::Observe(NotificationType type, |
1870 const NotificationSource& source, | 1870 const NotificationSource& source, |
1871 const NotificationDetails& details) { | 1871 const NotificationDetails& details) { |
1872 switch (type.value) { | 1872 switch (type.value) { |
1873 case NotificationType::EXTENSION_PROCESS_TERMINATED: { | 1873 case NotificationType::EXTENSION_PROCESS_TERMINATED: { |
1874 if (profile_ != Source<Profile>(source).ptr()->GetOriginalProfile()) | 1874 if (profile_ != Source<Profile>(source).ptr()->GetOriginalProfile()) |
1875 break; | 1875 break; |
1876 | 1876 |
1877 ExtensionHost* host = Details<ExtensionHost>(details).ptr(); | |
1878 | |
1879 // TODO(rafaelw): Remove this check and ExtensionHost::recently_deleted(). | |
1880 // This is only here to help track down crbug.com/49114. | |
1881 ExtensionHost::HostPointerList::iterator iter = | |
1882 ExtensionHost::recently_deleted()->begin(); | |
1883 for (; iter != ExtensionHost::recently_deleted()->end(); ++iter) { | |
1884 if (*iter == host) { | |
1885 CHECK(host->GetURL().spec().size() + 2 != 0); | |
1886 break; | |
1887 } | |
1888 } | |
1889 if (iter == ExtensionHost::recently_deleted()->end()) | |
1890 CHECK(host->GetURL().spec().size() + 1 != 0); | |
1891 | |
1892 // Unload the entire extension. We want it to be in a consistent state: | 1877 // Unload the entire extension. We want it to be in a consistent state: |
1893 // either fully working or not loaded at all, but never half-crashed. | 1878 // either fully working or not loaded at all, but never half-crashed. |
1894 // We do it in a PostTask so that other handlers of this notification will | 1879 // We do it in a PostTask so that other handlers of this notification will |
1895 // still have access to the Extension and ExtensionHost. | 1880 // still have access to the Extension and ExtensionHost. |
1896 MessageLoop::current()->PostTask(FROM_HERE, | 1881 MessageLoop::current()->PostTask(FROM_HERE, |
1897 NewRunnableMethod(this, &ExtensionsService::UnloadExtension, | 1882 NewRunnableMethod(this, &ExtensionsService::UnloadExtension, |
1898 host->extension()->id())); | 1883 host->extension()->id())); |
1899 break; | 1884 break; |
1900 } | 1885 } |
1901 | 1886 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 } | 1927 } |
1943 | 1928 |
1944 bool ExtensionsService::IsBeingUpgraded(const Extension* extension) { | 1929 bool ExtensionsService::IsBeingUpgraded(const Extension* extension) { |
1945 return extension_runtime_data_[extension->id()].being_upgraded; | 1930 return extension_runtime_data_[extension->id()].being_upgraded; |
1946 } | 1931 } |
1947 | 1932 |
1948 void ExtensionsService::SetBeingUpgraded(const Extension* extension, | 1933 void ExtensionsService::SetBeingUpgraded(const Extension* extension, |
1949 bool value) { | 1934 bool value) { |
1950 extension_runtime_data_[extension->id()].being_upgraded = value; | 1935 extension_runtime_data_[extension->id()].being_upgraded = value; |
1951 } | 1936 } |
OLD | NEW |