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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2263213003: Don't expose ShareService to renderers if WebShare is globally disabled. (Closed) Base URL: ssh://sammc-z840.syd/usr/local/google/home/sammc/chrome/src@java-interface-registry-migration
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f4a9eecfade660903678eec8a948698e96383fce..fd933e8ab9ae71d193b152f39dc72df9991bf639 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -101,6 +101,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"
@@ -1409,6 +1410,19 @@ 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(
@@ -2842,8 +2856,8 @@ void ChromeContentBrowserClient::RegisterRenderFrameMojoInterfaces(
web_contents->GetJavaInterfaces()
->GetInterfaceFactory<blink::mojom::PaymentRequest>());
registry->AddInterface(
- web_contents->GetJavaInterfaces()
- ->GetInterfaceFactory<blink::mojom::ShareService>());
+ base::Bind(&ForwardShareServiceRequest,
+ web_contents->GetJavaInterfaces()->GetWeakPtr()));
}
#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698