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

Unified Diff: extensions/renderer/api_type_reference_map.cc

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_type_reference_map.h ('k') | extensions/renderer/argument_spec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_type_reference_map.cc
diff --git a/extensions/renderer/api_type_reference_map.cc b/extensions/renderer/api_type_reference_map.cc
deleted file mode 100644
index 33898c097eae46b577418155878fb1619e73caf3..0000000000000000000000000000000000000000
--- a/extensions/renderer/api_type_reference_map.cc
+++ /dev/null
@@ -1,79 +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.
-
-#include "extensions/renderer/api_type_reference_map.h"
-
-#include "extensions/renderer/api_signature.h"
-#include "extensions/renderer/argument_spec.h"
-
-namespace extensions {
-
-APITypeReferenceMap::APITypeReferenceMap(
- const InitializeTypeCallback& initialize_type)
- : initialize_type_(initialize_type) {}
-APITypeReferenceMap::~APITypeReferenceMap() = default;
-
-void APITypeReferenceMap::AddSpec(const std::string& name,
- std::unique_ptr<ArgumentSpec> spec) {
- DCHECK(type_refs_.find(name) == type_refs_.end());
- type_refs_[name] = std::move(spec);
-}
-
-const ArgumentSpec* APITypeReferenceMap::GetSpec(
- const std::string& name) const {
- auto iter = type_refs_.find(name);
- if (iter == type_refs_.end()) {
- initialize_type_.Run(name);
- iter = type_refs_.find(name);
- }
- return iter == type_refs_.end() ? nullptr : iter->second.get();
-}
-
-void APITypeReferenceMap::AddAPIMethodSignature(
- const std::string& name,
- std::unique_ptr<APISignature> signature) {
- DCHECK(api_methods_.find(name) == api_methods_.end())
- << "Cannot re-register signature for: " << name;
- api_methods_[name] = std::move(signature);
-}
-
-const APISignature* APITypeReferenceMap::GetAPIMethodSignature(
- const std::string& name) const {
- auto iter = api_methods_.find(name);
- if (iter == api_methods_.end()) {
- initialize_type_.Run(name);
- iter = api_methods_.find(name);
- }
- return iter == api_methods_.end() ? nullptr : iter->second.get();
-}
-
-void APITypeReferenceMap::AddTypeMethodSignature(
- const std::string& name,
- std::unique_ptr<APISignature> signature) {
- DCHECK(type_methods_.find(name) == type_methods_.end())
- << "Cannot re-register signature for: " << name;
- type_methods_[name] = std::move(signature);
-}
-
-const APISignature* APITypeReferenceMap::GetTypeMethodSignature(
- const std::string& name) const {
- auto iter = type_methods_.find(name);
- if (iter == type_methods_.end()) {
- // Find the type name by stripping away the method suffix.
- std::string::size_type dot = name.rfind('.');
- DCHECK_NE(std::string::npos, dot);
- DCHECK_LT(dot, name.size() - 1);
- std::string type_name = name.substr(0, dot);
- initialize_type_.Run(type_name);
- iter = type_methods_.find(name);
- }
- return iter == type_methods_.end() ? nullptr : iter->second.get();
-}
-
-bool APITypeReferenceMap::HasTypeMethodSignature(
- const std::string& name) const {
- return type_methods_.find(name) != type_methods_.end();
-}
-
-} // namespace extensions
« no previous file with comments | « extensions/renderer/api_type_reference_map.h ('k') | extensions/renderer/argument_spec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698