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

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

Issue 830193002: Using PolicyServiceWatcher instead of PolicyWatcherLinux/Win/Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing... Created 5 years, 11 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
« no previous file with comments | « no previous file | chrome/common/chrome_paths.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 30 matching lines...) Expand all
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_paths.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698