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

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

Issue 15741009: Native Android accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address most reviewer feedback Created 7 years, 6 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
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 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 1909
1910 void RenderViewHostImpl::OnAccessibilityNotifications( 1910 void RenderViewHostImpl::OnAccessibilityNotifications(
1911 const std::vector<AccessibilityHostMsg_NotificationParams>& params) { 1911 const std::vector<AccessibilityHostMsg_NotificationParams>& params) {
1912 if (view_ && !is_swapped_out_) 1912 if (view_ && !is_swapped_out_)
1913 view_->OnAccessibilityNotifications(params); 1913 view_->OnAccessibilityNotifications(params);
1914 1914
1915 for (unsigned i = 0; i < params.size(); i++) { 1915 for (unsigned i = 0; i < params.size(); i++) {
1916 const AccessibilityHostMsg_NotificationParams& param = params[i]; 1916 const AccessibilityHostMsg_NotificationParams& param = params[i];
1917 AccessibilityNotification src_type = param.notification_type; 1917 AccessibilityNotification src_type = param.notification_type;
1918 1918
1919 if ((src_type == AccessibilityNotificationLayoutComplete || 1919 bool is_about_blank = false;
1920 src_type == AccessibilityNotificationLoadComplete) && 1920 for (unsigned j = 0; j < param.nodes.size(); j++) {
1921 save_accessibility_tree_for_testing_) { 1921 typedef AccessibilityNodeData::StringAttribute StringAttribute;
1922 MakeAccessibilityNodeDataTree(param.nodes, &accessibility_tree_); 1922 std::map<StringAttribute, string16>::const_iterator iter;
1923 iter = param.nodes[j].string_attributes.find(
1924 AccessibilityNodeData::ATTR_DOC_URL);
1925 if (iter != param.nodes[j].string_attributes.end()) {
1926 string16 doc_url = iter->second;
1927 if (doc_url == ASCIIToUTF16(kAboutBlankURL)) {
1928 is_about_blank = true;
1929 break;
1930 }
1931 }
1923 } 1932 }
1924 1933
1925 if (src_type == AccessibilityNotificationLayoutComplete) { 1934 if (!is_about_blank) {
1926 accessibility_layout_callback_.Run(); 1935 if ((src_type == AccessibilityNotificationLayoutComplete ||
1927 } else if (src_type == AccessibilityNotificationLoadComplete) { 1936 src_type == AccessibilityNotificationLoadComplete) &&
1928 accessibility_load_callback_.Run(); 1937 save_accessibility_tree_for_testing_) {
1929 } else { 1938 MakeAccessibilityNodeDataTree(param.nodes, &accessibility_tree_);
1930 accessibility_other_callback_.Run(); 1939 }
1940
1941 if (src_type == AccessibilityNotificationLayoutComplete) {
1942 accessibility_layout_callback_.Run();
1943 } else if (src_type == AccessibilityNotificationLoadComplete) {
1944 accessibility_load_callback_.Run();
1945 } else {
1946 accessibility_other_callback_.Run();
1947 }
1931 } 1948 }
1932 } 1949 }
1933 1950
1934 Send(new AccessibilityMsg_Notifications_ACK(GetRoutingID())); 1951 Send(new AccessibilityMsg_Notifications_ACK(GetRoutingID()));
1935 } 1952 }
1936 1953
1937 void RenderViewHostImpl::OnScriptEvalResponse(int id, 1954 void RenderViewHostImpl::OnScriptEvalResponse(int id,
1938 const base::ListValue& result) { 1955 const base::ListValue& result) {
1939 const base::Value* result_value; 1956 const base::Value* result_value;
1940 if (!result.Get(0, &result_value)) { 1957 if (!result.Get(0, &result_value)) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles(); 2118 const std::vector<base::FilePath>& file_paths = state.GetReferencedFiles();
2102 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin(); 2119 for (std::vector<base::FilePath>::const_iterator file = file_paths.begin();
2103 file != file_paths.end(); ++file) { 2120 file != file_paths.end(); ++file) {
2104 if (!policy->CanReadFile(GetProcess()->GetID(), *file)) 2121 if (!policy->CanReadFile(GetProcess()->GetID(), *file))
2105 return false; 2122 return false;
2106 } 2123 }
2107 return true; 2124 return true;
2108 } 2125 }
2109 2126
2110 } // namespace content 2127 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698