-
Notifications
You must be signed in to change notification settings - Fork 862
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BraveRewards feature flag for android
- Loading branch information
Showing
7 changed files
with
107 additions
and
0 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
10 changes: 10 additions & 0 deletions
10
android/java/org/chromium/chrome/browser/BraveFeatureList.java
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 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* 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/. */ | ||
|
||
package org.chromium.chrome.browser; | ||
|
||
public abstract class BraveFeatureList { | ||
public static final String BRAVE_REWARDS = "BraveRewards"; | ||
} |
38 changes: 38 additions & 0 deletions
38
chromium_src/chrome/browser/android/chrome_feature_list.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,38 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* 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/brave_features.h" | ||
|
||
namespace chrome { | ||
namespace android { | ||
|
||
namespace { | ||
|
||
const base::Feature* kBraveFeaturesExposedToJava[] = { | ||
&features::kBraveRewards, | ||
}; | ||
|
||
const base::Feature* BraveFindFeatureExposedToJava( | ||
const std::string& feature_name) { | ||
for (size_t i = 0; i < base::size(kBraveFeaturesExposedToJava); ++i) { | ||
if (kBraveFeaturesExposedToJava[i]->name == feature_name) | ||
return kBraveFeaturesExposedToJava[i]; | ||
} | ||
|
||
return nullptr; | ||
} | ||
|
||
} // namespace | ||
|
||
} // namespace android | ||
} // namespace chrome | ||
|
||
#define BRAVE_FIND_FEATURE_EXPOSED_TO_JAVA \ | ||
const base::Feature* feature = BraveFindFeatureExposedToJava(feature_name); \ | ||
if (feature) \ | ||
return feature; | ||
|
||
#include "../../../../../chrome/browser/android/chrome_feature_list.cc" | ||
#undef BRAVE_FIND_FEATURE_EXPOSED_TO_JAVA |
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,22 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* 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/brave_features.h" | ||
#include "build/build_config.h" | ||
|
||
namespace features { | ||
|
||
#if defined(OS_ANDROID) | ||
// Flag for Brave Rewards. | ||
#if defined(ARCH_CPU_X86_FAMILY) && defined(OFFICIAL_BUILD) | ||
const base::Feature kBraveRewards{"BraveRewards", | ||
base::FEATURE_DISABLED_BY_DEFAULT}; | ||
#else | ||
const base::Feature kBraveRewards{"BraveRewards", | ||
base::FEATURE_ENABLED_BY_DEFAULT}; | ||
#endif | ||
#endif // defined(OS_ANDROID) | ||
|
||
} // namespace 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,22 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* 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_BRAVE_FEATURES_H_ | ||
#define BRAVE_COMMON_BRAVE_FEATURES_H_ | ||
|
||
#include "base/component_export.h" | ||
#include "base/feature_list.h" | ||
#include "build/build_config.h" | ||
|
||
namespace features { | ||
|
||
#if defined(OS_ANDROID) | ||
COMPONENT_EXPORT(CHROME_FEATURES) | ||
extern const base::Feature kBraveRewards; | ||
#endif // defined(OS_ANDROID) | ||
|
||
} // namespace features | ||
|
||
#endif // BRAVE_COMMON_BRAVE_FEATURES_H_ |
12 changes: 12 additions & 0 deletions
12
patches/chrome-browser-android-chrome_feature_list.cc.patch
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,12 @@ | ||
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc | ||
index 5a292bf4825f48e20513bcf6b313e080b0db5a9a..4e696dd969003256dae6ad2aa51e34b3f5f3d7f4 100644 | ||
--- a/chrome/browser/android/chrome_feature_list.cc | ||
+++ b/chrome/browser/android/chrome_feature_list.cc | ||
@@ -220,6 +220,7 @@ const base::Feature* kFeaturesExposedToJava[] = { | ||
}; | ||
|
||
const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) { | ||
+ BRAVE_FIND_FEATURE_EXPOSED_TO_JAVA | ||
for (size_t i = 0; i < base::size(kFeaturesExposedToJava); ++i) { | ||
if (kFeaturesExposedToJava[i]->name == feature_name) | ||
return kFeaturesExposedToJava[i]; |