| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 // notification on installation. For such extensions, mark them acknowledged | 2059 // notification on installation. For such extensions, mark them acknowledged |
| 2060 // now to suppress the notification. | 2060 // now to suppress the notification. |
| 2061 if (mark_acknowledged) | 2061 if (mark_acknowledged) |
| 2062 AcknowledgeExternalExtension(id); | 2062 AcknowledgeExternalExtension(id); |
| 2063 | 2063 |
| 2064 return true; | 2064 return true; |
| 2065 } | 2065 } |
| 2066 | 2066 |
| 2067 void ExtensionService::ReportExtensionLoadError( | 2067 void ExtensionService::ReportExtensionLoadError( |
| 2068 const base::FilePath& extension_path, | 2068 const base::FilePath& extension_path, |
| 2069 const std::string &error, | 2069 const std::string &error) { |
| 2070 bool be_noisy) { | |
| 2071 content::NotificationService::current()->Notify( | 2070 content::NotificationService::current()->Notify( |
| 2072 chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, | 2071 chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, |
| 2073 content::Source<Profile>(profile_), | 2072 content::Source<Profile>(profile_), |
| 2074 content::Details<const std::string>(&error)); | 2073 content::Details<const std::string>(&error)); |
| 2075 | 2074 |
| 2076 std::string path_str = base::UTF16ToUTF8(extension_path.LossyDisplayName()); | 2075 std::string path_str = base::UTF16ToUTF8(extension_path.LossyDisplayName()); |
| 2077 bool retry = false; | |
| 2078 std::string retry_prompt; | |
| 2079 if (be_noisy) | |
| 2080 retry_prompt = "\n\nWould you like to retry?"; | |
| 2081 | |
| 2082 base::string16 message = base::UTF8ToUTF16( | 2076 base::string16 message = base::UTF8ToUTF16( |
| 2083 base::StringPrintf("Could not load extension from '%s'. %s%s", | 2077 base::StringPrintf("Could not load extension from '%s'. %s", |
| 2084 path_str.c_str(), | 2078 path_str.c_str(), |
| 2085 error.c_str(), | 2079 error.c_str())); |
| 2086 retry_prompt.c_str())); | 2080 ExtensionErrorReporter::GetInstance()->ReportError(message, false); |
| 2087 ExtensionErrorReporter::GetInstance()->ReportError(message, be_noisy, &retry); | |
| 2088 NotifyLoadRetry(retry, extension_path); | |
| 2089 } | |
| 2090 | |
| 2091 void ExtensionService::NotifyLoadRetry(bool retry, | |
| 2092 const base::FilePath& extension_path) { | |
| 2093 std::pair<bool, const base::FilePath&> details(retry, extension_path); | |
| 2094 content::NotificationService::current()->Notify( | |
| 2095 chrome::NOTIFICATION_EXTENSION_LOAD_RETRY, | |
| 2096 content::Source<Profile>(profile_), | |
| 2097 content::Details<std::pair<bool, const base::FilePath&> >(&details)); | |
| 2098 } | 2081 } |
| 2099 | 2082 |
| 2100 void ExtensionService::DidCreateRenderViewForBackgroundPage( | 2083 void ExtensionService::DidCreateRenderViewForBackgroundPage( |
| 2101 extensions::ExtensionHost* host) { | 2084 extensions::ExtensionHost* host) { |
| 2102 OrphanedDevTools::iterator iter = | 2085 OrphanedDevTools::iterator iter = |
| 2103 orphaned_dev_tools_.find(host->extension_id()); | 2086 orphaned_dev_tools_.find(host->extension_id()); |
| 2104 if (iter == orphaned_dev_tools_.end()) | 2087 if (iter == orphaned_dev_tools_.end()) |
| 2105 return; | 2088 return; |
| 2106 | 2089 |
| 2107 iter->second->ConnectRenderViewHost(host->render_view_host()); | 2090 iter->second->ConnectRenderViewHost(host->render_view_host()); |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2443 void ExtensionService::UnloadAllExtensionsInternal() { | 2426 void ExtensionService::UnloadAllExtensionsInternal() { |
| 2444 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); | 2427 profile_->GetExtensionSpecialStoragePolicy()->RevokeRightsForAllExtensions(); |
| 2445 | 2428 |
| 2446 registry_->ClearAll(); | 2429 registry_->ClearAll(); |
| 2447 system_->runtime_data()->ClearAll(); | 2430 system_->runtime_data()->ClearAll(); |
| 2448 | 2431 |
| 2449 // TODO(erikkay) should there be a notification for this? We can't use | 2432 // TODO(erikkay) should there be a notification for this? We can't use |
| 2450 // EXTENSION_UNLOADED since that implies that the extension has been disabled | 2433 // EXTENSION_UNLOADED since that implies that the extension has been disabled |
| 2451 // or uninstalled. | 2434 // or uninstalled. |
| 2452 } | 2435 } |
| OLD | NEW |