// Copyright (c) 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // GENERATED FROM THE API DEFINITION IN // chrome/common/extensions/api/browser.idl // DO NOT EDIT. #include "tools/json_schema_compiler/util.h" #include "base/logging.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "chrome/common/extensions/api/browser.h" #include #include using base::UTF8ToUTF16; namespace extensions { namespace api { namespace browser { // // Types // OpenTabOptions::OpenTabOptions() {} OpenTabOptions::~OpenTabOptions() {} OpenTabOptions::OpenTabOptions(OpenTabOptions&& rhs) : url(std::move(rhs.url)){ } OpenTabOptions& OpenTabOptions::operator=(OpenTabOptions&& rhs) { url = std::move(rhs.url); return *this; } // static bool OpenTabOptions::Populate( const base::Value& value, OpenTabOptions* out) { if (!value.is_dict()) { return false; } const base::DictionaryValue* dict = static_cast(&value); const base::Value* url_value = NULL; if (!dict->GetWithoutPathExpansion("url", &url_value)) { return false; } { if (!url_value->GetAsString(&out->url)) { return false; } } return true; } // static std::unique_ptr OpenTabOptions::FromValue(const base::Value& value) { std::unique_ptr out(new OpenTabOptions()); if (!Populate(value, out.get())) return nullptr; return out; } std::unique_ptr OpenTabOptions::ToValue() const { std::unique_ptr value(new base::DictionaryValue()); value->SetWithoutPathExpansion("url", std::make_unique(this->url)); return value; } // // Functions // namespace OpenTab { Params::Params() {} Params::~Params() {} // static std::unique_ptr Params::Create(const base::ListValue& args) { if (args.GetSize() != 1) { return nullptr; } std::unique_ptr params(new Params()); const base::Value* options_value = NULL; if (args.Get(0, &options_value) && !options_value->is_none()) { { const base::DictionaryValue* dictionary = NULL; if (!options_value->GetAsDictionary(&dictionary)) { return std::unique_ptr(); } if (!OpenTabOptions::Populate(*dictionary, ¶ms->options)) { return std::unique_ptr(); } } } else { return std::unique_ptr(); } return params; } std::unique_ptr Results::Create() { std::unique_ptr create_results(new base::ListValue()); return create_results; } } // namespace OpenTab } // namespace browser } // namespace api } // namespace extensions