summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 04:14:57 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 04:14:57 +0000
commit566a0f768fae66db79d3f5386e1fdc65e4dd6825 (patch)
treeec95e77dd30668681371b7e010a197fa5e2c127c /chrome/browser/automation
parent087256b5dedb480c7d2358d590f164b523726e1f (diff)
downloadchromium_src-566a0f768fae66db79d3f5386e1fdc65e4dd6825.zip
chromium_src-566a0f768fae66db79d3f5386e1fdc65e4dd6825.tar.gz
chromium_src-566a0f768fae66db79d3f5386e1fdc65e4dd6825.tar.bz2
Lands http://codereview.chromium.org/668105 for sosa:
Changes to add basic automation proxy support to chromeos login wizard TEST=none BUG=none Review URL: http://codereview.chromium.org/783003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41129 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation')
-rw-r--r--chrome/browser/automation/automation_provider.cc4
-rw-r--r--chrome/browser/automation/automation_provider.h8
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc27
-rw-r--r--chrome/browser/automation/automation_provider_observers.h21
4 files changed, 60 insertions, 0 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 6a29cba..47db0d6 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -472,6 +472,10 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(AutomationMsg_BrowserMove, OnBrowserMoved)
#endif
IPC_MESSAGE_HANDLER(AutomationMsg_SetContentSetting, SetContentSetting)
+#if defined(OS_CHROMEOS)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_LoginWithUserAndPass,
+ LoginWithUserAndPass)
+#endif
IPC_END_MESSAGE_MAP()
}
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h
index 66b82f7..6d08f38 100644
--- a/chrome/browser/automation/automation_provider.h
+++ b/chrome/browser/automation/automation_provider.h
@@ -520,6 +520,14 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>,
ExternalTabContainer* GetExternalTabForHandle(int handle);
+#if defined(OS_CHROMEOS)
+ // Logs in through the Chrome OS Login Wizard with given |username| and
+ // password. Returns true via |reply_message| on success.
+ void LoginWithUserAndPass(const std::string& username,
+ const std::string& password,
+ IPC::Message* reply_message);
+#endif
+
// Callback for history redirect queries.
virtual void OnRedirectQueryComplete(
HistoryService::Handle request_handle,
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 63fcb22..9c5f656 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -18,6 +18,10 @@
#include "chrome/browser/printing/print_job.h"
#endif // defined(OS_WIN)
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/login/authentication_notification_details.h"
+#endif
+
InitialLoadObserver::InitialLoadObserver(size_t tab_count,
AutomationProvider* automation)
: automation_(automation),
@@ -716,3 +720,26 @@ void MetricEventDurationObserver::Observe(NotificationType type,
durations_[metric_event_duration->event_name] =
metric_event_duration->duration_ms;
}
+
+#if defined(OS_CHROMEOS)
+LoginManagerObserver::LoginManagerObserver(
+ AutomationProvider* automation,
+ IPC::Message* reply_message)
+ : automation_(automation),
+ reply_message_(reply_message) {
+
+ registrar_.Add(this, NotificationType::LOGIN_AUTHENTICATION,
+ NotificationService::AllSources());
+}
+
+void LoginManagerObserver::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ DCHECK(type == NotificationType::LOGIN_AUTHENTICATION);
+ Details<AuthenticationNotificationDetails> auth_details(details);
+ AutomationMsg_LoginWithUserAndPass::WriteReplyParams(reply_message_,
+ auth_details->success());
+ automation_->Send(reply_message_);
+ delete this;
+}
+#endif
diff --git a/chrome/browser/automation/automation_provider_observers.h b/chrome/browser/automation/automation_provider_observers.h
index d5411e5..79c824d 100644
--- a/chrome/browser/automation/automation_provider_observers.h
+++ b/chrome/browser/automation/automation_provider_observers.h
@@ -384,4 +384,25 @@ class MetricEventDurationObserver : public NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver);
};
+#if defined(OS_CHROMEOS)
+// Collects LOGIN_AUTHENTICATION notifications and returns
+// whether authentication succeeded to the automation provider.
+class LoginManagerObserver : public NotificationObserver {
+ public:
+ LoginManagerObserver(AutomationProvider* automation,
+ IPC::Message* reply_message);
+
+ // NotificationObserver interface.
+ virtual void Observe(NotificationType type, const NotificationSource& source,
+ const NotificationDetails& details);
+
+ private:
+ NotificationRegistrar registrar_;
+ AutomationProvider* automation_;
+ IPC::Message* reply_message_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoginManagerObserver);
+};
+#endif
+
#endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_