• Istiaque Ahmed's avatar
    Disallow calling value builders' Set/Append(??, bool) methods. · 723fb472
    Istiaque Ahmed authored
    Currently calling DictionaryValue::Set(??, bool) and
    ListValue::Append(bool) would result in calling int variant from
    the overloaded methods(!). This is confusing and can be a source
    of bugs.
    (The current suggested way is to explicitly call SetBoolean and
    AppendBoolean).
    
    There is only once place where this was happening, in
    extension_printer_handler.cc. Fix that code to use boolean variant,
    by using SetBoolean() method.
    
    This CL will also let us overload the bool variant in future. This CL
    - Provides an explicit "const char*" param overload.
    - Declares a bool overload but makes it inaccessible (= delete).
    
    This will
    - Make sure attempting to call DictionaryValue::Set with bool
      will fail compile (call to deleted member function 'Set'). So
      accidental introduction of such bugs won't be possible.
    - The char* variant will make sure we don't attempt to resolve
      bool to this pointer variant.
    - Give us the ability to remove GetBoolean/AppendBoolean.
    
    Bug: 831839
    Change-Id: If61ce8a44799ff8e12957d5206baf74467655894
    Test: Expect no behavior change, touches webui/print_preview FYI
    Reviewed-on: https://chromium-review.googlesource.com/1008870Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
    Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
    Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
    Commit-Queue: Istiaque Ahmed <lazyboy@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#550196}
    723fb472
value_builder.cc 3.18 KB