-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from brave/web-ui
Add Brave WebUI about:payments and brave-extension loading
- Loading branch information
Showing
38 changed files
with
828 additions
and
6 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
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,17 @@ | ||
/* 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/browser/brave_browser_main_extra_parts.h" | ||
|
||
#include "brave/common/resource_bundle_helper.h" | ||
|
||
BraveBrowserMainExtraParts::BraveBrowserMainExtraParts() { | ||
} | ||
|
||
BraveBrowserMainExtraParts::~BraveBrowserMainExtraParts() { | ||
} | ||
|
||
void BraveBrowserMainExtraParts::PreCreateThreads() { | ||
brave::InitializeResourceBundle(); | ||
} |
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,25 @@ | ||
/* 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_BROWSER_BRAVE_BROWSER_MAIN_EXTRA_PARTS_H_ | ||
#define BRAVE_BROWSER_BRAVE_BROWSER_MAIN_EXTRA_PARTS_H_ | ||
|
||
#include "base/compiler_specific.h" | ||
#include "base/macros.h" | ||
#include "chrome/browser/chrome_browser_main.h" | ||
#include "chrome/browser/chrome_browser_main_extra_parts.h" | ||
|
||
class BraveBrowserMainExtraParts : public ChromeBrowserMainExtraParts { | ||
public: | ||
explicit BraveBrowserMainExtraParts(); | ||
~BraveBrowserMainExtraParts() override; | ||
|
||
// ChromeBrowserMainExtraParts overrides. | ||
void PreCreateThreads() override; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(BraveBrowserMainExtraParts); | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_BRAVE_BROWSER_MAIN_EXTRA_PARTS_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
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,13 @@ | ||
import("//build/config/features.gni") | ||
|
||
source_set("extensions") { | ||
sources = [ | ||
"brave_component_extension_resource_manager.cc", | ||
"brave_component_extension_resource_manager.h", | ||
"brave_component_loader.cc", | ||
"brave_component_loader.h", | ||
] | ||
deps = [ | ||
"//chrome/browser" | ||
] | ||
} |
21 changes: 21 additions & 0 deletions
21
browser/extensions/brave_component_extension_resource_manager.cc
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,21 @@ | ||
/* 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/browser/extensions/brave_component_extension_resource_manager.h" | ||
|
||
#include "brave/grit/brave_extension_resources_map.h" | ||
|
||
namespace extensions { | ||
|
||
BraveComponentExtensionResourceManager:: | ||
BraveComponentExtensionResourceManager() { | ||
AddComponentResourceEntries( | ||
kBraveExtension, | ||
kBraveExtensionSize); | ||
} | ||
|
||
BraveComponentExtensionResourceManager:: | ||
~BraveComponentExtensionResourceManager() {} | ||
|
||
} // namespace extensions |
23 changes: 23 additions & 0 deletions
23
browser/extensions/brave_component_extension_resource_manager.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* 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_BROWSER_EXTENSIONS_BRAVE_COMPONENT_EXTENSION_RESOURCE_MANAGER_H_ | ||
#define BRAVE_BROWSER_EXTENSIONS_BRAVE_COMPONENT_EXTENSION_RESOURCE_MANAGER_H_ | ||
|
||
#include "chrome/browser/extensions/chrome_component_extension_resource_manager.h" | ||
|
||
namespace extensions { | ||
|
||
class BraveComponentExtensionResourceManager | ||
: public ChromeComponentExtensionResourceManager { | ||
public: | ||
BraveComponentExtensionResourceManager(); | ||
~BraveComponentExtensionResourceManager() override; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(BraveComponentExtensionResourceManager); | ||
}; | ||
|
||
} // namespace extensions | ||
|
||
#endif // BRAVE_BROWSER_EXTENSIONS_BRAVE_COMPONENT_EXTENSION_RESOURCE_MANAGER_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* 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/browser/extensions/brave_component_loader.h" | ||
|
||
#include "components/grit/brave_components_resources.h" | ||
|
||
namespace extensions { | ||
|
||
BraveComponentLoader::BraveComponentLoader( | ||
ExtensionServiceInterface* extension_service, | ||
PrefService* profile_prefs, | ||
PrefService* local_state, | ||
Profile* profile) | ||
: ComponentLoader(extension_service, profile_prefs, local_state, profile) { | ||
} | ||
|
||
BraveComponentLoader::~BraveComponentLoader() { | ||
} | ||
|
||
void BraveComponentLoader::AddDefaultComponentExtensions( | ||
bool skip_session_components) { | ||
ComponentLoader::AddDefaultComponentExtensions(skip_session_components); | ||
base::FilePath brave_extension_path(FILE_PATH_LITERAL("${root_gen_dir}")); | ||
brave_extension_path = | ||
brave_extension_path.Append(FILE_PATH_LITERAL("brave_extension")); | ||
Add(IDR_BRAVE_EXTENSON, brave_extension_path); | ||
} | ||
|
||
} // 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,32 @@ | ||
/* 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_BROWSER_EXTENSIONS_BRAVE_COMPONENT_LOADER_H_ | ||
#define BRAVE_BROWSER_EXTENSIONS_BRAVE_COMPONENT_LOADER_H_ | ||
|
||
#include "chrome/browser/extensions/component_loader.h" | ||
|
||
namespace extensions { | ||
|
||
// For registering, loading, and unloading component extensions. | ||
class BraveComponentLoader : public ComponentLoader { | ||
public: | ||
BraveComponentLoader(ExtensionServiceInterface* extension_service, | ||
PrefService* prefs, | ||
PrefService* local_state, | ||
Profile* browser_context); | ||
~BraveComponentLoader() override; | ||
|
||
// Adds the default component extensions. If |skip_session_components| | ||
// the loader will skip loading component extensions that weren't supposed to | ||
// be loaded unless we are in signed user session (ChromeOS). For all other | ||
// platforms this |skip_session_components| is expected to be unset. | ||
void AddDefaultComponentExtensions(bool skip_session_components) override; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(BraveComponentLoader); | ||
}; | ||
|
||
} // namespace extensions | ||
|
||
#endif // BRAVE_BROWSER_EXTENSIONS_BRAVE_COMPONENT_LOADER_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import("//chrome/common/features.gni") | ||
import("//tools/grit/grit_rule.gni") | ||
|
||
grit("brave_extension_grit") { | ||
source = "brave_extension.grd" | ||
|
||
grit_flags = [ | ||
"-E", | ||
"root_gen_dir=" + rebase_path(root_gen_dir, "."), | ||
] | ||
|
||
# output_name = "brave_components_resources_new" | ||
outputs = [ | ||
"grit/brave_extension.h", | ||
"grit/brave_extension_resources_map.cc", | ||
"grit/brave_extension_resources_map.h", | ||
"brave_extension.pak", | ||
] | ||
|
||
deps = [ | ||
"//brave/vendor/brave-extension", | ||
] | ||
|
||
output_dir = "$root_gen_dir/brave" | ||
# Empty string means use value from the grit element | ||
resource_ids = "" | ||
} | ||
|
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,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<grit base_dir="." latest_public_release="0" current_release="1" output_all_resource_defines="true"> | ||
<outputs> | ||
<output filename="grit/brave_extension.h" type="rc_header"> | ||
<emit emit_type='prepend'></emit> | ||
</output> | ||
<output filename="brave_extension.pak" type="data_package" /> | ||
<output filename="grit/brave_extension_resources_map.cc" type="resource_file_map_source" /> | ||
<output filename="grit/brave_extension_resources_map.h" type="resource_map_header" /> | ||
</outputs> | ||
<release seq="1"> | ||
<includes> | ||
<include name="IDR_BRAVE_EXTENSON_INJECT_HTML" file="${root_gen_dir}/brave_extension/inject.html" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_SHIELDS_BUNDLE_JS" file="${root_gen_dir}/brave_extension/js/braveShieldsPanel.bundle.js" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_BACKGROUND_BUNDLE_JS" file="${root_gen_dir}/brave_extension/js/background.bundle.js" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_ICON_16_PNG" file="${root_gen_dir}/brave_extension/img/icon-16.png" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_ICON_48_PNG" file="${root_gen_dir}/brave_extension/img/icon-48.png" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_ICON_128_PNG" file="${root_gen_dir}/brave_extension/img/icon-128.png" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_BACKGROUND_HTML" file="${root_gen_dir}/brave_extension/background.html" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_EN_US_MESSAGES_JSON" file="${root_gen_dir}/brave_extension/_locales/en_US/messages.json" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_BRAVE_SHIELDS_HTML" file="${root_gen_dir}/brave_extension/braveShieldsPanel.html" type="BINDATA" /> | ||
<include name="IDR_BRAVE_EXTENSON_BRAVELIZER_JS" file="${root_gen_dir}/brave_extension/bravelizer.css" type="BINDATA" /> | ||
</includes> | ||
</release> | ||
</grit> |
Oops, something went wrong.