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

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

Issue 2694413006: Scope and clean up uses of AccessibilityMode. (Closed)
Patch Set: enum -> class Created 3 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
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 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 for (FrameTreeNode* node : frame_tree_.Nodes()) { 962 for (FrameTreeNode* node : frame_tree_.Nodes()) {
963 UpdateAccessibilityModeOnFrame(node->current_frame_host()); 963 UpdateAccessibilityModeOnFrame(node->current_frame_host());
964 RenderFrameHost* pending_frame_host = 964 RenderFrameHost* pending_frame_host =
965 node->render_manager()->pending_frame_host(); 965 node->render_manager()->pending_frame_host();
966 if (pending_frame_host) 966 if (pending_frame_host)
967 UpdateAccessibilityModeOnFrame(pending_frame_host); 967 UpdateAccessibilityModeOnFrame(pending_frame_host);
968 } 968 }
969 } 969 }
970 970
971 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { 971 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) {
972 SetAccessibilityMode(accessibility_mode_ | mode); 972 AccessibilityMode new_mode(accessibility_mode_);
973 new_mode.set(mode);
974 SetAccessibilityMode(new_mode);
973 } 975 }
974 976
975 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { 977 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) {
976 // Send a request to each of the frames in parallel. Each one will return 978 // Send a request to each of the frames in parallel. Each one will return
977 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine 979 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine
978 // them into a single tree and call |callback| with that result, then 980 // them into a single tree and call |callback| with that result, then
979 // delete |combiner|. 981 // delete |combiner|.
980 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); 982 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback);
981 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { 983 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) {
982 bool is_root = frame_tree_node->parent() == nullptr; 984 bool is_root = frame_tree_node->parent() == nullptr;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 1076
1075 for (auto& observer : observers_) 1077 for (auto& observer : observers_)
1076 observer.UserAgentOverrideSet(override); 1078 observer.UserAgentOverrideSet(override);
1077 } 1079 }
1078 1080
1079 const std::string& WebContentsImpl::GetUserAgentOverride() const { 1081 const std::string& WebContentsImpl::GetUserAgentOverride() const {
1080 return renderer_preferences_.user_agent_override; 1082 return renderer_preferences_.user_agent_override;
1081 } 1083 }
1082 1084
1083 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() { 1085 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() {
1084 if (GetAccessibilityMode() != AccessibilityModeOff) { 1086 if (GetAccessibilityMode() != AccessibilityMode::OFF) {
1085 for (RenderFrameHost* rfh : GetAllFrames()) 1087 for (RenderFrameHost* rfh : GetAllFrames())
1086 ResetAccessibility(rfh); 1088 ResetAccessibility(rfh);
1087 } else { 1089 } else {
1088 AddAccessibilityMode(ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY); 1090 AddAccessibilityMode(AccessibilityMode::WEB_CONTENTS_ONLY);
1089 } 1091 }
1090 } 1092 }
1091 1093
1092 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const { 1094 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const {
1093 return accessibility_mode_ == ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY; 1095 return accessibility_mode_ == AccessibilityMode::WEB_CONTENTS_ONLY;
1094 } 1096 }
1095 1097
1096 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { 1098 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const {
1097 return accessibility_mode_ == ACCESSIBILITY_MODE_COMPLETE; 1099 return accessibility_mode_ == AccessibilityMode::COMPLETE;
1098 } 1100 }
1099 1101
1100 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const { 1102 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const {
1101 return page_importance_signals_; 1103 return page_importance_signals_;
1102 } 1104 }
1103 1105
1104 const base::string16& WebContentsImpl::GetTitle() const { 1106 const base::string16& WebContentsImpl::GetTitle() const {
1105 // Transient entries take precedence. They are used for interstitial pages 1107 // Transient entries take precedence. They are used for interstitial pages
1106 // that are shown on top of existing pages. 1108 // that are shown on top of existing pages.
1107 NavigationEntry* entry = controller_.GetTransientEntry(); 1109 NavigationEntry* entry = controller_.GetTransientEntry();
(...skipping 4321 matching lines...) Expand 10 before | Expand all | Expand 10 after
5429 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); 5431 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host);
5430 if (!render_view_host) 5432 if (!render_view_host)
5431 continue; 5433 continue;
5432 render_view_host_set.insert(render_view_host); 5434 render_view_host_set.insert(render_view_host);
5433 } 5435 }
5434 for (RenderViewHost* render_view_host : render_view_host_set) 5436 for (RenderViewHost* render_view_host : render_view_host_set)
5435 render_view_host->OnWebkitPreferencesChanged(); 5437 render_view_host->OnWebkitPreferencesChanged();
5436 } 5438 }
5437 5439
5438 } // namespace content 5440 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698