Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2314573002: Don't expose webshare from the browser when the origin trial disables it. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 2c0ceec8b62143d0c429ebba845af7e5a557edf2..ab51285e3d00d172c71dc852b7086a25bd58fbc8 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -103,6 +103,7 @@
#include "chrome/common/env_vars.h"
#include "chrome/common/features.h"
#include "chrome/common/logging_chrome.h"
+#include "chrome/common/origin_trials/chrome_origin_trial_policy.h"
#include "chrome/common/pepper_permission_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
@@ -1473,6 +1474,18 @@ void MaybeAppendBlinkSettingsSwitchForFieldTrial(
base::JoinString(blink_settings, ","));
}
+#if BUILDFLAG(ANDROID_JAVA_UI)
+void ForwardShareServiceRequest(
+ base::WeakPtr<shell::InterfaceProvider> interface_provider,
+ blink::mojom::ShareServiceRequest request) {
+ if (!interface_provider ||
+ ChromeOriginTrialPolicy().IsFeatureDisabled("WebShare")) {
+ return;
+ }
+ interface_provider->GetInterface(std::move(request));
+}
+#endif
+
} // namespace
void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
@@ -2995,8 +3008,8 @@ void ChromeContentBrowserClient::RegisterRenderFrameMojoInterfaces(
web_contents->GetJavaInterfaces()
->CreateInterfaceFactory<blink::mojom::PaymentRequest>());
registry->AddInterface(
- web_contents->GetJavaInterfaces()
- ->CreateInterfaceFactory<blink::mojom::ShareService>());
+ base::Bind(&ForwardShareServiceRequest,
+ web_contents->GetJavaInterfaces()->GetWeakPtr()));
}
#endif

Powered by Google App Engine
This is Rietveld 408576698