| OLD | NEW |
| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 for (FrameTreeNode* node : frame_tree_.Nodes()) { | 961 for (FrameTreeNode* node : frame_tree_.Nodes()) { |
| 962 UpdateAccessibilityModeOnFrame(node->current_frame_host()); | 962 UpdateAccessibilityModeOnFrame(node->current_frame_host()); |
| 963 RenderFrameHost* pending_frame_host = | 963 RenderFrameHost* pending_frame_host = |
| 964 node->render_manager()->pending_frame_host(); | 964 node->render_manager()->pending_frame_host(); |
| 965 if (pending_frame_host) | 965 if (pending_frame_host) |
| 966 UpdateAccessibilityModeOnFrame(pending_frame_host); | 966 UpdateAccessibilityModeOnFrame(pending_frame_host); |
| 967 } | 967 } |
| 968 } | 968 } |
| 969 | 969 |
| 970 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { | 970 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { |
| 971 SetAccessibilityMode(accessibility_mode_ | mode); | 971 AccessibilityMode new_mode(accessibility_mode_); |
| 972 new_mode |= mode; |
| 973 SetAccessibilityMode(new_mode); |
| 972 } | 974 } |
| 973 | 975 |
| 974 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { | 976 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { |
| 975 // Send a request to each of the frames in parallel. Each one will return | 977 // Send a request to each of the frames in parallel. Each one will return |
| 976 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine | 978 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine |
| 977 // them into a single tree and call |callback| with that result, then | 979 // them into a single tree and call |callback| with that result, then |
| 978 // delete |combiner|. | 980 // delete |combiner|. |
| 979 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); | 981 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); |
| 980 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { | 982 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { |
| 981 bool is_root = frame_tree_node->parent() == nullptr; | 983 bool is_root = frame_tree_node->parent() == nullptr; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 | 1075 |
| 1074 for (auto& observer : observers_) | 1076 for (auto& observer : observers_) |
| 1075 observer.UserAgentOverrideSet(override); | 1077 observer.UserAgentOverrideSet(override); |
| 1076 } | 1078 } |
| 1077 | 1079 |
| 1078 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 1080 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
| 1079 return renderer_preferences_.user_agent_override; | 1081 return renderer_preferences_.user_agent_override; |
| 1080 } | 1082 } |
| 1081 | 1083 |
| 1082 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() { | 1084 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() { |
| 1083 if (GetAccessibilityMode() != AccessibilityModeOff) { | 1085 if (!GetAccessibilityMode().is_mode_off()) { |
| 1084 for (RenderFrameHost* rfh : GetAllFrames()) | 1086 for (RenderFrameHost* rfh : GetAllFrames()) |
| 1085 ResetAccessibility(rfh); | 1087 ResetAccessibility(rfh); |
| 1086 } else { | 1088 } else { |
| 1087 AddAccessibilityMode(ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY); | 1089 AddAccessibilityMode(kAccessibilityModeWebContentsOnly); |
| 1088 } | 1090 } |
| 1089 } | 1091 } |
| 1090 | 1092 |
| 1091 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const { | 1093 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const { |
| 1092 return accessibility_mode_ == ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY; | 1094 return accessibility_mode_ == kAccessibilityModeWebContentsOnly; |
| 1093 } | 1095 } |
| 1094 | 1096 |
| 1095 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { | 1097 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { |
| 1096 return accessibility_mode_ == ACCESSIBILITY_MODE_COMPLETE; | 1098 return accessibility_mode_ == kAccessibilityModeComplete; |
| 1097 } | 1099 } |
| 1098 | 1100 |
| 1099 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const { | 1101 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const { |
| 1100 return page_importance_signals_; | 1102 return page_importance_signals_; |
| 1101 } | 1103 } |
| 1102 | 1104 |
| 1103 const base::string16& WebContentsImpl::GetTitle() const { | 1105 const base::string16& WebContentsImpl::GetTitle() const { |
| 1104 // Transient entries take precedence. They are used for interstitial pages | 1106 // Transient entries take precedence. They are used for interstitial pages |
| 1105 // that are shown on top of existing pages. | 1107 // that are shown on top of existing pages. |
| 1106 NavigationEntry* entry = controller_.GetTransientEntry(); | 1108 NavigationEntry* entry = controller_.GetTransientEntry(); |
| (...skipping 4312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5419 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5421 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5420 if (!render_view_host) | 5422 if (!render_view_host) |
| 5421 continue; | 5423 continue; |
| 5422 render_view_host_set.insert(render_view_host); | 5424 render_view_host_set.insert(render_view_host); |
| 5423 } | 5425 } |
| 5424 for (RenderViewHost* render_view_host : render_view_host_set) | 5426 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5425 render_view_host->OnWebkitPreferencesChanged(); | 5427 render_view_host->OnWebkitPreferencesChanged(); |
| 5426 } | 5428 } |
| 5427 | 5429 |
| 5428 } // namespace content | 5430 } // namespace content |
| OLD | NEW |