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

Unified Diff: chrome/test/base/test_web_dialog_observer.cc

Issue 10332231: Remove chrome::NOTIFICATION_WEB_DIALOG_SHOWN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add web_dialog_observer.h to chrome_browser.gypi Created 8 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
Index: chrome/test/base/test_web_dialog_observer.cc
diff --git a/chrome/test/base/test_web_dialog_observer.cc b/chrome/test/base/test_web_dialog_observer.cc
index 9ff801e7010102d3739deca44125dd0373e7e9d7..11ba4960d6a65eb98a8710f98491da03a11c8462 100644
--- a/chrome/test/base/test_web_dialog_observer.cc
+++ b/chrome/test/base/test_web_dialog_observer.cc
@@ -4,7 +4,6 @@
#include "chrome/test/base/test_web_dialog_observer.h"
-#include "chrome/common/chrome_notification_types.h"
#include "content/test/js_injection_ready_observer.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/notification_service.h"
@@ -23,8 +22,6 @@ TestWebDialogObserver::TestWebDialogObserver(
web_ui_(NULL),
done_(false),
running_(false) {
- registrar_.Add(this, chrome::NOTIFICATION_WEB_DIALOG_SHOWN,
- content::NotificationService::AllSources());
}
TestWebDialogObserver::~TestWebDialogObserver() {
@@ -35,24 +32,6 @@ void TestWebDialogObserver::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_WEB_DIALOG_SHOWN:
- if (js_injection_ready_observer_) {
- js_injection_ready_observer_->OnJsInjectionReady(
- content::Details<content::RenderViewHost>(details).ptr());
- }
- web_ui_ = content::Source<content::WebUI>(source).ptr();
- registrar_.Remove(this, chrome::NOTIFICATION_WEB_DIALOG_SHOWN,
- content::NotificationService::AllSources());
- // Wait for navigation on the new WebUI instance to complete. This depends
- // on receiving the notification of the WebDialog being shown before the
- // NavigationController finishes loading. The WebDialog notification is
- // issued from web_dialog_ui.cc on RenderView creation which results from
- // the call to render_manager_.Navigate in the method
- // WebContents::NavigateToEntry. The new RenderView is later told to
- // navigate in this method, ensuring that this is not a race condition.
- registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
- content::Source<NavigationController>(
- &web_ui_->GetWebContents()->GetController()));
break;
case content::NOTIFICATION_LOAD_STOP:
DCHECK(web_ui_);
@@ -71,6 +50,25 @@ void TestWebDialogObserver::Observe(
};
}
+void TestWebDialogObserver::OnDialogShown(
+ content::WebUI* webui,
+ content::RenderViewHost* render_view_host) {
+ if (js_injection_ready_observer_) {
+ js_injection_ready_observer_->OnJsInjectionReady(render_view_host);
+ }
+ web_ui_ = webui;
+ // Wait for navigation on the new WebUI instance to complete. This depends
+ // on receiving the notification of the WebDialog being shown before the
+ // NavigationController finishes loading. The WebDialog notification is
+ // issued from web_dialog_ui.cc on RenderView creation which results from
+ // the call to render_manager_.Navigate in the method
+ // WebContents::NavigateToEntry. The new RenderView is later told to
+ // navigate in this method, ensuring that this is not a race condition.
+ registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
+ content::Source<NavigationController>(
+ &web_ui_->GetWebContents()->GetController()));
+}
+
content::WebUI* TestWebDialogObserver::GetWebUI() {
if (!done_) {
EXPECT_FALSE(running_);
« no previous file with comments | « chrome/test/base/test_web_dialog_observer.h ('k') | chrome/test/data/webui/certificate_viewer_ui_test-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698