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/component_updater/pepper_flash_component_installer.h" | 5 #include "chrome/browser/component_updater/pepper_flash_component_installer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 if (plugin.path == placeholder_path) { | 123 if (plugin.path == placeholder_path) { |
124 // This is the Flash placeholder; replace it regardless of version or | 124 // This is the Flash placeholder; replace it regardless of version or |
125 // other considerations. | 125 // other considerations. |
126 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path); | 126 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path); |
127 break; | 127 break; |
128 } | 128 } |
129 | 129 |
130 base::Version registered_version(base::UTF16ToUTF8(plugin.version)); | 130 base::Version registered_version(base::UTF16ToUTF8(plugin.version)); |
131 | 131 |
132 // If lower version, never register. | 132 // If lower or equal version, never register. |
133 if (registered_version.IsValid() && | 133 if (registered_version.IsValid() && |
134 version.CompareTo(registered_version) < 0) { | 134 version.CompareTo(registered_version) <= 0) { |
135 return; | 135 return; |
136 } | 136 } |
137 | 137 |
138 bool registered_is_debug_system = | |
139 !system_flash_path.empty() && | |
140 base::FilePath::CompareEqualIgnoreCase(plugin.path.value(), | |
141 system_flash_path.value()) && | |
142 chrome::IsSystemFlashScriptDebuggerPresent(); | |
143 bool is_on_network = false; | |
144 #if defined(OS_WIN) | |
145 // On Windows, component updated DLLs can't load off network drives. | |
146 // See crbug.com/572131 for details. | |
147 is_on_network = base::IsOnNetworkDrive(path); | |
148 #endif | |
149 // If equal version, register iff component is not on a network drive, | |
150 // and the version of flash is not debug system. | |
151 if (registered_version.IsValid() && | |
152 version.CompareTo(registered_version) == 0 && | |
153 (is_on_network || registered_is_debug_system)) { | |
154 return; | |
155 } | |
156 | |
157 // If the version is newer, remove the old one first. | 138 // If the version is newer, remove the old one first. |
158 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path); | 139 PluginService::GetInstance()->UnregisterInternalPlugin(plugin.path); |
159 break; | 140 break; |
160 } | 141 } |
161 | 142 |
162 PluginService::GetInstance()->RegisterInternalPlugin(web_plugin, true); | 143 PluginService::GetInstance()->RegisterInternalPlugin(web_plugin, true); |
163 PluginService::GetInstance()->RefreshPlugins(); | 144 PluginService::GetInstance()->RefreshPlugins(); |
164 } | 145 } |
165 | 146 |
166 void UpdatePathService(const base::FilePath& path) { | 147 void UpdatePathService(const base::FilePath& path) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 std::unique_ptr<ComponentInstallerTraits> traits( | 266 std::unique_ptr<ComponentInstallerTraits> traits( |
286 new FlashComponentInstallerTraits); | 267 new FlashComponentInstallerTraits); |
287 // |cus| will take ownership of |installer| during installer->Register(cus). | 268 // |cus| will take ownership of |installer| during installer->Register(cus). |
288 DefaultComponentInstaller* installer = | 269 DefaultComponentInstaller* installer = |
289 new DefaultComponentInstaller(std::move(traits)); | 270 new DefaultComponentInstaller(std::move(traits)); |
290 installer->Register(cus, base::Closure()); | 271 installer->Register(cus, base::Closure()); |
291 #endif // defined(GOOGLE_CHROME_BUILD) | 272 #endif // defined(GOOGLE_CHROME_BUILD) |
292 } | 273 } |
293 | 274 |
294 } // namespace component_updater | 275 } // namespace component_updater |
OLD | NEW |