Skip to content

Commit

Permalink
Allow progressive web apps (PWAs)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbondy committed Jun 6, 2018
1 parent a4c4ee9 commit 3c046d3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 8 additions & 1 deletion app/brave_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "brave/app/brave_main_delegate.h"

#include <sstream>

#include "base/base_switches.h"
#include "base/lazy_instance.h"
#include "base/path_service.h"
Expand All @@ -13,6 +15,7 @@
#include "brave/common/resource_bundle_helper.h"
#include "brave/renderer/brave_content_renderer_client.h"
#include "brave/utility/brave_content_utility_client.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
Expand Down Expand Up @@ -101,7 +104,11 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) {
base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
command_line.AppendSwitch(switches::kEnableTabAudioMuting);

std::stringstream enabled_features;
enabled_features << features::kEnableEmojiContextMenu.name
<< "," << features::kDesktopPWAWindowing.name;
command_line.AppendSwitchASCII(switches::kEnableFeatures,
features::kEnableEmojiContextMenu.name);
enabled_features.str());
return ChromeMainDelegate::BasicStartupComplete(exit_code);
}
11 changes: 8 additions & 3 deletions extensions/browser/brave_extension_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

namespace {

bool IsWhitelisted(const std::string& id) {
bool IsWhitelisted(const extensions::Extension* extension) {
// Allow PWAs to run
if (extension->GetType() == extensions::Manifest::TYPE_HOSTED_APP) {
return true;
}
static std::vector<std::string> whitelist({
brave_extension_id,
pdfjs_extension_id,
Expand Down Expand Up @@ -70,7 +74,8 @@ bool IsWhitelisted(const std::string& id) {
// Test ID: Brave HTTPS Everywhere Updater
"bhlmpjhncoojbkemjkeppfahkglffilp"
});
return std::find(whitelist.begin(), whitelist.end(), id) != whitelist.end();
return std::find(whitelist.begin(), whitelist.end(),
extension->id()) != whitelist.end();
}

} // namespace
Expand All @@ -94,7 +99,7 @@ std::string BraveExtensionProvider::GetDebugPolicyProviderName() const {

bool BraveExtensionProvider::UserMayLoad(const Extension* extension,
base::string16* error) const {
if (!IsWhitelisted(extension->id())) {
if (!IsWhitelisted(extension)) {
if (error) {
*error =
l10n_util::GetStringFUTF16(IDS_EXTENSION_CANT_INSTALL_ON_BRAVE,
Expand Down

0 comments on commit 3c046d3

Please sign in to comment.