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_finder.h" | 5 #include "chrome/browser/plugin_finder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 std::string url; | 123 std::string url; |
124 bool success = plugin_dict->GetString("url", &url); | 124 bool success = plugin_dict->GetString("url", &url); |
125 DCHECK(success); | 125 DCHECK(success); |
126 std::string help_url; | 126 std::string help_url; |
127 plugin_dict->GetString("help_url", &help_url); | 127 plugin_dict->GetString("help_url", &help_url); |
128 string16 name; | 128 string16 name; |
129 success = plugin_dict->GetString("name", &name); | 129 success = plugin_dict->GetString("name", &name); |
130 DCHECK(success); | 130 DCHECK(success); |
131 bool display_url = false; | 131 bool display_url = false; |
132 plugin_dict->GetBoolean("displayurl", &display_url); | 132 plugin_dict->GetBoolean("displayurl", &display_url); |
133 bool requires_authorization = true; | 133 |
134 plugin_dict->GetBoolean("requires_authorization", &requires_authorization); | |
135 PluginInstaller* installer = new PluginInstaller(identifier, | 134 PluginInstaller* installer = new PluginInstaller(identifier, |
136 GURL(url), | |
137 GURL(help_url), | |
138 name, | 135 name, |
139 display_url, | 136 display_url, |
140 requires_authorization); | 137 GURL(url), |
138 GURL(help_url)); | |
139 ListValue* versions = NULL; | |
140 if (plugin_dict->GetList("versions", &versions)) { | |
141 for (ListValue::const_iterator it = versions->begin(); | |
142 it != versions->end(); ++it) { | |
143 DictionaryValue* version_dict = NULL; | |
144 if (!(*it)->GetAsDictionary(&version_dict)) { | |
145 NOTREACHED(); | |
146 continue; | |
147 } | |
148 std::string version; | |
149 success = version_dict->GetString("version", &version); | |
150 DCHECK(success); | |
151 std::string status_str; | |
152 success = version_dict->GetString("status", &status_str); | |
153 DCHECK(success); | |
154 PluginInstaller::SecurityStatus status = | |
155 PluginInstaller::SECURITY_STATUS_UP_TO_DATE; | |
jochen (gone - plz use gerrit)
2012/05/18 18:48:18
would it be safer to default to not up to date, as
Bernhard Bauer
2012/05/21 10:52:27
A parse error is one of those "should never happen
| |
156 success = PluginInstaller::ParseSecurityStatus(status_str, &status); | |
157 DCHECK(success); | |
158 installer->AddVersion(Version(version), status); | |
159 } | |
160 } | |
161 | |
141 installers_[identifier] = installer; | 162 installers_[identifier] = installer; |
142 return installer; | 163 return installer; |
143 } | 164 } |
OLD | NEW |