Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3285)

Unified Diff: extensions/renderer/api_type_reference_map.h

Issue 2947463002: [Extensions Bindings] Add a bindings/ subdirectory under renderer (Closed)
Patch Set: . Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/api_signature_unittest.cc ('k') | extensions/renderer/api_type_reference_map.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_type_reference_map.h
diff --git a/extensions/renderer/api_type_reference_map.h b/extensions/renderer/api_type_reference_map.h
deleted file mode 100644
index 45a975a30c76c3ec16ff2e5e341218de69a59217..0000000000000000000000000000000000000000
--- a/extensions/renderer/api_type_reference_map.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2017 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.
-
-#ifndef EXTENSIONS_RENDERER_API_TYPE_REFERENCE_MAP_H_
-#define EXTENSIONS_RENDERER_API_TYPE_REFERENCE_MAP_H_
-
-#include <map>
-#include <memory>
-#include <string>
-
-#include "base/callback.h"
-#include "base/macros.h"
-
-namespace extensions {
-class APISignature;
-class ArgumentSpec;
-
-// A map storing type specifications and method signatures for API definitions.
-class APITypeReferenceMap {
- public:
- // A callback used to initialize an unknown type, so that these can be
- // created lazily.
- using InitializeTypeCallback = base::Callback<void(const std::string& name)>;
-
- explicit APITypeReferenceMap(const InitializeTypeCallback& initialize_type);
- ~APITypeReferenceMap();
-
- // Adds the |spec| to the map under the given |name|.
- void AddSpec(const std::string& name, std::unique_ptr<ArgumentSpec> spec);
-
- // Returns the spec for the given |name|.
- const ArgumentSpec* GetSpec(const std::string& name) const;
-
- // Adds the |signature| to the map under the given |name|. |name| is expected
- // to be fully qualified with the API and method name, e.g. tabs.create.
- void AddAPIMethodSignature(const std::string& name,
- std::unique_ptr<APISignature> signature);
-
- // Returns the signature for the given |name|. |name| is expected
- // to be fully qualified with the API and method name, e.g. tabs.create.
- const APISignature* GetAPIMethodSignature(const std::string& name) const;
-
- // Adds the |signature| to the map under the given |name|. |name| is expected
- // to be fully qualified with API, type, and method (e.g.
- // storage.StorageArea.get).
- void AddTypeMethodSignature(const std::string& name,
- std::unique_ptr<APISignature> signature);
-
- // Returns the signature for the given |name|. |name| is expected
- // to be fully qualified with API, type, and method (e.g.
- // storage.StorageArea.get).
- const APISignature* GetTypeMethodSignature(const std::string& name) const;
-
- // Returns true if the map has a signature for the given |name|. Unlike
- // GetTypeMethodSignature(), this will not try to fetch the type by loading
- // an API.
- bool HasTypeMethodSignature(const std::string& name) const;
-
- bool empty() const { return type_refs_.empty(); }
- size_t size() const { return type_refs_.size(); }
-
- private:
- InitializeTypeCallback initialize_type_;
-
- std::map<std::string, std::unique_ptr<ArgumentSpec>> type_refs_;
- std::map<std::string, std::unique_ptr<APISignature>> api_methods_;
- std::map<std::string, std::unique_ptr<APISignature>> type_methods_;
-
- DISALLOW_COPY_AND_ASSIGN(APITypeReferenceMap);
-};
-
-} // namespace extensions
-
-#endif // EXTENSIONS_RENDERER_API_TYPE_REFERENCE_MAP_H_
« no previous file with comments | « extensions/renderer/api_signature_unittest.cc ('k') | extensions/renderer/api_type_reference_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698