| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 reply_message_->routing_id()); | 1725 reply_message_->routing_id()); |
| 1726 | 1726 |
| 1727 render_view_->ExecuteJavascriptInWebFrame(string16(), | 1727 render_view_->ExecuteJavascriptInWebFrame(string16(), |
| 1728 WideToUTF16Hack(set_automation_id)); | 1728 WideToUTF16Hack(set_automation_id)); |
| 1729 render_view_->ExecuteJavascriptInWebFrame(string16(), | 1729 render_view_->ExecuteJavascriptInWebFrame(string16(), |
| 1730 WideToUTF16Hack(javascript)); | 1730 WideToUTF16Hack(javascript)); |
| 1731 } | 1731 } |
| 1732 | 1732 |
| 1733 void PageSnapshotTaker::SendMessage(bool success) { | 1733 void PageSnapshotTaker::SendMessage(bool success) { |
| 1734 if (automation_) { | 1734 if (automation_) { |
| 1735 AutomationMsg_CaptureEntirePageAsPNG::WriteReplyParams(reply_message_.get(), | 1735 if (success) { |
| 1736 success); | 1736 AutomationJSONReply(automation_, reply_message_.release()) |
| 1737 automation_->Send(reply_message_.release()); | 1737 .SendSuccess(NULL); |
| 1738 } else { |
| 1739 AutomationJSONReply(automation_, reply_message_.release()) |
| 1740 .SendError("Failed to take snapshot of page"); |
| 1741 } |
| 1738 } | 1742 } |
| 1739 delete this; | 1743 delete this; |
| 1740 } | 1744 } |
| 1741 | 1745 |
| 1742 NTPInfoObserver::NTPInfoObserver( | 1746 NTPInfoObserver::NTPInfoObserver( |
| 1743 AutomationProvider* automation, | 1747 AutomationProvider* automation, |
| 1744 IPC::Message* reply_message, | 1748 IPC::Message* reply_message, |
| 1745 CancelableRequestConsumer* consumer) | 1749 CancelableRequestConsumer* consumer) |
| 1746 : automation_(automation->AsWeakPtr()), | 1750 : automation_(automation->AsWeakPtr()), |
| 1747 reply_message_(reply_message), | 1751 reply_message_(reply_message), |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 this, | 2144 this, |
| 2141 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); | 2145 &WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread)); |
| 2142 } | 2146 } |
| 2143 | 2147 |
| 2144 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { | 2148 void WaitForProcessLauncherThreadToGoIdleObserver::RunOnUIThread() { |
| 2145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 2149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 2146 if (automation_) | 2150 if (automation_) |
| 2147 automation_->Send(reply_message_.release()); | 2151 automation_->Send(reply_message_.release()); |
| 2148 Release(); | 2152 Release(); |
| 2149 } | 2153 } |
| OLD | NEW |