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

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

Issue 2694413006: Scope and clean up uses of AccessibilityMode. (Closed)
Patch Set: merge Created 3 years, 9 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/accessibility_mode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 for (FrameTreeNode* node : frame_tree_.Nodes()) { 957 for (FrameTreeNode* node : frame_tree_.Nodes()) {
958 UpdateAccessibilityModeOnFrame(node->current_frame_host()); 958 UpdateAccessibilityModeOnFrame(node->current_frame_host());
959 RenderFrameHost* pending_frame_host = 959 RenderFrameHost* pending_frame_host =
960 node->render_manager()->pending_frame_host(); 960 node->render_manager()->pending_frame_host();
961 if (pending_frame_host) 961 if (pending_frame_host)
962 UpdateAccessibilityModeOnFrame(pending_frame_host); 962 UpdateAccessibilityModeOnFrame(pending_frame_host);
963 } 963 }
964 } 964 }
965 965
966 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { 966 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) {
967 SetAccessibilityMode(accessibility_mode_ | mode); 967 AccessibilityMode new_mode(accessibility_mode_);
968 new_mode |= mode;
969 SetAccessibilityMode(new_mode);
968 } 970 }
969 971
970 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { 972 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) {
971 // Send a request to each of the frames in parallel. Each one will return 973 // Send a request to each of the frames in parallel. Each one will return
972 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine 974 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine
973 // them into a single tree and call |callback| with that result, then 975 // them into a single tree and call |callback| with that result, then
974 // delete |combiner|. 976 // delete |combiner|.
975 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); 977 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback);
976 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { 978 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) {
977 bool is_root = frame_tree_node->parent() == nullptr; 979 bool is_root = frame_tree_node->parent() == nullptr;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1071
1070 for (auto& observer : observers_) 1072 for (auto& observer : observers_)
1071 observer.UserAgentOverrideSet(override); 1073 observer.UserAgentOverrideSet(override);
1072 } 1074 }
1073 1075
1074 const std::string& WebContentsImpl::GetUserAgentOverride() const { 1076 const std::string& WebContentsImpl::GetUserAgentOverride() const {
1075 return renderer_preferences_.user_agent_override; 1077 return renderer_preferences_.user_agent_override;
1076 } 1078 }
1077 1079
1078 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() { 1080 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() {
1079 if (GetAccessibilityMode() != AccessibilityModeOff) { 1081 if (!GetAccessibilityMode().is_mode_off()) {
1080 for (RenderFrameHost* rfh : GetAllFrames()) 1082 for (RenderFrameHost* rfh : GetAllFrames())
1081 ResetAccessibility(rfh); 1083 ResetAccessibility(rfh);
1082 } else { 1084 } else {
1083 AddAccessibilityMode(ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY); 1085 AddAccessibilityMode(kAccessibilityModeWebContentsOnly);
1084 } 1086 }
1085 } 1087 }
1086 1088
1087 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const { 1089 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const {
1088 return accessibility_mode_ == ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY; 1090 return accessibility_mode_ == kAccessibilityModeWebContentsOnly;
1089 } 1091 }
1090 1092
1091 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { 1093 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const {
1092 return accessibility_mode_ == ACCESSIBILITY_MODE_COMPLETE; 1094 return accessibility_mode_ == kAccessibilityModeComplete;
1093 } 1095 }
1094 1096
1095 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const { 1097 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const {
1096 return page_importance_signals_; 1098 return page_importance_signals_;
1097 } 1099 }
1098 1100
1099 const base::string16& WebContentsImpl::GetTitle() const { 1101 const base::string16& WebContentsImpl::GetTitle() const {
1100 // Transient entries take precedence. They are used for interstitial pages 1102 // Transient entries take precedence. They are used for interstitial pages
1101 // that are shown on top of existing pages. 1103 // that are shown on top of existing pages.
1102 NavigationEntry* entry = controller_.GetTransientEntry(); 1104 NavigationEntry* entry = controller_.GetTransientEntry();
(...skipping 4298 matching lines...) Expand 10 before | Expand all | Expand 10 after
5401 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5403 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5402 if (!render_view_host) 5404 if (!render_view_host)
5403 continue; 5405 continue;
5404 render_view_host_set.insert(render_view_host); 5406 render_view_host_set.insert(render_view_host);
5405 } 5407 }
5406 for (RenderViewHost* render_view_host : render_view_host_set) 5408 for (RenderViewHost* render_view_host : render_view_host_set)
5407 render_view_host->OnWebkitPreferencesChanged(); 5409 render_view_host->OnWebkitPreferencesChanged();
5408 } 5410 }
5409 5411
5410 } // namespace content 5412 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.h ('k') | content/common/accessibility_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698