OLD | NEW |
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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 #endif | 41 #endif |
42 | 42 |
43 using content::BrowserThread; | 43 using content::BrowserThread; |
44 | 44 |
45 namespace policy { | 45 namespace policy { |
46 | 46 |
47 namespace { | 47 namespace { |
48 | 48 |
49 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
50 base::FilePath GetManagedPolicyPath() { | 50 base::FilePath GetManagedPolicyPath() { |
51 // This constructs the path to the plist file in which Mac OS X stores the | |
52 // managed preference for the application. This is undocumented and therefore | |
53 // fragile, but if it doesn't work out, AsyncPolicyLoader has a task that | |
54 // polls periodically in order to reload managed preferences later even if we | |
55 // missed the change. | |
56 base::FilePath path; | |
57 if (!PathService::Get(chrome::DIR_MANAGED_PREFS, &path)) | |
58 return base::FilePath(); | |
59 | |
60 CFBundleRef bundle(CFBundleGetMainBundle()); | 51 CFBundleRef bundle(CFBundleGetMainBundle()); |
61 if (!bundle) | 52 if (!bundle) |
62 return base::FilePath(); | 53 return base::FilePath(); |
63 | 54 |
64 CFStringRef bundle_id = CFBundleGetIdentifier(bundle); | 55 CFStringRef bundle_id = CFBundleGetIdentifier(bundle); |
65 if (!bundle_id) | 56 if (!bundle_id) |
66 return base::FilePath(); | 57 return base::FilePath(); |
67 | 58 |
68 return path.Append(base::SysCFStringRefToUTF8(bundle_id) + ".plist"); | 59 return policy::PolicyLoaderMac::GetManagedPolicyPath(bundle_id); |
69 } | 60 } |
70 #endif // defined(OS_MACOSX) | 61 #endif // defined(OS_MACOSX) |
71 | 62 |
72 } // namespace | 63 } // namespace |
73 | 64 |
74 ChromeBrowserPolicyConnector::ChromeBrowserPolicyConnector() | 65 ChromeBrowserPolicyConnector::ChromeBrowserPolicyConnector() |
75 : BrowserPolicyConnector(base::Bind(&BuildHandlerList)) { | 66 : BrowserPolicyConnector(base::Bind(&BuildHandlerList)) { |
76 ConfigurationPolicyProvider* platform_provider = CreatePlatformProvider(); | 67 ConfigurationPolicyProvider* platform_provider = CreatePlatformProvider(); |
77 if (platform_provider) | 68 if (platform_provider) |
78 SetPlatformPolicyProvider(make_scoped_ptr(platform_provider)); | 69 SetPlatformPolicyProvider(make_scoped_ptr(platform_provider)); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 chrome_policy.GetValue(key::kEnableWebBasedSignin); | 131 chrome_policy.GetValue(key::kEnableWebBasedSignin); |
141 bool enabled = false; | 132 bool enabled = false; |
142 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 133 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
143 if (policy_value && policy_value->GetAsBoolean(&enabled) && enabled && | 134 if (policy_value && policy_value->GetAsBoolean(&enabled) && enabled && |
144 !command_line->HasSwitch(switches::kEnableWebBasedSignin)) { | 135 !command_line->HasSwitch(switches::kEnableWebBasedSignin)) { |
145 command_line->AppendSwitch(switches::kEnableWebBasedSignin); | 136 command_line->AppendSwitch(switches::kEnableWebBasedSignin); |
146 } | 137 } |
147 } | 138 } |
148 | 139 |
149 } // namespace policy | 140 } // namespace policy |
OLD | NEW |