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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2558933002: Add more fine-grained accessibility modes. (Closed)
Patch Set: Address feedback Created 4 years 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/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <utility> 10 #include <utility>
(...skipping 14 matching lines...) Expand all
25 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_util.h" 26 #include "base/strings/string_util.h"
27 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
28 #include "base/threading/thread_task_runner_handle.h" 28 #include "base/threading/thread_task_runner_handle.h"
29 #include "base/time/time.h" 29 #include "base/time/time.h"
30 #include "base/trace_event/trace_event.h" 30 #include "base/trace_event/trace_event.h"
31 #include "build/build_config.h" 31 #include "build/build_config.h"
32 #include "components/mime_util/mime_util.h" 32 #include "components/mime_util/mime_util.h"
33 #include "components/rappor/public/rappor_utils.h" 33 #include "components/rappor/public/rappor_utils.h"
34 #include "components/url_formatter/url_formatter.h" 34 #include "components/url_formatter/url_formatter.h"
35 #include "content/browser/accessibility/accessibility_mode_helper.h"
36 #include "content/browser/accessibility/browser_accessibility_state_impl.h" 35 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
37 #include "content/browser/bad_message.h" 36 #include "content/browser/bad_message.h"
38 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 37 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
39 #include "content/browser/browser_plugin/browser_plugin_guest.h" 38 #include "content/browser/browser_plugin/browser_plugin_guest.h"
40 #include "content/browser/child_process_security_policy_impl.h" 39 #include "content/browser/child_process_security_policy_impl.h"
41 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 40 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
42 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" 41 #include "content/browser/dom_storage/dom_storage_context_wrapper.h"
43 #include "content/browser/dom_storage/session_storage_namespace_impl.h" 42 #include "content/browser/dom_storage/session_storage_namespace_impl.h"
44 #include "content/browser/download/download_stats.h" 43 #include "content/browser/download/download_stats.h"
45 #include "content/browser/download/mhtml_generation_manager.h" 44 #include "content/browser/download/mhtml_generation_manager.h"
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 for (FrameTreeNode* node : frame_tree_.Nodes()) { 955 for (FrameTreeNode* node : frame_tree_.Nodes()) {
957 UpdateAccessibilityModeOnFrame(node->current_frame_host()); 956 UpdateAccessibilityModeOnFrame(node->current_frame_host());
958 RenderFrameHost* pending_frame_host = 957 RenderFrameHost* pending_frame_host =
959 node->render_manager()->pending_frame_host(); 958 node->render_manager()->pending_frame_host();
960 if (pending_frame_host) 959 if (pending_frame_host)
961 UpdateAccessibilityModeOnFrame(pending_frame_host); 960 UpdateAccessibilityModeOnFrame(pending_frame_host);
962 } 961 }
963 } 962 }
964 963
965 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { 964 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) {
966 SetAccessibilityMode(AddAccessibilityModeTo(accessibility_mode_, mode)); 965 SetAccessibilityMode(accessibility_mode_ | mode);
967 }
968
969 void WebContentsImpl::RemoveAccessibilityMode(AccessibilityMode mode) {
970 SetAccessibilityMode(RemoveAccessibilityModeFrom(accessibility_mode_, mode));
971 } 966 }
972 967
973 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { 968 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) {
974 // Send a request to each of the frames in parallel. Each one will return 969 // Send a request to each of the frames in parallel. Each one will return
975 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine 970 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine
976 // them into a single tree and call |callback| with that result, then 971 // them into a single tree and call |callback| with that result, then
977 // delete |combiner|. 972 // delete |combiner|.
978 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); 973 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback);
979 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { 974 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) {
980 bool is_root = frame_tree_node->parent() == nullptr; 975 bool is_root = frame_tree_node->parent() == nullptr;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 controller_.ReloadBypassingCache(true); 1066 controller_.ReloadBypassingCache(true);
1072 1067
1073 for (auto& observer : observers_) 1068 for (auto& observer : observers_)
1074 observer.UserAgentOverrideSet(override); 1069 observer.UserAgentOverrideSet(override);
1075 } 1070 }
1076 1071
1077 const std::string& WebContentsImpl::GetUserAgentOverride() const { 1072 const std::string& WebContentsImpl::GetUserAgentOverride() const {
1078 return renderer_preferences_.user_agent_override; 1073 return renderer_preferences_.user_agent_override;
1079 } 1074 }
1080 1075
1081 void WebContentsImpl::EnableTreeOnlyAccessibilityMode() { 1076 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() {
1082 if (GetAccessibilityMode() != AccessibilityModeOff) { 1077 if (GetAccessibilityMode() != AccessibilityModeOff) {
1083 for (RenderFrameHost* rfh : GetAllFrames()) 1078 for (RenderFrameHost* rfh : GetAllFrames())
1084 ResetAccessibility(rfh); 1079 ResetAccessibility(rfh);
1085 } else { 1080 } else {
1086 AddAccessibilityMode(AccessibilityModeTreeOnly); 1081 AddAccessibilityMode(kAccessibilityModeWebContentsOnly);
1087 } 1082 }
1088 } 1083 }
1089 1084
1090 bool WebContentsImpl::IsTreeOnlyAccessibilityModeForTesting() const { 1085 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const {
1091 return accessibility_mode_ == AccessibilityModeTreeOnly; 1086 return accessibility_mode_ == kAccessibilityModeWebContentsOnly;
1092 } 1087 }
1093 1088
1094 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { 1089 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const {
1095 return accessibility_mode_ == AccessibilityModeComplete; 1090 return accessibility_mode_ == kAccessibilityModeComplete;
1096 } 1091 }
1097 1092
1098 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const { 1093 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const {
1099 return page_importance_signals_; 1094 return page_importance_signals_;
1100 } 1095 }
1101 1096
1102 const base::string16& WebContentsImpl::GetTitle() const { 1097 const base::string16& WebContentsImpl::GetTitle() const {
1103 // Transient entries take precedence. They are used for interstitial pages 1098 // Transient entries take precedence. They are used for interstitial pages
1104 // that are shown on top of existing pages. 1099 // that are shown on top of existing pages.
1105 NavigationEntry* entry = controller_.GetTransientEntry(); 1100 NavigationEntry* entry = controller_.GetTransientEntry();
(...skipping 4215 matching lines...) Expand 10 before | Expand all | Expand 10 after
5321 GetMainFrame()->AddMessageToConsole( 5316 GetMainFrame()->AddMessageToConsole(
5322 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5317 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5323 base::StringPrintf("This site does not have a valid SSL " 5318 base::StringPrintf("This site does not have a valid SSL "
5324 "certificate! Without SSL, your site's and " 5319 "certificate! Without SSL, your site's and "
5325 "visitors' data is vulnerable to theft and " 5320 "visitors' data is vulnerable to theft and "
5326 "tampering. Get a valid SSL certificate before" 5321 "tampering. Get a valid SSL certificate before"
5327 " releasing your website to the public.")); 5322 " releasing your website to the public."));
5328 } 5323 }
5329 5324
5330 } // namespace content 5325 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698