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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 12210082: content: convert accessibility notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 // This should only be called when swapped out. 1779 // This should only be called when swapped out.
1780 DCHECK(is_swapped_out_); 1780 DCHECK(is_swapped_out_);
1781 1781
1782 frame_tree_ = frame_tree; 1782 frame_tree_ = frame_tree;
1783 Send(new ViewMsg_UpdateFrameTree(GetRoutingID(), 1783 Send(new ViewMsg_UpdateFrameTree(GetRoutingID(),
1784 process_id, 1784 process_id,
1785 route_id, 1785 route_id,
1786 frame_tree_)); 1786 frame_tree_));
1787 } 1787 }
1788 1788
1789 void RenderViewHostImpl::AddAccessibilityLayoutCompleteCallbackForTesting(
1790 const base::Closure& callback) {
1791 accessibility_layout_callbacks_.push_back(callback);
1792 }
1793
1794 void RenderViewHostImpl::RemoveAccessibilityLayoutCompleteCallbackForTesting(
1795 const base::Closure& callback) {
1796 for (size_t i = 0; i < accessibility_layout_callbacks_.size(); i++) {
1797 if (accessibility_layout_callbacks_[i].Equals(callback)) {
1798 accessibility_layout_callbacks_.erase(
1799 accessibility_layout_callbacks_.begin() + i);
1800 }
1801 }
1802 }
1803
1804 void RenderViewHostImpl::AddAccessibilityLoadCompleteCallbackForTesting(
1805 const base::Closure& callback) {
1806 accessibility_load_callbacks_.push_back(callback);
1807 }
1808
1809 void RenderViewHostImpl::RemoveAccessibilityLoadCompleteCallbackForTesting(
1810 const base::Closure& callback) {
1811 for (size_t i = 0; i < accessibility_load_callbacks_.size(); i++) {
1812 if (accessibility_load_callbacks_[i].Equals(callback)) {
1813 accessibility_load_callbacks_.erase(
1814 accessibility_load_callbacks_.begin() + i);
1815 }
1816 }
1817 }
1818
1789 void RenderViewHostImpl::UpdateWebkitPreferences( 1819 void RenderViewHostImpl::UpdateWebkitPreferences(
1790 const webkit_glue::WebPreferences& prefs) { 1820 const webkit_glue::WebPreferences& prefs) {
1791 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs)); 1821 Send(new ViewMsg_UpdateWebPreferences(GetRoutingID(), prefs));
1792 } 1822 }
1793 1823
1794 void RenderViewHostImpl::NotifyTimezoneChange() { 1824 void RenderViewHostImpl::NotifyTimezoneChange() {
1795 Send(new ViewMsg_TimezoneChange(GetRoutingID())); 1825 Send(new ViewMsg_TimezoneChange(GetRoutingID()));
1796 } 1826 }
1797 1827
1798 void RenderViewHostImpl::ClearFocusedNode() { 1828 void RenderViewHostImpl::ClearFocusedNode() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 for (unsigned i = 0; i < params.size(); i++) { 1915 for (unsigned i = 0; i < params.size(); i++) {
1886 const AccessibilityHostMsg_NotificationParams& param = params[i]; 1916 const AccessibilityHostMsg_NotificationParams& param = params[i];
1887 AccessibilityNotification src_type = param.notification_type; 1917 AccessibilityNotification src_type = param.notification_type;
1888 1918
1889 if ((src_type == AccessibilityNotificationLayoutComplete || 1919 if ((src_type == AccessibilityNotificationLayoutComplete ||
1890 src_type == AccessibilityNotificationLoadComplete) && 1920 src_type == AccessibilityNotificationLoadComplete) &&
1891 save_accessibility_tree_for_testing_) { 1921 save_accessibility_tree_for_testing_) {
1892 accessibility_tree_ = param.acc_tree; 1922 accessibility_tree_ = param.acc_tree;
1893 } 1923 }
1894 1924
1895 NotificationType dst_type; 1925 if (src_type == AccessibilityNotificationLayoutComplete) {
1896 if (src_type == AccessibilityNotificationLoadComplete) 1926 for (size_t i = 0; i < accessibility_layout_callbacks_.size(); ++i)
1897 dst_type = NOTIFICATION_ACCESSIBILITY_LOAD_COMPLETE; 1927 accessibility_layout_callbacks_[i].Run();
1898 else if (src_type == AccessibilityNotificationLayoutComplete) 1928 } else if (src_type == AccessibilityNotificationLoadComplete) {
1899 dst_type = NOTIFICATION_ACCESSIBILITY_LAYOUT_COMPLETE; 1929 for (size_t i = 0; i < accessibility_load_callbacks_.size(); ++i)
1900 else 1930 accessibility_load_callbacks_[i].Run();
1901 dst_type = NOTIFICATION_ACCESSIBILITY_OTHER; 1931 }
1902 NotificationService::current()->Notify(
1903 dst_type,
1904 Source<RenderViewHost>(this),
1905 NotificationService::NoDetails());
1906 } 1932 }
1907 1933
1908 Send(new AccessibilityMsg_Notifications_ACK(GetRoutingID())); 1934 Send(new AccessibilityMsg_Notifications_ACK(GetRoutingID()));
1909 } 1935 }
1910 1936
1911 void RenderViewHostImpl::OnScriptEvalResponse(int id, 1937 void RenderViewHostImpl::OnScriptEvalResponse(int id,
1912 const base::ListValue& result) { 1938 const base::ListValue& result) {
1913 const base::Value* result_value; 1939 const base::Value* result_value;
1914 if (!result.Get(0, &result_value)) { 1940 if (!result.Get(0, &result_value)) {
1915 // Programming error or rogue renderer. 1941 // Programming error or rogue renderer.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 GetRoutingID(), snapshot_id, snapshot_size, png)); 2097 GetRoutingID(), snapshot_id, snapshot_size, png));
2072 return; 2098 return;
2073 } 2099 }
2074 } 2100 }
2075 2101
2076 Send(new ViewMsg_WindowSnapshotCompleted( 2102 Send(new ViewMsg_WindowSnapshotCompleted(
2077 GetRoutingID(), snapshot_id, gfx::Size(), png)); 2103 GetRoutingID(), snapshot_id, gfx::Size(), png));
2078 } 2104 }
2079 2105
2080 } // namespace content 2106 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698