| Index: chrome/browser/automation/automation_provider.cc
|
| diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
|
| index eb165e1e9e5c88e545e9349ba3ebfe6a2b7c4471..b5718e52953908e6deb1d34f5733fac781f2bf39 100644
|
| --- a/chrome/browser/automation/automation_provider.cc
|
| +++ b/chrome/browser/automation/automation_provider.cc
|
| @@ -216,11 +216,6 @@ NotificationObserver* AutomationProvider::AddNavigationStatusListener(
|
| return observer;
|
| }
|
|
|
| -void AutomationProvider::RemoveNavigationStatusListener(
|
| - NotificationObserver* obs) {
|
| - notification_observer_list_.RemoveObserver(obs);
|
| -}
|
| -
|
| NotificationObserver* AutomationProvider::AddTabStripObserver(
|
| Browser* parent,
|
| IPC::Message* reply_message) {
|
| @@ -231,7 +226,7 @@ NotificationObserver* AutomationProvider::AddTabStripObserver(
|
| return observer;
|
| }
|
|
|
| -void AutomationProvider::RemoveTabStripObserver(NotificationObserver* obs) {
|
| +void AutomationProvider::RemoveObserver(NotificationObserver* obs) {
|
| notification_observer_list_.RemoveObserver(obs);
|
| }
|
|
|
| @@ -499,6 +494,9 @@ void AutomationProvider::OnMessageReceived(const IPC::Message& message) {
|
| IPC_MESSAGE_HANDLER(AutomationMsg_SetEnableExtensionAutomation,
|
| SetEnableExtensionAutomation)
|
| #endif
|
| + IPC_MESSAGE_HANDLER_DELAY_REPLY(
|
| + AutomationMsg_WaitForDownloadShelfVisibilityChange,
|
| + WaitForDownloadShelfVisibilityChange)
|
| IPC_MESSAGE_HANDLER(AutomationMsg_SetShelfVisibility, SetShelfVisibility)
|
| IPC_MESSAGE_HANDLER(AutomationMsg_BlockedPopupCount, GetBlockedPopupCount)
|
| IPC_MESSAGE_HANDLER(AutomationMsg_SelectAll, SelectAll)
|
| @@ -602,7 +600,7 @@ void AutomationProvider::AppendTab(int handle, const GURL& url,
|
| if (append_tab_response < 0) {
|
| // The append tab failed. Remove the TabStripObserver
|
| if (observer) {
|
| - RemoveTabStripObserver(observer);
|
| + RemoveObserver(observer);
|
| delete observer;
|
| }
|
|
|
| @@ -1594,6 +1592,31 @@ void AutomationProvider::RemoveBookmark(int handle,
|
| *success = false;
|
| }
|
|
|
| +void AutomationProvider::WaitForDownloadShelfVisibilityChange(
|
| + int browser_handle,
|
| + bool desired_visibility,
|
| + IPC::Message* reply_message) {
|
| + bool success = false;
|
| + if (browser_tracker_->ContainsHandle(browser_handle)) {
|
| + bool visibility = !desired_visibility;
|
| + GetShelfVisibility(browser_handle, &visibility);
|
| + if (visibility == desired_visibility) {
|
| + success = true;
|
| + } else {
|
| + Browser* browser = browser_tracker_->GetResource(browser_handle);
|
| + notification_observer_list_.AddObserver(
|
| + new DownloadShelfVisibilityObserver(this,
|
| + browser,
|
| + desired_visibility,
|
| + reply_message));
|
| + return;
|
| + }
|
| + }
|
| + AutomationMsg_WaitForDownloadShelfVisibilityChange::WriteReplyParams(
|
| + reply_message, success);
|
| + Send(reply_message);
|
| +}
|
| +
|
| // Sample json input: { "command": "SetWindowDimensions",
|
| // "x": 20, # optional
|
| // "y": 20, # optional
|
|
|