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

Side by Side Diff: chrome/browser/policy/chrome_browser_policy_connector.cc

Issue 872433006: Disconnect one click sign in code. The code itself will be removed in followup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge Created 5 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/policy/chrome_browser_policy_connector.h" 5 #include "chrome/browser/policy/chrome_browser_policy_connector.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 #include "chrome/browser/policy/configuration_policy_handler_list_factory.h" 16 #include "chrome/browser/policy/configuration_policy_handler_list_factory.h"
17 #include "chrome/browser/policy/device_management_service_configuration.h" 17 #include "chrome/browser/policy/device_management_service_configuration.h"
18 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
19 #include "components/policy/core/common/async_policy_provider.h" 19 #include "components/policy/core/common/async_policy_provider.h"
20 #include "components/policy/core/common/cloud/device_management_service.h" 20 #include "components/policy/core/common/cloud/device_management_service.h"
21 #include "components/policy/core/common/configuration_policy_provider.h" 21 #include "components/policy/core/common/configuration_policy_provider.h"
22 #include "components/policy/core/common/policy_map.h" 22 #include "components/policy/core/common/policy_map.h"
23 #include "components/policy/core/common/policy_namespace.h" 23 #include "components/policy/core/common/policy_namespace.h"
24 #include "components/policy/core/common/policy_service.h" 24 #include "components/policy/core/common/policy_service.h"
25 #include "components/policy/core/common/policy_types.h" 25 #include "components/policy/core/common/policy_types.h"
26 #include "components/signin/core/common/signin_switches.h"
27 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
28 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
29 #include "net/url_request/url_request_context_getter.h" 28 #include "net/url_request/url_request_context_getter.h"
30 #include "policy/policy_constants.h" 29 #include "policy/policy_constants.h"
31 30
32 #if defined(OS_WIN) 31 #if defined(OS_WIN)
33 #include "components/policy/core/common/policy_loader_win.h" 32 #include "components/policy/core/common/policy_loader_win.h"
34 #elif defined(OS_MACOSX) 33 #elif defined(OS_MACOSX)
35 #include <CoreFoundation/CoreFoundation.h> 34 #include <CoreFoundation/CoreFoundation.h>
36 #include "components/policy/core/common/policy_loader_mac.h" 35 #include "components/policy/core/common/policy_loader_mac.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 scoped_ptr<DeviceManagementService::Configuration> configuration( 81 scoped_ptr<DeviceManagementService::Configuration> configuration(
83 new DeviceManagementServiceConfiguration( 82 new DeviceManagementServiceConfiguration(
84 BrowserPolicyConnector::GetDeviceManagementUrl())); 83 BrowserPolicyConnector::GetDeviceManagementUrl()));
85 scoped_ptr<DeviceManagementService> device_management_service( 84 scoped_ptr<DeviceManagementService> device_management_service(
86 new DeviceManagementService(configuration.Pass())); 85 new DeviceManagementService(configuration.Pass()));
87 device_management_service->ScheduleInitialization( 86 device_management_service->ScheduleInitialization(
88 kServiceInitializationStartupDelay); 87 kServiceInitializationStartupDelay);
89 88
90 BrowserPolicyConnector::Init( 89 BrowserPolicyConnector::Init(
91 local_state, request_context, device_management_service.Pass()); 90 local_state, request_context, device_management_service.Pass());
92
93 AppendExtraFlagsPerPolicy();
94 } 91 }
95 92
96 ConfigurationPolicyProvider* 93 ConfigurationPolicyProvider*
97 ChromeBrowserPolicyConnector::CreatePlatformProvider() { 94 ChromeBrowserPolicyConnector::CreatePlatformProvider() {
98 #if defined(OS_WIN) 95 #if defined(OS_WIN)
99 scoped_ptr<AsyncPolicyLoader> loader(PolicyLoaderWin::Create( 96 scoped_ptr<AsyncPolicyLoader> loader(PolicyLoaderWin::Create(
100 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 97 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
101 kRegistryChromePolicyKey)); 98 kRegistryChromePolicyKey));
102 return new AsyncPolicyProvider(GetSchemaRegistry(), loader.Pass()); 99 return new AsyncPolicyProvider(GetSchemaRegistry(), loader.Pass());
103 #elif defined(OS_MACOSX) 100 #elif defined(OS_MACOSX)
(...skipping 17 matching lines...) Expand all
121 return new PolicyProviderAndroid(); 118 return new PolicyProviderAndroid();
122 #else 119 #else
123 return NULL; 120 return NULL;
124 #endif 121 #endif
125 } 122 }
126 123
127 void ChromeBrowserPolicyConnector::AppendExtraFlagsPerPolicy() { 124 void ChromeBrowserPolicyConnector::AppendExtraFlagsPerPolicy() {
128 PolicyService* policy_service = GetPolicyService(); 125 PolicyService* policy_service = GetPolicyService();
129 PolicyNamespace chrome_ns = PolicyNamespace(POLICY_DOMAIN_CHROME, ""); 126 PolicyNamespace chrome_ns = PolicyNamespace(POLICY_DOMAIN_CHROME, "");
130 const PolicyMap& chrome_policy = policy_service->GetPolicies(chrome_ns); 127 const PolicyMap& chrome_policy = policy_service->GetPolicies(chrome_ns);
131 const base::Value* policy_value =
132 chrome_policy.GetValue(key::kEnableDeprecatedWebBasedSignin);
133 bool enabled = false;
134 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 128 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
135 if (policy_value && policy_value->GetAsBoolean(&enabled) && enabled) {
136 if (!command_line->HasSwitch(switches::kEnableWebBasedSignin))
137 command_line->AppendSwitch(switches::kEnableWebBasedSignin);
138 // In M41, to fully enable web-based sign in, the kEnableIframeBasedSignin
139 // must also be specified.
140 if (!command_line->HasSwitch(switches::kEnableIframeBasedSignin))
141 command_line->AppendSwitch(switches::kEnableIframeBasedSignin);
142 }
143 129
144 if (command_line->HasSwitch(switches::kEnableNpapi)) 130 if (command_line->HasSwitch(switches::kEnableNpapi))
145 return; 131 return;
146 132
147 // The list of Plugin related policies that re-enable NPAPI. Remove once NPAPI 133 // The list of Plugin related policies that re-enable NPAPI. Remove once NPAPI
148 // is dead. 134 // is dead.
149 const std::string plugin_policies[] = { key::kEnabledPlugins, 135 const std::string plugin_policies[] = { key::kEnabledPlugins,
150 key::kPluginsAllowedForUrls, 136 key::kPluginsAllowedForUrls,
151 key::kPluginsBlockedForUrls, 137 key::kPluginsBlockedForUrls,
152 key::kDisabledPluginsExceptions, 138 key::kDisabledPluginsExceptions,
153 key::kDisabledPlugins }; 139 key::kDisabledPlugins };
154 for (auto policy : plugin_policies) { 140 for (auto policy : plugin_policies) {
155 if (chrome_policy.GetValue(policy)) { 141 if (chrome_policy.GetValue(policy)) {
156 command_line->AppendSwitch(switches::kEnableNpapi); 142 command_line->AppendSwitch(switches::kEnableNpapi);
157 break; 143 break;
158 } 144 }
159 } 145 }
160 } 146 }
161 147
162 } // namespace policy 148 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/chrome_browser_policy_connector.h ('k') | chrome/browser/signin/chrome_signin_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698