-
Notifications
You must be signed in to change notification settings - Fork 869
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extension API for checking WDP native feature, use single pref fo…
…r Web Discovery native + extension
- Loading branch information
Showing
31 changed files
with
166 additions
and
171 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,27 @@ | ||
/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/browser/extensions/api/web_discovery_api.h" | ||
|
||
#include "brave/components/web_discovery/buildflags/buildflags.h" | ||
|
||
#if BUILDFLAG(ENABLE_WEB_DISCOVERY_NATIVE) | ||
#include "base/feature_list.h" | ||
#include "brave/components/web_discovery/common/features.h" | ||
#endif | ||
|
||
namespace extensions::api { | ||
|
||
ExtensionFunction::ResponseAction | ||
WebDiscoveryIsWebDiscoveryNativeEnabledFunction::Run() { | ||
bool result = false; | ||
#if BUILDFLAG(ENABLE_WEB_DISCOVERY_NATIVE) | ||
result = base::FeatureList::IsEnabled( | ||
web_discovery::features::kBraveWebDiscoveryNative); | ||
#endif | ||
return RespondNow(WithArguments(result)); | ||
} | ||
|
||
} // namespace extensions::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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Copyright (c) 2024 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 https://mozilla.org/MPL/2.0/. */ | ||
|
||
#ifndef BRAVE_BROWSER_EXTENSIONS_API_WEB_DISCOVERY_API_H_ | ||
#define BRAVE_BROWSER_EXTENSIONS_API_WEB_DISCOVERY_API_H_ | ||
|
||
#include "extensions/browser/extension_function.h" | ||
|
||
namespace extensions { | ||
namespace api { | ||
|
||
class WebDiscoveryIsWebDiscoveryNativeEnabledFunction | ||
: public ExtensionFunction { | ||
public: | ||
DECLARE_EXTENSION_FUNCTION("webDiscovery.isWebDiscoveryNativeEnabled", | ||
UNKNOWN) | ||
|
||
protected: | ||
~WebDiscoveryIsWebDiscoveryNativeEnabledFunction() override {} | ||
|
||
ResponseAction Run() override; | ||
}; | ||
|
||
} // namespace api | ||
} // namespace extensions | ||
|
||
#endif // BRAVE_BROWSER_EXTENSIONS_API_WEB_DISCOVERY_API_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
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
Oops, something went wrong.