OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin_installer.h" | 5 #include "chrome/browser/plugin_installer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "content/public/browser/download_manager.h" | 21 #include "content/public/browser/download_manager.h" |
22 #include "content/public/browser/download_save_info.h" | 22 #include "content/public/browser/download_save_info.h" |
23 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/browser/resource_context.h" | 25 #include "content/public/browser/resource_context.h" |
26 #include "content/public/browser/resource_dispatcher_host.h" | 26 #include "content/public/browser/resource_dispatcher_host.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 #include "net/url_request/url_request.h" | 28 #include "net/url_request/url_request.h" |
29 #include "net/url_request/url_request_context.h" | 29 #include "net/url_request/url_request_context.h" |
30 #include "webkit/plugins/npapi/plugin_group.h" | 30 #include "webkit/plugins/npapi/plugin_group.h" |
| 31 #include "webkit/plugins/npapi/plugin_utils.h" |
| 32 #include "webkit/plugins/webplugininfo.h" |
31 | 33 |
32 using content::BrowserContext; | 34 using content::BrowserContext; |
33 using content::BrowserThread; | 35 using content::BrowserThread; |
34 using content::DownloadItem; | 36 using content::DownloadItem; |
35 using content::DownloadManager; | 37 using content::DownloadManager; |
36 using content::ResourceDispatcherHost; | 38 using content::ResourceDispatcherHost; |
37 | 39 |
38 namespace { | 40 namespace { |
39 | 41 |
40 void BeginDownload( | 42 void BeginDownload( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 versions_[version] = status; | 93 versions_[version] = status; |
92 } | 94 } |
93 | 95 |
94 PluginInstaller::SecurityStatus PluginInstaller::GetSecurityStatus( | 96 PluginInstaller::SecurityStatus PluginInstaller::GetSecurityStatus( |
95 const webkit::WebPluginInfo& plugin) const { | 97 const webkit::WebPluginInfo& plugin) const { |
96 // If there are no versions defined, the plug-in should require authorization. | 98 // If there are no versions defined, the plug-in should require authorization. |
97 if (versions_.empty()) | 99 if (versions_.empty()) |
98 return SECURITY_STATUS_REQUIRES_AUTHORIZATION; | 100 return SECURITY_STATUS_REQUIRES_AUTHORIZATION; |
99 | 101 |
100 Version version; | 102 Version version; |
101 webkit::npapi::PluginGroup::CreateVersionFromString(plugin.version, &version); | 103 webkit::npapi::CreateVersionFromString(plugin.version, &version); |
102 if (!version.IsValid()) | 104 if (!version.IsValid()) |
103 version = Version("0"); | 105 version = Version("0"); |
104 | 106 |
105 // |lower_bound| returns the latest version that is not newer than |version|. | 107 // |lower_bound| returns the latest version that is not newer than |version|. |
106 std::map<Version, SecurityStatus, VersionComparator>::const_iterator it = | 108 std::map<Version, SecurityStatus, VersionComparator>::const_iterator it = |
107 versions_.lower_bound(version); | 109 versions_.lower_bound(version); |
108 // If there is at least one version defined, everything older than the oldest | 110 // If there is at least one version defined, everything older than the oldest |
109 // defined version is considered out-of-date. | 111 // defined version is considered out-of-date. |
110 if (it == versions_.end()) | 112 if (it == versions_.end()) |
111 return SECURITY_STATUS_OUT_OF_DATE; | 113 return SECURITY_STATUS_OUT_OF_DATE; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 250 |
249 void PluginInstaller::DownloadCancelled() { | 251 void PluginInstaller::DownloadCancelled() { |
250 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); | 252 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); |
251 state_ = INSTALLER_STATE_IDLE; | 253 state_ = INSTALLER_STATE_IDLE; |
252 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); | 254 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); |
253 } | 255 } |
254 | 256 |
255 bool PluginInstaller::MatchesPlugin(const webkit::WebPluginInfo& plugin) { | 257 bool PluginInstaller::MatchesPlugin(const webkit::WebPluginInfo& plugin) { |
256 return plugin.name.find(group_name_matcher_) != string16::npos; | 258 return plugin.name.find(group_name_matcher_) != string16::npos; |
257 } | 259 } |
OLD | NEW |