Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: chrome/browser/automation/automation_provider_observers.cc

Issue 2280003: Use IPC to wait for download in DownloadTest. (Closed) Base URL: git://codf21.jail.google.com/chromium.git
Patch Set: Fix compile error. Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cdb5de8b71e939126a27d2085035d068406a4b80..85dbd71621553e8abaf1cbe48b9e33837ba4a8ca 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -10,6 +10,7 @@
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/automation/automation_provider.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
+#include "chrome/browser/browser_window.h"
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_process_manager.h"
@@ -159,7 +160,7 @@ NavigationNotificationObserver::~NavigationNotificationObserver() {
reply_message_ = NULL;
}
- automation_->RemoveNavigationStatusListener(this);
+ automation_->RemoveObserver(this);
}
void NavigationNotificationObserver::Observe(
@@ -234,7 +235,7 @@ void TabStripNotificationObserver::Observe(NotificationType type,
ObserveTab(Source<NavigationController>(source).ptr());
// If verified, no need to observe anymore
- automation_->RemoveTabStripObserver(this);
+ automation_->RemoveObserver(this);
delete this;
} else {
NOTREACHED();
@@ -813,7 +814,7 @@ DocumentPrintedNotificationObserver::~DocumentPrintedNotificationObserver() {
DCHECK(reply_message_ != NULL);
AutomationMsg_PrintNow::WriteReplyParams(reply_message_, success_);
automation_->Send(reply_message_);
- automation_->RemoveNavigationStatusListener(this);
+ automation_->RemoveObserver(this);
}
void DocumentPrintedNotificationObserver::Observe(
@@ -899,6 +900,39 @@ void LoginManagerObserver::Observe(NotificationType type,
}
#endif
+DownloadShelfVisibilityObserver::DownloadShelfVisibilityObserver(
+ AutomationProvider* automation,
+ Browser* browser,
+ bool visibility,
+ IPC::Message* reply_message)
+ : automation_(automation),
+ visibility_(visibility),
+ reply_message_(reply_message) {
+ registrar_.Add(this, NotificationType::DOWNLOAD_SHELF_VISIBILITY_CHANGED,
+ Source<Browser>(browser));
+}
+
+DownloadShelfVisibilityObserver::~DownloadShelfVisibilityObserver() {
+}
+
+void DownloadShelfVisibilityObserver::Observe(
+ NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::DOWNLOAD_SHELF_VISIBILITY_CHANGED) {
+ Browser* browser = Source<Browser>(source).ptr();
+ if (browser->window()->IsDownloadShelfVisible() == visibility_) {
+ AutomationMsg_WaitForDownloadShelfVisibilityChange::WriteReplyParams(
+ reply_message_, true);
+ automation_->Send(reply_message_);
+ automation_->RemoveObserver(this);
+ delete this;
+ }
+ } else {
+ NOTREACHED();
+ }
+}
+
AutomationProviderBookmarkModelObserver::AutomationProviderBookmarkModelObserver(
AutomationProvider* provider,
IPC::Message* reply_message,
@@ -976,7 +1010,7 @@ OmniboxAcceptNotificationObserver::OmniboxAcceptNotificationObserver(
}
OmniboxAcceptNotificationObserver::~OmniboxAcceptNotificationObserver() {
- automation_->RemoveNavigationStatusListener(this);
+ automation_->RemoveObserver(this);
}
void OmniboxAcceptNotificationObserver::Observe(
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698