This CL removes the usage of deprecated ListValue::AppendString(),
ListValue::AppendInteger() and ListValue::AppendBoolean() API from
tools/json_schema_compiler/.
BUG=1187102, 1187099, 1187100
Change-Id: I2d6abf3742e202c62fa8bded33eb1f0803a00c60
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3026696
Commit-Queue: Maggie Cai <mxcai@chromium.org>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#902293}
This change removes the use of Value::GetAs* and replaces with
Value::is_*(), Value::Get*(), Value::GetIf*().
Bug: 1187003, 1187006, 1187007
Change-Id: Idcefdb56d3438c42738e9dbbf046723c38da8e6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3022522
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Thomas Lukaszewicz <tluk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#900737}
This change removes the use of Value::GetAsBoolean
and replaces with Value::is_bool(), Value::GetBool(),
Value::GetIfBool().
Bug: 1187003
Change-Id: Ie11137a1fe5d739a3cd932eb9d6213a046282804
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2869287
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#879054}
This change replaces usages of base::Value::GetList() followed by either
emplace_back() or push_back() with base::Value::Append(). This is
because of the upcoming change to GetList() to return a base::span
instead, which does not support either emplace_back() or push_back().
This is a mostly mechanical change. Steps to reproduce:
- sed -i 's/GetList().push_back/Append/g'
- sed -i 's/GetList().emplace_back/Append/g'
- git cl format
- Manually fixing the breakage in base/json/json_writer_unittest.cc
and tools/json_schema_compiler/util.cc
TBR=afakhry,boliu,eugenebut,mmoroz,rdevlin.cronin,rockot@google.com,sandersd
Bug: 646113
Change-Id: I2f13fd0efa7fe712f7659500404192be4a344e14
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796427
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: Dan Sanders <sandersd@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695711}
This change replaces usages of base::Value::GetType with
base::Value::type for files compiled on Linux.
Bug: 646113
Change-Id: Idbb142c2f15fdb7a75ffee1d547d5de2129d83b0
Reviewed-on: https://chromium-review.googlesource.com/702456
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#507204}
This change removes the deprecated base::Value::GetAsBinary in favor of
base::Value::is_blob() and base::Value::GetBlob().
BUG=646113
Review-Url: https://codereview.chromium.org/2839753005
Cr-Commit-Position: refs/heads/master@{#467102}
This change removes the deprecated base::Value::Get{Buffer(),Size()} and
replaces them with base::Value::GetBlob().{data(),size()} while
simplifing the code where appropriate.
BUG=646113
Review-Url: https://codereview.chromium.org/2841623003
Cr-Commit-Position: refs/heads/master@{#467085}
As a follow-up to typedeffing base::BinaryValue to base::Value in
http://crrev.com/2689673002 this change replaces all references to
base::StringValue by base::Value. Also it adds missing #includes of base/values.h.
BUG=646113
Review-Url: https://codereview.chromium.org/2799093006
Cr-Commit-Position: refs/heads/master@{#463568}
As mentioned in the base::Value refactor proposal, base::Value::Type should be a
C++11 style scoped enumeration. This change addresses this issue by adding the
required keyword, making the necessary substitutions and adding casts where
needed.
TBR=stevenjb@chromium.org
BUG=646113
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel
Review-Url: https://codereview.chromium.org/2539363004
Cr-Commit-Position: refs/heads/master@{#436961}
The raw pointer overload of ListValue::Append() is deprecated and will
be removed. Instead, code should just write:
- ListValue::AppendBoolean()
- ListValue::AppendInteger()
- ListValue::AppendDouble()
- ListValue::AppendString()
BUG=581865
Review-Url: https://codereview.chromium.org/2036013002
Cr-Commit-Position: refs/heads/master@{#397571}
After the work to implement movable types in extensions generated code
(completed in r384773), we now only use linked_ptrs to store base::Values in
containers. Luckily, we don't need to - convert these to scoped_ptrs and
eliminate all traces of linked_ptrs from extensions generated code.
BUG=595949
TBR=isherman@chromium.org (autofill IWYU fix)
Review URL: https://codereview.chromium.org/1854993002
Cr-Commit-Position: refs/heads/master@{#385005}
When a JSON schema includes an array of objects PopulateArrayFromList
calls a specialized PopulateItem instance for the generated object
type. When compiled with generate_error_messages=True the generated
type's Populate method expects to receive an error parameter. This
patch adds versions of the PopulateArrayFromList and PopulateItem
functions that pass through and provide that parameter.
This capability is required for a new manifest key that will include
an array of objects being added as part of issue 468955.
Review URL: https://codereview.chromium.org/1128523003
Cr-Commit-Position: refs/heads/master@{#328471}
This change enables ArrayBuffer[] in IDLs / json-schema descriptions of extension APIs.
This affects the code generated from these descriptions:
The C++ members (and arguments to the ::Create functions) that refer to binary values are now represented by std::vector<char> instead of std::string.
All usages are adapted in this CL.
While there, this change updates the affected code parts
- to use vector_as_array where it makes sense
- unnecessary copies are removed where easily possible
- and range based assigns ( ::assign(InputIterator first, InputIterator last) or the same with c'tors) are uniformly used.
BUG=448383
TBR=stevenjb@chromium.org (chromeos/dbus was reviewed by bartfab@)
Review URL: https://codereview.chromium.org/820673004
Cr-Commit-Position: refs/heads/master@{#312183}
There were several GetItemFromList functions that extract an element from a ListValue and converted it.
This change consolidates the list access into a single place and simplifies the GetItemFromList to the conversion only (renamed to PopulateItem).
No functional change.
Review URL: https://codereview.chromium.org/851673003
Cr-Commit-Position: refs/heads/master@{#312082}
src/tools/json_schema_compiler: Do not use Value::Create*.
BUG=160586
Review URL: https://chromiumcodereview.appspot.com/22885002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217444 0039d316-1c4b-4281-b951-d872f2087c98
Provides the ability to generate error messages within schema-compiled code for ease of debugging.
Error messages may be disabled by adding a 'generate_error_messages' property to json schema, e.g. "generate_error_messages": false
Error generation mostly written by Aaron Jacobs (https://codereview.chromium.org/16462004/).
BUG=234834
Review URL: https://chromiumcodereview.appspot.com/22228002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217118 0039d316-1c4b-4281-b951-d872f2087c98
This makes sync and net compile with no "using *Value".
BUG=
Review URL: https://codereview.chromium.org/17034006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207907 0039d316-1c4b-4281-b951-d872f2087c98
support the full range of JSON/IDL features, improve the interface of generated
code, and improve generated code formatting, notably:
* Make "choices" generate a struct containing each possible type, rather than
multiple fields with different names plus and enum. This makes it possible
to embed choices inside containers - notably within arrays (as in bug).
It also improves optional choices detection.
* Remove the Any C++ type generated by "any", and model it as a base::Value.
* Make "additionalProperties" generated a std::map with the actual types as
values, rather than just a DictionaryValue forcing callers to extract types.
* Fix enum naming, it was unnecessarily including the namespace as a prefix.
R=yoz@chromium.org
BUG=162044
Review URL: https://codereview.chromium.org/11827026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177361 0039d316-1c4b-4281-b951-d872f2087c98
For problem description and other info please see the BUG page.
This is for ListValue.
BUG=138946
TEST=N/A (no fix & no new feature)
TBR=jar,zelidrag,scottbyer,mpcomplete,darin,achuith,sky,estade,atwilson,grt,thakis,jamesr,hans,sadrul,pastarmovj
Review URL: https://chromiumcodereview.appspot.com/10837044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149819 0039d316-1c4b-4281-b951-d872f2087c98
Add support and tests for more json types. Also fixed a number of API jsons.
BUG=
TEST=
Review URL: http://codereview.chromium.org/9491002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124643 0039d316-1c4b-4281-b951-d872f2087c98
as miscellaneous improvements to get at least 3 more schema files compiling:
windows, tabs, and the in-progress experimental.declarative.
For description of the generator, see http://codereview.chromium.org/9114036/
BUG=
TEST=
Review URL: http://codereview.chromium.org/9309044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122082 0039d316-1c4b-4281-b951-d872f2087c98
This is a preliminary code review for a code generator. The tool's purpose is to generate the tedious serialization code that needs to be written when defining a new extensions api. It generates from the json files in chrome/common/extensions/api.
As an example usage, chrome/browser/extensions/extension_permissions_api.cc has been changed to use a class generated from permissions.json.
The tool has been integrated into the build system and generates compiling and working code (for permissions.json at least)
BUG=
TEST=
Review URL: http://codereview.chromium.org/9114036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119405 0039d316-1c4b-4281-b951-d872f2087c98