Add scoped_ptr-safe base::Value to Dictionary/List conversion functions.
commit259c0a3f44bdd8130c5d835e9f596624a079fbd1
authorreillyg <reillyg@chromium.org>
Fri, 11 Sep 2015 00:25:54 +0000 (10 17:25 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 11 Sep 2015 00:26:37 +0000 (11 00:26 +0000)
tree8c69523a7745aa71e6d67cdedad5b5ce0336b4a9
parent9a1461f5cbacfc7d5c40ac2cd2cc0ec104e9b39c
Add scoped_ptr-safe base::Value to Dictionary/List conversion functions.

This change adds two static From() functions to the DictionaryValue and
ListValue classes which take a scoped_ptr to a Value and either convert
it to a scoped_ptr to a DictionaryValue or ListValue, or return nullptr.
These are intended to replace the existing pattern,

  make_scoped_ptr(static_cast<base::DictionaryValue*>(value.release()))

with the shorter and safer alternative,

  base::DictionaryValue::From(value.Pass())

Instances of this pattern in //extensions have been converted as
examples.

Review URL: https://codereview.chromium.org/1308013005

Cr-Commit-Position: refs/heads/master@{#348294}
14 files changed:
base/values.cc
base/values.h
extensions/browser/api/sockets_tcp/sockets_tcp_apitest.cc
extensions/browser/api/sockets_tcp_server/sockets_tcp_server_apitest.cc
extensions/browser/api_test_utils.cc
extensions/common/extension_api.cc
extensions/common/features/json_feature_provider_source.cc
extensions/common/file_util.cc
extensions/common/file_util.h
extensions/common/file_util_unittest.cc
extensions/renderer/event_bindings.cc
extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
extensions/utility/unpacker.cc
extensions/utility/unpacker.h