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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 96 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
97 #include "chrome/browser/ui/webui/log_web_ui_url.h" 97 #include "chrome/browser/ui/webui/log_web_ui_url.h"
98 #include "chrome/browser/usb/usb_tab_helper.h" 98 #include "chrome/browser/usb/usb_tab_helper.h"
99 #include "chrome/common/channel_info.h" 99 #include "chrome/common/channel_info.h"
100 #include "chrome/common/chrome_constants.h" 100 #include "chrome/common/chrome_constants.h"
101 #include "chrome/common/chrome_paths.h" 101 #include "chrome/common/chrome_paths.h"
102 #include "chrome/common/chrome_switches.h" 102 #include "chrome/common/chrome_switches.h"
103 #include "chrome/common/env_vars.h" 103 #include "chrome/common/env_vars.h"
104 #include "chrome/common/features.h" 104 #include "chrome/common/features.h"
105 #include "chrome/common/logging_chrome.h" 105 #include "chrome/common/logging_chrome.h"
106 #include "chrome/common/origin_trials/chrome_origin_trial_policy.h"
106 #include "chrome/common/pepper_permission_util.h" 107 #include "chrome/common/pepper_permission_util.h"
107 #include "chrome/common/pref_names.h" 108 #include "chrome/common/pref_names.h"
108 #include "chrome/common/render_messages.h" 109 #include "chrome/common/render_messages.h"
109 #include "chrome/common/secure_origin_whitelist.h" 110 #include "chrome/common/secure_origin_whitelist.h"
110 #include "chrome/common/url_constants.h" 111 #include "chrome/common/url_constants.h"
111 #include "chrome/grit/browser_resources.h" 112 #include "chrome/grit/browser_resources.h"
112 #include "chrome/grit/generated_resources.h" 113 #include "chrome/grit/generated_resources.h"
113 #include "chrome/installer/util/google_update_settings.h" 114 #include "chrome/installer/util/google_update_settings.h"
114 #include "chromeos/chromeos_constants.h" 115 #include "chromeos/chromeos_constants.h"
115 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 116 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
(...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 // this point. 1467 // this point.
1467 LOG(WARNING) << "Received field trial params, " 1468 LOG(WARNING) << "Received field trial params, "
1468 "but blink-settings switch already specified."; 1469 "but blink-settings switch already specified.";
1469 return; 1470 return;
1470 } 1471 }
1471 1472
1472 command_line->AppendSwitchASCII(switches::kBlinkSettings, 1473 command_line->AppendSwitchASCII(switches::kBlinkSettings,
1473 base::JoinString(blink_settings, ",")); 1474 base::JoinString(blink_settings, ","));
1474 } 1475 }
1475 1476
1477 #if BUILDFLAG(ANDROID_JAVA_UI)
1478 void ForwardShareServiceRequest(
1479 base::WeakPtr<shell::InterfaceProvider> interface_provider,
1480 blink::mojom::ShareServiceRequest request) {
1481 if (!interface_provider ||
1482 ChromeOriginTrialPolicy().IsFeatureDisabled("WebShare")) {
1483 return;
1484 }
1485 interface_provider->GetInterface(std::move(request));
1486 }
1487 #endif
1488
1476 } // namespace 1489 } // namespace
1477 1490
1478 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( 1491 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
1479 base::CommandLine* command_line, 1492 base::CommandLine* command_line,
1480 int child_process_id) { 1493 int child_process_id) {
1481 #if defined(OS_MACOSX) 1494 #if defined(OS_MACOSX)
1482 std::unique_ptr<metrics::ClientInfo> client_info = 1495 std::unique_ptr<metrics::ClientInfo> client_info =
1483 GoogleUpdateSettings::LoadMetricsClientInfo(); 1496 GoogleUpdateSettings::LoadMetricsClientInfo();
1484 if (client_info) { 1497 if (client_info) {
1485 command_line->AppendSwitchASCII(switches::kMetricsClientID, 1498 command_line->AppendSwitchASCII(switches::kMetricsClientID,
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2988 render_frame_host)); 3001 render_frame_host));
2989 3002
2990 #if BUILDFLAG(ANDROID_JAVA_UI) 3003 #if BUILDFLAG(ANDROID_JAVA_UI)
2991 content::WebContents* web_contents = 3004 content::WebContents* web_contents =
2992 content::WebContents::FromRenderFrameHost(render_frame_host); 3005 content::WebContents::FromRenderFrameHost(render_frame_host);
2993 if (web_contents) { 3006 if (web_contents) {
2994 registry->AddInterface( 3007 registry->AddInterface(
2995 web_contents->GetJavaInterfaces() 3008 web_contents->GetJavaInterfaces()
2996 ->CreateInterfaceFactory<blink::mojom::PaymentRequest>()); 3009 ->CreateInterfaceFactory<blink::mojom::PaymentRequest>());
2997 registry->AddInterface( 3010 registry->AddInterface(
2998 web_contents->GetJavaInterfaces() 3011 base::Bind(&ForwardShareServiceRequest,
2999 ->CreateInterfaceFactory<blink::mojom::ShareService>()); 3012 web_contents->GetJavaInterfaces()->GetWeakPtr()));
3000 } 3013 }
3001 #endif 3014 #endif
3002 3015
3003 #if defined(ENABLE_MEDIA_ROUTER) 3016 #if defined(ENABLE_MEDIA_ROUTER)
3004 registry->AddInterface( 3017 registry->AddInterface(
3005 base::Bind(&CastRemotingConnector::CreateRemoterFactory, 3018 base::Bind(&CastRemotingConnector::CreateRemoterFactory,
3006 render_frame_host)); 3019 render_frame_host));
3007 #endif 3020 #endif
3008 } 3021 }
3009 3022
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
3266 if (channel <= kMaxDisableEncryptionChannel) { 3279 if (channel <= kMaxDisableEncryptionChannel) {
3267 static const char* const kWebRtcDevSwitchNames[] = { 3280 static const char* const kWebRtcDevSwitchNames[] = {
3268 switches::kDisableWebRtcEncryption, 3281 switches::kDisableWebRtcEncryption,
3269 }; 3282 };
3270 to_command_line->CopySwitchesFrom(from_command_line, 3283 to_command_line->CopySwitchesFrom(from_command_line,
3271 kWebRtcDevSwitchNames, 3284 kWebRtcDevSwitchNames,
3272 arraysize(kWebRtcDevSwitchNames)); 3285 arraysize(kWebRtcDevSwitchNames));
3273 } 3286 }
3274 } 3287 }
3275 #endif // defined(ENABLE_WEBRTC) 3288 #endif // defined(ENABLE_WEBRTC)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698