| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 #if BUILDFLAG(ENABLE_PLUGINS) | 166 #if BUILDFLAG(ENABLE_PLUGINS) |
| 167 #include "content/browser/media/session/pepper_playback_observer.h" | 167 #include "content/browser/media/session/pepper_playback_observer.h" |
| 168 #endif // ENABLE_PLUGINS | 168 #endif // ENABLE_PLUGINS |
| 169 | 169 |
| 170 namespace content { | 170 namespace content { |
| 171 namespace { | 171 namespace { |
| 172 | 172 |
| 173 const int kMinimumDelayBetweenLoadingUpdatesMS = 100; | 173 const int kMinimumDelayBetweenLoadingUpdatesMS = 100; |
| 174 const char kDotGoogleDotCom[] = ".google.com"; | 174 const char kDotGoogleDotCom[] = ".google.com"; |
| 175 | 175 |
| 176 const AccessibilityMode kAccessibilityModeWebContent( |
| 177 AccessibilityMode::kWebContents | AccessibilityMode::kInlineTextBoxes | |
| 178 AccessibilityMode::kScreenReader | |
| 179 AccessibilityMode::kHTML); |
| 180 |
| 176 #if defined(OS_ANDROID) | 181 #if defined(OS_ANDROID) |
| 177 const char kWebContentsAndroidKey[] = "web_contents_android"; | 182 const char kWebContentsAndroidKey[] = "web_contents_android"; |
| 178 #endif // OS_ANDROID | 183 #endif // OS_ANDROID |
| 179 | 184 |
| 180 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > | 185 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > |
| 181 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; | 186 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; |
| 182 | 187 |
| 183 void NotifyCacheOnIO( | 188 void NotifyCacheOnIO( |
| 184 scoped_refptr<net::URLRequestContextGetter> request_context, | 189 scoped_refptr<net::URLRequestContextGetter> request_context, |
| 185 const GURL& url, | 190 const GURL& url, |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 for (FrameTreeNode* node : frame_tree_.Nodes()) { | 967 for (FrameTreeNode* node : frame_tree_.Nodes()) { |
| 963 UpdateAccessibilityModeOnFrame(node->current_frame_host()); | 968 UpdateAccessibilityModeOnFrame(node->current_frame_host()); |
| 964 RenderFrameHost* pending_frame_host = | 969 RenderFrameHost* pending_frame_host = |
| 965 node->render_manager()->pending_frame_host(); | 970 node->render_manager()->pending_frame_host(); |
| 966 if (pending_frame_host) | 971 if (pending_frame_host) |
| 967 UpdateAccessibilityModeOnFrame(pending_frame_host); | 972 UpdateAccessibilityModeOnFrame(pending_frame_host); |
| 968 } | 973 } |
| 969 } | 974 } |
| 970 | 975 |
| 971 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { | 976 void WebContentsImpl::AddAccessibilityMode(AccessibilityMode mode) { |
| 972 SetAccessibilityMode(accessibility_mode_ | mode); | 977 AccessibilityMode new_mode(accessibility_mode_); |
| 978 new_mode |= mode; |
| 979 SetAccessibilityMode(new_mode); |
| 973 } | 980 } |
| 974 | 981 |
| 975 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { | 982 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { |
| 976 // Send a request to each of the frames in parallel. Each one will return | 983 // Send a request to each of the frames in parallel. Each one will return |
| 977 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine | 984 // an accessibility tree snapshot, and AXTreeSnapshotCombiner will combine |
| 978 // them into a single tree and call |callback| with that result, then | 985 // them into a single tree and call |callback| with that result, then |
| 979 // delete |combiner|. | 986 // delete |combiner|. |
| 980 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); | 987 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); |
| 981 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { | 988 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { |
| 982 bool is_root = frame_tree_node->parent() == nullptr; | 989 bool is_root = frame_tree_node->parent() == nullptr; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 | 1081 |
| 1075 for (auto& observer : observers_) | 1082 for (auto& observer : observers_) |
| 1076 observer.UserAgentOverrideSet(override); | 1083 observer.UserAgentOverrideSet(override); |
| 1077 } | 1084 } |
| 1078 | 1085 |
| 1079 const std::string& WebContentsImpl::GetUserAgentOverride() const { | 1086 const std::string& WebContentsImpl::GetUserAgentOverride() const { |
| 1080 return renderer_preferences_.user_agent_override; | 1087 return renderer_preferences_.user_agent_override; |
| 1081 } | 1088 } |
| 1082 | 1089 |
| 1083 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() { | 1090 void WebContentsImpl::EnableWebContentsOnlyAccessibilityMode() { |
| 1084 if (GetAccessibilityMode() != AccessibilityModeOff) { | 1091 const AccessibilityMode accessibility_mode_off(AccessibilityMode::kOff); |
| 1092 if (GetAccessibilityMode() != accessibility_mode_off) { |
| 1085 for (RenderFrameHost* rfh : GetAllFrames()) | 1093 for (RenderFrameHost* rfh : GetAllFrames()) |
| 1086 ResetAccessibility(rfh); | 1094 ResetAccessibility(rfh); |
| 1087 } else { | 1095 } else { |
| 1088 AddAccessibilityMode(ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY); | 1096 AddAccessibilityMode(kAccessibilityModeWebContent); |
| 1089 } | 1097 } |
| 1090 } | 1098 } |
| 1091 | 1099 |
| 1092 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const { | 1100 bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() const { |
| 1093 return accessibility_mode_ == ACCESSIBILITY_MODE_WEB_CONTENTS_ONLY; | 1101 return accessibility_mode_ == kAccessibilityModeWebContent; |
| 1094 } | 1102 } |
| 1095 | 1103 |
| 1096 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { | 1104 bool WebContentsImpl::IsFullAccessibilityModeForTesting() const { |
| 1097 return accessibility_mode_ == ACCESSIBILITY_MODE_COMPLETE; | 1105 AccessibilityMode complete_mode( |
| 1106 AccessibilityMode::kNativeAPIs | AccessibilityMode::kWebContents | |
| 1107 AccessibilityMode::kInlineTextBoxes | AccessibilityMode::kScreenReader | |
| 1108 AccessibilityMode::kHTML); |
| 1109 return accessibility_mode_ == complete_mode; |
| 1098 } | 1110 } |
| 1099 | 1111 |
| 1100 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const { | 1112 const PageImportanceSignals& WebContentsImpl::GetPageImportanceSignals() const { |
| 1101 return page_importance_signals_; | 1113 return page_importance_signals_; |
| 1102 } | 1114 } |
| 1103 | 1115 |
| 1104 const base::string16& WebContentsImpl::GetTitle() const { | 1116 const base::string16& WebContentsImpl::GetTitle() const { |
| 1105 // Transient entries take precedence. They are used for interstitial pages | 1117 // Transient entries take precedence. They are used for interstitial pages |
| 1106 // that are shown on top of existing pages. | 1118 // that are shown on top of existing pages. |
| 1107 NavigationEntry* entry = controller_.GetTransientEntry(); | 1119 NavigationEntry* entry = controller_.GetTransientEntry(); |
| (...skipping 4321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5429 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); | 5441 RenderViewHost* render_view_host = RenderViewHost::From(render_widget_host); |
| 5430 if (!render_view_host) | 5442 if (!render_view_host) |
| 5431 continue; | 5443 continue; |
| 5432 render_view_host_set.insert(render_view_host); | 5444 render_view_host_set.insert(render_view_host); |
| 5433 } | 5445 } |
| 5434 for (RenderViewHost* render_view_host : render_view_host_set) | 5446 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5435 render_view_host->OnWebkitPreferencesChanged(); | 5447 render_view_host->OnWebkitPreferencesChanged(); |
| 5436 } | 5448 } |
| 5437 | 5449 |
| 5438 } // namespace content | 5450 } // namespace content |
| OLD | NEW |