Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1606)

Side by Side Diff: chrome/browser/plugin_finder.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 plugin_it.HasNext(); plugin_it.Advance()) { 76 plugin_it.HasNext(); plugin_it.Advance()) {
77 const DictionaryValue* plugin = NULL; 77 const DictionaryValue* plugin = NULL;
78 if (!plugin_it.value().GetAsDictionary(&plugin)) { 78 if (!plugin_it.value().GetAsDictionary(&plugin)) {
79 NOTREACHED(); 79 NOTREACHED();
80 continue; 80 continue;
81 } 81 }
82 std::string language_str; 82 std::string language_str;
83 bool success = plugin->GetString("lang", &language_str); 83 bool success = plugin->GetString("lang", &language_str);
84 if (language_str != language) 84 if (language_str != language)
85 continue; 85 continue;
86 ListValue* mime_types = NULL; 86 const ListValue* mime_types = NULL;
87 plugin->GetList("mime_types", &mime_types); 87 plugin->GetList("mime_types", &mime_types);
88 DCHECK(success); 88 DCHECK(success);
89 for (ListValue::const_iterator mime_type_it = mime_types->begin(); 89 for (ListValue::const_iterator mime_type_it = mime_types->begin();
90 mime_type_it != mime_types->end(); ++mime_type_it) { 90 mime_type_it != mime_types->end(); ++mime_type_it) {
91 std::string mime_type_str; 91 std::string mime_type_str;
92 success = (*mime_type_it)->GetAsString(&mime_type_str); 92 success = (*mime_type_it)->GetAsString(&mime_type_str);
93 DCHECK(success); 93 DCHECK(success);
94 if (mime_type_str == mime_type) { 94 if (mime_type_str == mime_type) {
95 std::string identifier = plugin_it.key(); 95 std::string identifier = plugin_it.key();
96 std::map<std::string, PluginInstaller*>::const_iterator installer = 96 std::map<std::string, PluginInstaller*>::const_iterator installer =
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 success = plugin_dict->GetString("name", &name); 128 success = plugin_dict->GetString("name", &name);
129 DCHECK(success); 129 DCHECK(success);
130 bool display_url = false; 130 bool display_url = false;
131 plugin_dict->GetBoolean("displayurl", &display_url); 131 plugin_dict->GetBoolean("displayurl", &display_url);
132 132
133 PluginInstaller* installer = new PluginInstaller(identifier, 133 PluginInstaller* installer = new PluginInstaller(identifier,
134 name, 134 name,
135 display_url, 135 display_url,
136 GURL(url), 136 GURL(url),
137 GURL(help_url)); 137 GURL(help_url));
138 ListValue* versions = NULL; 138 const ListValue* versions = NULL;
139 if (plugin_dict->GetList("versions", &versions)) { 139 if (plugin_dict->GetList("versions", &versions)) {
140 for (ListValue::const_iterator it = versions->begin(); 140 for (ListValue::const_iterator it = versions->begin();
141 it != versions->end(); ++it) { 141 it != versions->end(); ++it) {
142 DictionaryValue* version_dict = NULL; 142 DictionaryValue* version_dict = NULL;
143 if (!(*it)->GetAsDictionary(&version_dict)) { 143 if (!(*it)->GetAsDictionary(&version_dict)) {
144 NOTREACHED(); 144 NOTREACHED();
145 continue; 145 continue;
146 } 146 }
147 std::string version; 147 std::string version;
148 success = version_dict->GetString("version", &version); 148 success = version_dict->GetString("version", &version);
149 DCHECK(success); 149 DCHECK(success);
150 std::string status_str; 150 std::string status_str;
151 success = version_dict->GetString("status", &status_str); 151 success = version_dict->GetString("status", &status_str);
152 DCHECK(success); 152 DCHECK(success);
153 PluginInstaller::SecurityStatus status = 153 PluginInstaller::SecurityStatus status =
154 PluginInstaller::SECURITY_STATUS_UP_TO_DATE; 154 PluginInstaller::SECURITY_STATUS_UP_TO_DATE;
155 success = PluginInstaller::ParseSecurityStatus(status_str, &status); 155 success = PluginInstaller::ParseSecurityStatus(status_str, &status);
156 DCHECK(success); 156 DCHECK(success);
157 installer->AddVersion(Version(version), status); 157 installer->AddVersion(Version(version), status);
158 } 158 }
159 } 159 }
160 160
161 installers_[identifier] = installer; 161 installers_[identifier] = installer;
162 return installer; 162 return installer;
163 } 163 }
OLDNEW
« no previous file with comments | « chrome/browser/net/http_server_properties_manager.cc ('k') | chrome/browser/plugin_finder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698