summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/automation_provider_observers_chromeos.cc
diff options
context:
space:
mode:
authorcraigdh@google.com <craigdh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-15 18:20:38 +0000
committercraigdh@google.com <craigdh@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-15 18:20:38 +0000
commitd8ce941cb60f0d70308ab013c0db4f9c54016b82 (patch)
tree6636fd77c482d6d2b37e179072743ea92a501544 /chrome/browser/automation/automation_provider_observers_chromeos.cc
parent9f2d19c8e0acc55e45b72cc0ef1ac07abb0d98b3 (diff)
downloadchromium_src-d8ce941cb60f0d70308ab013c0db4f9c54016b82.zip
chromium_src-d8ce941cb60f0d70308ab013c0db4f9c54016b82.tar.gz
chromium_src-d8ce941cb60f0d70308ab013c0db4f9c54016b82.tar.bz2
Added two initial Enterprise policy automation hooks for use with PyAuto.
IsEnterpriseDevice() returns whether the device is registered as an enterprise device. FetchEnterprisePolicy() initiates a policy update and blocks until the fetch completes or fails. BUG=chromium-os:16060 TEST=Manually verified the example PyAuto test script Review URL: http://codereview.chromium.org/7355006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92715 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_provider_observers_chromeos.cc')
-rw-r--r--chrome/browser/automation/automation_provider_observers_chromeos.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider_observers_chromeos.cc b/chrome/browser/automation/automation_provider_observers_chromeos.cc
index 3985f15..35b7748 100644
--- a/chrome/browser/automation/automation_provider_observers_chromeos.cc
+++ b/chrome/browser/automation/automation_provider_observers_chromeos.cc
@@ -270,6 +270,41 @@ chromeos::VirtualNetwork* VirtualConnectObserver::GetVirtualNetwork(
return virt;
}
+CloudPolicyObserver::CloudPolicyObserver(AutomationProvider* automation,
+ IPC::Message* reply_message,
+ policy::BrowserPolicyConnector* browser_policy_connector,
+ policy::CloudPolicySubsystem* policy_subsystem)
+ : automation_(automation->AsWeakPtr()),
+ reply_message_(reply_message) {
+ observer_registrar_.reset(
+ new policy::CloudPolicySubsystem::ObserverRegistrar(policy_subsystem,
+ this));
+}
+
+CloudPolicyObserver::~CloudPolicyObserver() {
+}
+
+void CloudPolicyObserver::OnPolicyStateChanged(
+ policy::CloudPolicySubsystem::PolicySubsystemState state,
+ policy::CloudPolicySubsystem::ErrorDetails error_details) {
+ if (state == policy::CloudPolicySubsystem::SUCCESS) {
+ if (automation_)
+ AutomationJSONReply(automation_,
+ reply_message_.release()).SendSuccess(NULL);
+ delete this;
+ } else if (state == policy::CloudPolicySubsystem::TOKEN_FETCHED) {
+ // fetched the token, now return and wait for a call with state SUCCESS
+ return;
+ } else {
+ // fetch returned an error
+ if (automation_)
+ AutomationJSONReply(automation_,
+ reply_message_.release()).SendError(NULL);
+ delete this;
+ return;
+ }
+}
+
SSIDConnectObserver::SSIDConnectObserver(
AutomationProvider* automation, IPC::Message* reply_message,
const std::string& ssid)