-
Notifications
You must be signed in to change notification settings - Fork 820
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update background process store extension
- Loading branch information
Showing
8 changed files
with
125 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
source_set("extensions") { | ||
sources = [ | ||
"brave_extensions_client.cc", | ||
"brave_extensions_client.h", | ||
] | ||
deps = [ | ||
"api" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
import("//extensions/common/api/schema.gni") | ||
import("//tools/json_schema_compiler/json_features.gni") | ||
import("//tools/json_schema_compiler/json_schema_api.gni") | ||
|
||
json_schema_api("api") { | ||
root_namespace = extensions_api_root_namespace | ||
schemas = true | ||
bundle = true | ||
bundle_name = "" | ||
json_features("api_features") { | ||
feature_type = "APIFeature" | ||
provider_class = "BraveAPIFeatureProvider" | ||
sources = [ | ||
"_api_features.json", | ||
] | ||
} | ||
|
||
json_schema_api("generated_api") { | ||
sources = [ | ||
"brave_shields.json" | ||
] | ||
root_namespace = "extensions::api::%(namespace)s" | ||
schemas = true | ||
schema_include_rules = "extensions/common/api:extensions::api::%(namespace)s" | ||
bundle = true | ||
bundle_name = "Brave" | ||
} | ||
|
||
group("api") { | ||
deps = [ | ||
":generated_api", | ||
":api_features", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
{ | ||
"braveShields": { | ||
"dependencies": ["permission:contentSettings"], | ||
"contexts": ["blessed_extension"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/common/extensions/brave_extensions_client.h" | ||
|
||
#include <memory> | ||
#include <set> | ||
#include <string> | ||
|
||
#include "brave/common/extensions/api/generated_schemas.h" | ||
#include "base/strings/string_util.h" | ||
|
||
namespace extensions { | ||
|
||
static base::LazyInstance<BraveExtensionsClient>::Leaky g_client = | ||
LAZY_INSTANCE_INITIALIZER; | ||
|
||
bool BraveExtensionsClient::IsAPISchemaGenerated( | ||
const std::string& name) const { | ||
return ChromeExtensionsClient::IsAPISchemaGenerated(name) || | ||
api::BraveGeneratedSchemas::IsGenerated(name); | ||
} | ||
|
||
base::StringPiece BraveExtensionsClient::GetAPISchema( | ||
const std::string& name) const { | ||
if (api::BraveGeneratedSchemas::IsGenerated(name)) | ||
return api::BraveGeneratedSchemas::Get(name); | ||
|
||
return ChromeExtensionsClient::GetAPISchema(name); | ||
} | ||
|
||
// static | ||
ChromeExtensionsClient* BraveExtensionsClient::GetInstance() { | ||
return g_client.Pointer(); | ||
} | ||
|
||
} // namespace extensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_COMMON_EXTENSIONS_BRAVE_EXTENSIONS_CLIENT_H_ | ||
#define BRAVE_COMMON_EXTENSIONS_BRAVE_EXTENSIONS_CLIENT_H_ | ||
|
||
#include "base/compiler_specific.h" | ||
#include "base/macros.h" | ||
#include "chrome/common/extensions/chrome_extensions_client.h" | ||
|
||
namespace extensions { | ||
|
||
// The implementation of ExtensionsClient for Brave, which encapsulates the | ||
// global knowledge of features, permissions, and manifest fields. | ||
class BraveExtensionsClient : public ChromeExtensionsClient { | ||
public: | ||
bool IsAPISchemaGenerated(const std::string& name) const override; | ||
base::StringPiece GetAPISchema(const std::string& name) const override; | ||
|
||
// Get the LazyInstance for ChromeExtensionsClient. | ||
static ChromeExtensionsClient* GetInstance(); | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(BraveExtensionsClient); | ||
}; | ||
|
||
} // namespace extensions | ||
|
||
#endif // BRAVE_COMMON_EXTENSIONS_BRAVE_EXTENSIONS_CLIENT_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters