// 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 // extensions/common/api/events.json // DO NOT EDIT. #ifndef EXTENSIONS_COMMON_API_EVENTS_H__ #define EXTENSIONS_COMMON_API_EVENTS_H__ #include #include #include #include #include #include "base/logging.h" #include "base/values.h" namespace extensions { namespace api { namespace events { // // Types // // Description of a declarative rule for handling events. struct Rule { Rule(); ~Rule(); Rule(Rule&& rhs); Rule& operator=(Rule&& rhs); // Populates a Rule object from a base::Value. Returns whether |out| was // successfully populated. static bool Populate(const base::Value& value, Rule* out); // Creates a Rule object from a base::Value, or NULL on failure. static std::unique_ptr FromValue(const base::Value& value); // Returns a new base::DictionaryValue representing the serialized form of // this Rule object. std::unique_ptr ToValue() const; // Optional identifier that allows referencing this rule. std::unique_ptr id; // Tags can be used to annotate rules and perform operations on sets of rules. std::unique_ptr> tags; // List of conditions that can trigger the actions. std::vector> conditions; // List of actions that are triggered if one of the conditions is fulfilled. std::vector> actions; // Optional priority of this rule. Defaults to 100. std::unique_ptr priority; private: DISALLOW_COPY_AND_ASSIGN(Rule); }; namespace Event { namespace AddRules { struct Params { static std::unique_ptr Create(const base::ListValue& args); ~Params(); // Name of the event this function affects. std::string event_name; // If provided, this is an integer that uniquely identfies the // associated with this function call. int web_view_instance_id; // Rules to be registered. These do not replace previously registered rules. std::vector rules; private: Params(); DISALLOW_COPY_AND_ASSIGN(Params); }; namespace Results { // Rules that were registered, the optional parameters are filled with values. std::unique_ptr Create(const std::vector& rules); } // namespace Results } // namespace AddRules namespace GetRules { struct Params { static std::unique_ptr Create(const base::ListValue& args); ~Params(); // Name of the event this function affects. std::string event_name; // If provided, this is an integer that uniquely identfies the // associated with this function call. int web_view_instance_id; // If an array is passed, only rules with identifiers contained in this array // are returned. std::unique_ptr> rule_identifiers; private: Params(); DISALLOW_COPY_AND_ASSIGN(Params); }; namespace Results { // Rules that were registered, the optional parameters are filled with values. std::unique_ptr Create(const std::vector& rules); } // namespace Results } // namespace GetRules namespace RemoveRules { struct Params { static std::unique_ptr Create(const base::ListValue& args); ~Params(); // Name of the event this function affects. std::string event_name; // If provided, this is an integer that uniquely identfies the // associated with this function call. int web_view_instance_id; // If an array is passed, only rules with identifiers contained in this array // are unregistered. std::unique_ptr> rule_identifiers; private: Params(); DISALLOW_COPY_AND_ASSIGN(Params); }; namespace Results { std::unique_ptr Create(); } // namespace Results } // namespace RemoveRules } // namespace Event } // namespace events } // namespace api } // namespace extensions #endif // EXTENSIONS_COMMON_API_EVENTS_H__