summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 09:45:35 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-14 09:45:35 +0000
commitf9927569d49edd109ef49252ff950c005e16f966 (patch)
treebc7ec57041197502a4efb6789377fcfc7a50505e /content
parentf47adce30cd028685a362092717a738d651ec144 (diff)
downloadchromium_src-f9927569d49edd109ef49252ff950c005e16f966.zip
chromium_src-f9927569d49edd109ef49252ff950c005e16f966.tar.gz
chromium_src-f9927569d49edd109ef49252ff950c005e16f966.tar.bz2
Revert "content: convert accessibility notifications to callbacks"
TBR=jam BUG=170921 Review URL: https://codereview.chromium.org/12212188 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/accessibility/cross_platform_accessibility_browsertest.cc8
-rw-r--r--content/browser/accessibility/dump_accessibility_tree_browsertest.cc24
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc26
-rw-r--r--content/browser/renderer_host/render_view_host_impl.h10
-rw-r--r--content/public/browser/notification_types.h15
5 files changed, 42 insertions, 41 deletions
diff --git a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
index fd3c4bd..7135283 100644
--- a/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
+++ b/content/browser/accessibility/cross_platform_accessibility_browsertest.cc
@@ -33,17 +33,17 @@ class CrossPlatformAccessibilityBrowserTest : public ContentBrowserTest {
// notification that it's been received.
const AccessibilityNodeData& GetAccessibilityNodeDataTree(
AccessibilityMode accessibility_mode = AccessibilityModeComplete) {
- scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner);
+ WindowedNotificationObserver tree_updated_observer(
+ NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE,
+ NotificationService::AllSources());
RenderWidgetHostView* host_view =
shell()->web_contents()->GetRenderWidgetHostView();
RenderWidgetHostImpl* host =
RenderWidgetHostImpl::From(host_view->GetRenderWidgetHost());
RenderViewHostImpl* view_host = static_cast<RenderViewHostImpl*>(host);
- view_host->SetAccessibilityLayoutCompleteCallbackForTesting(
- loop_runner->QuitClosure());
view_host->set_save_accessibility_tree_for_testing(true);
view_host->SetAccessibilityMode(accessibility_mode);
- loop_runner->Run();
+ tree_updated_observer.Wait();
return view_host->accessibility_tree_for_testing();
}
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
index b1c7d98..9b47dfb 100644
--- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
+++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -18,6 +18,8 @@
#include "content/browser/accessibility/dump_accessibility_tree_helper.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/port/browser/render_widget_host_view_port.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_paths.h"
#include "content/public/test/test_utils.h"
@@ -26,16 +28,14 @@
#include "content/shell/shell.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace content {
-
namespace {
+ static const char kCommentToken = '#';
+ static const char* kMarkSkipFile = "#<skip";
+ static const char* kMarkEndOfFile = "<-- End-of-file -->";
+ static const char* kSignalDiff = "*";
+} // namespace
-const char kCommentToken = '#';
-const char kMarkSkipFile[] = "#<skip";
-const char kMarkEndOfFile[] = "<-- End-of-file -->";
-const char kSignalDiff[] = "*";
-
-} // namespace
+namespace content {
typedef DumpAccessibilityTreeHelper::Filter Filter;
@@ -166,17 +166,17 @@ void DumpAccessibilityTreeTest::RunTest(
}
// Load the page.
+ WindowedNotificationObserver tree_updated_observer(
+ NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE,
+ NotificationService::AllSources());
string16 html_contents16;
html_contents16 = UTF8ToUTF16(html_contents);
GURL url = GetTestUrl("accessibility",
html_file.BaseName().MaybeAsASCII().c_str());
- scoped_refptr<MessageLoopRunner> loop_runner(new MessageLoopRunner);
- view_host->SetAccessibilityLoadCompleteCallbackForTesting(
- loop_runner->QuitClosure());
NavigateToURL(shell(), url);
// Wait for the tree.
- loop_runner->Run();
+ tree_updated_observer.Wait();
// Perform a diff (or write the initial baseline).
string16 actual_contents_utf16;
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 4ff3c54..b9c2a29 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -1786,16 +1786,6 @@ void RenderViewHostImpl::UpdateFrameTree(
frame_tree_));
}
-void RenderViewHostImpl::SetAccessibilityLayoutCompleteCallbackForTesting(
- const base::Closure& callback) {
- accessibility_layout_callback_ = callback;
-}
-
-void RenderViewHostImpl::SetAccessibilityLoadCompleteCallbackForTesting(
- const base::Closure& callback) {
- accessibility_load_callback_ = callback;
-}
-
void RenderViewHostImpl::UpdateWebkitPreferences(
const webkit_glue::WebPreferences& prefs) {
Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs));
@@ -1902,11 +1892,17 @@ void RenderViewHostImpl::OnAccessibilityNotifications(
accessibility_tree_ = param.acc_tree;
}
- if (src_type == AccessibilityNotificationLayoutComplete) {
- accessibility_layout_callback_.Run();
- } else if (src_type == AccessibilityNotificationLoadComplete) {
- accessibility_load_callback_.Run();
- }
+ NotificationType dst_type;
+ if (src_type == AccessibilityNotificationLoadComplete)
+ dst_type = NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE;
+ else if (src_type == AccessibilityNotificationLayoutComplete)
+ dst_type = NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE;
+ else
+ dst_type = NOTIFICATION_ACCESSIBILITY_OTHER;
+ NotificationService::current()->Notify(
+ dst_type,
+ Source<RenderViewHost>(this),
+ NotificationService::NoDetails());
}
Send(new AccessibilityMsg_Notifications_ACK(GetRoutingID()));
diff --git a/content/browser/renderer_host/render_view_host_impl.h b/content/browser/renderer_host/render_view_host_impl.h
index 0a79634..7d57852 100644
--- a/content/browser/renderer_host/render_view_host_impl.h
+++ b/content/browser/renderer_host/render_view_host_impl.h
@@ -414,12 +414,6 @@ class CONTENT_EXPORT RenderViewHostImpl
int route_id,
const std::string& frame_tree);
- // Set accessibility callbacks.
- void SetAccessibilityLayoutCompleteCallbackForTesting(
- const base::Closure& callback);
- void SetAccessibilityLoadCompleteCallbackForTesting(
- const base::Closure& callback);
-
void set_save_accessibility_tree_for_testing(bool save) {
save_accessibility_tree_for_testing_ = save;
}
@@ -658,10 +652,6 @@ class CONTENT_EXPORT RenderViewHostImpl
// callbacks.
std::map<int, JavascriptResultCallback> javascript_callbacks_;
- // Accessibility callbacks.
- base::Closure accessibility_layout_callback_;
- base::Closure accessibility_load_callback_;
-
// True if the render view can be shut down suddenly.
bool sudden_termination_allowed_;
diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h
index de035c0..cfaafd5 100644
--- a/content/public/browser/notification_types.h
+++ b/content/public/browser/notification_types.h
@@ -250,6 +250,21 @@ enum NotificationType {
// the RenderViewHost, and the details is a DomOperationNotificationDetails.
NOTIFICATION_DOM_OPERATION_RESPONSE,
+ // Indicates that the render view host has received a "load complete"
+ // accessibility notification. The source is the RenderViewHost,
+ // the details are not used.
+ NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE,
+
+ // Indicates that the render view host has received a "layout complete"
+ // accessibility notification. The source is the RenderViewHost,
+ // the details are not used.
+ NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE,
+
+ // Indicates that the render view host has received an accessibility
+ // notification. other than the ones covered above.
+ // The source is the RenderViewHost, the details are not used.
+ NOTIFICATION_ACCESSIBILITY_OTHER,
+
// Child Processes ---------------------------------------------------------
// This notification is sent when a child process host has connected to a