diff options
author | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-22 09:21:08 +0000 |
---|---|---|
committer | joaodasilva@chromium.org <joaodasilva@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-22 09:21:08 +0000 |
commit | ac4d94bf4b58bde4004bef7c1ac721d56b044582 (patch) | |
tree | 8fa7ec7a4b9c4cb533969384d30ab4e32328e88e /components | |
parent | f7909bbd7c4b614d623a556b3ad748ba0480bc19 (diff) | |
download | chromium_src-ac4d94bf4b58bde4004bef7c1ac721d56b044582.zip chromium_src-ac4d94bf4b58bde4004bef7c1ac721d56b044582.tar.gz chromium_src-ac4d94bf4b58bde4004bef7c1ac721d56b044582.tar.bz2 |
Added BrowserPolicyConnector::GetDeviceManagementUrl().
This allows sharing the command line override on all platforms.
BUG=275292
Review URL: https://codereview.chromium.org/132823008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246251 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r-- | components/policy/core/browser/browser_policy_connector.cc | 15 | ||||
-rw-r--r-- | components/policy/core/browser/browser_policy_connector.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/components/policy/core/browser/browser_policy_connector.cc b/components/policy/core/browser/browser_policy_connector.cc index 81c5db1..6eab8a5 100644 --- a/components/policy/core/browser/browser_policy_connector.cc +++ b/components/policy/core/browser/browser_policy_connector.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <vector> +#include "base/command_line.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_proxy.h" @@ -20,6 +21,7 @@ #include "components/policy/core/common/policy_pref_names.h" #include "components/policy/core/common/policy_service_impl.h" #include "components/policy/core/common/policy_statistics_collector.h" +#include "components/policy/core/common/policy_switches.h" #include "google_apis/gaia/gaia_auth_util.h" #include "net/url_request/url_request_context_getter.h" #include "policy/policy_constants.h" @@ -29,6 +31,10 @@ namespace policy { namespace { +// The URL for the device management server. +const char kDefaultDeviceManagementServerUrl[] = + "https://m.google.com/devicemanagement/data/api"; + // Used in BrowserPolicyConnector::SetPolicyProviderForTesting. bool g_created_policy_service = false; ConfigurationPolicyProvider* g_testing_provider = NULL; @@ -202,6 +208,15 @@ bool BrowserPolicyConnector::IsNonEnterpriseUser(const std::string& username) { } // static +std::string BrowserPolicyConnector::GetDeviceManagementUrl() { + CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (command_line->HasSwitch(switches::kDeviceManagementUrl)) + return command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl); + else + return kDefaultDeviceManagementServerUrl; +} + +// static void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { registry->RegisterIntegerPref( policy_prefs::kUserPolicyRefreshRate, diff --git a/components/policy/core/browser/browser_policy_connector.h b/components/policy/core/browser/browser_policy_connector.h index 4ae70f6..38b9cea 100644 --- a/components/policy/core/browser/browser_policy_connector.h +++ b/components/policy/core/browser/browser_policy_connector.h @@ -93,6 +93,9 @@ class POLICY_EXPORT BrowserPolicyConnector { // false if the username is empty. static bool IsNonEnterpriseUser(const std::string& username); + // Returns the URL for the device management service endpoint. + static std::string GetDeviceManagementUrl(); + // Registers refresh rate prefs. static void RegisterPrefs(PrefRegistrySimple* registry); |