Index: chrome/browser/automation/automation_provider_observers.cc |
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc |
index 7afc0d0c5a9159b6d46229df7b99f28195d8b204..878f5286b7a0382479a0e6ed8f08ae426bb88a1d 100644 |
--- a/chrome/browser/automation/automation_provider_observers.cc |
+++ b/chrome/browser/automation/automation_provider_observers.cc |
@@ -2009,6 +2009,10 @@ void AllTabsStoppedLoadingObserver::Observe( |
} |
void AllTabsStoppedLoadingObserver::CheckIfStopped() { |
+ if (!automation_) { |
+ delete this; |
+ return; |
+ } |
bool done_loading = true; |
BrowserList::const_iterator iter = BrowserList::begin(); |
for (; iter != BrowserList::end(); ++iter) { |
@@ -2095,3 +2099,24 @@ void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { |
automation_->Send(reply_message_.release()); |
Release(); |
} |
+ |
+ExecuteJavascriptObserver::ExecuteJavascriptObserver( |
+ AutomationProvider* automation, |
+ IPC::Message* reply_message) |
+ : automation_(automation->AsWeakPtr()), |
+ reply_message_(reply_message) { |
+} |
+ |
+ExecuteJavascriptObserver::~ExecuteJavascriptObserver() { |
+} |
+ |
+void ExecuteJavascriptObserver::OnDomOperationCompleted( |
+ const std::string& json) { |
+ if (automation_) { |
+ DictionaryValue dict; |
+ dict.SetString("result", json); |
+ AutomationJSONReply(automation_, reply_message_.release()) |
+ .SendSuccess(&dict); |
+ } |
+ delete this; |
+} |