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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_api.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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/extensions/api/content_settings/content_settings_api.h" 5 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chrome/browser/content_settings/cookie_settings_factory.h" 16 #include "chrome/browser/content_settings/cookie_settings_factory.h"
16 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 17 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
17 #include "chrome/browser/extensions/api/content_settings/content_settings_api_co nstants.h" 18 #include "chrome/browser/extensions/api/content_settings/content_settings_api_co nstants.h"
18 #include "chrome/browser/extensions/api/content_settings/content_settings_helper s.h" 19 #include "chrome/browser/extensions/api/content_settings/content_settings_helper s.h"
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 std::unique_ptr<base::ListValue> list(new base::ListValue()); 310 std::unique_ptr<base::ListValue> list(new base::ListValue());
310 for (std::vector<content::WebPluginInfo>::const_iterator it = plugins.begin(); 311 for (std::vector<content::WebPluginInfo>::const_iterator it = plugins.begin();
311 it != plugins.end(); ++it) { 312 it != plugins.end(); ++it) {
312 std::unique_ptr<PluginMetadata> plugin_metadata( 313 std::unique_ptr<PluginMetadata> plugin_metadata(
313 finder->GetPluginMetadata(*it)); 314 finder->GetPluginMetadata(*it));
314 const std::string& group_identifier = plugin_metadata->identifier(); 315 const std::string& group_identifier = plugin_metadata->identifier();
315 if (group_identifiers.find(group_identifier) != group_identifiers.end()) 316 if (group_identifiers.find(group_identifier) != group_identifiers.end())
316 continue; 317 continue;
317 318
318 group_identifiers.insert(group_identifier); 319 group_identifiers.insert(group_identifier);
319 base::DictionaryValue* dict = new base::DictionaryValue(); 320 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
320 dict->SetString(keys::kIdKey, group_identifier); 321 dict->SetString(keys::kIdKey, group_identifier);
321 dict->SetString(keys::kDescriptionKey, plugin_metadata->name()); 322 dict->SetString(keys::kDescriptionKey, plugin_metadata->name());
322 list->Append(dict); 323 list->Append(std::move(dict));
323 } 324 }
324 SetResult(std::move(list)); 325 SetResult(std::move(list));
325 BrowserThread::PostTask( 326 BrowserThread::PostTask(
326 BrowserThread::UI, FROM_HERE, base::Bind( 327 BrowserThread::UI, FROM_HERE, base::Bind(
327 &ContentSettingsContentSettingGetResourceIdentifiersFunction:: 328 &ContentSettingsContentSettingGetResourceIdentifiersFunction::
328 SendResponse, 329 SendResponse,
329 this, 330 this,
330 true)); 331 true));
331 } 332 }
332 333
333 } // namespace extensions 334 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698