| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "android_webview/renderer/aw_content_renderer_client.h" | 5 #include "android_webview/renderer/aw_content_renderer_client.h" |
| 6 | 6 |
| 7 #include "android_webview/common/aw_resource.h" | 7 #include "android_webview/common/aw_resource.h" |
| 8 #include "android_webview/common/render_view_messages.h" | 8 #include "android_webview/common/render_view_messages.h" |
| 9 #include "android_webview/common/url_constants.h" | 9 #include "android_webview/common/url_constants.h" |
| 10 #include "android_webview/renderer/aw_content_settings_client.h" | 10 #include "android_webview/renderer/aw_content_settings_client.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 // Any navigation from loadUrl, and goBack/Forward are considered application- | 82 // Any navigation from loadUrl, and goBack/Forward are considered application- |
| 83 // initiated and hence will not yield a shouldOverrideUrlLoading() callback. | 83 // initiated and hence will not yield a shouldOverrideUrlLoading() callback. |
| 84 // Webview classic does not consider reload application-initiated so we | 84 // Webview classic does not consider reload application-initiated so we |
| 85 // continue the same behavior. | 85 // continue the same behavior. |
| 86 // TODO(sgurun) is_content_initiated is normally false for cross-origin | 86 // TODO(sgurun) is_content_initiated is normally false for cross-origin |
| 87 // navigations but since android_webview does not swap out renderers, this | 87 // navigations but since android_webview does not swap out renderers, this |
| 88 // works fine. This will stop working if android_webview starts swapping out | 88 // works fine. This will stop working if android_webview starts swapping out |
| 89 // renderers on navigation. | 89 // renderers on navigation. |
| 90 bool application_initiated = | 90 bool application_initiated = |
| 91 !document_state->navigation_state()->is_content_initiated() | 91 !document_state->navigation_state()->IsContentInitiated() || |
| 92 || type == blink::WebNavigationTypeBackForward; | 92 type == blink::WebNavigationTypeBackForward; |
| 93 | 93 |
| 94 // Don't offer application-initiated navigations unless it's a redirect. | 94 // Don't offer application-initiated navigations unless it's a redirect. |
| 95 if (application_initiated && !is_redirect) | 95 if (application_initiated && !is_redirect) |
| 96 return false; | 96 return false; |
| 97 | 97 |
| 98 const GURL& gurl = request.url(); | 98 const GURL& gurl = request.url(); |
| 99 // For HTTP schemes, only top-level navigations can be overridden. Similarly, | 99 // For HTTP schemes, only top-level navigations can be overridden. Similarly, |
| 100 // WebView Classic lets app override only top level about:blank navigations. | 100 // WebView Classic lets app override only top level about:blank navigations. |
| 101 // So we filter out non-top about:blank navigations here. | 101 // So we filter out non-top about:blank navigations here. |
| 102 if (frame->parent() && | 102 if (frame->parent() && |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 bool AwContentRendererClient::ShouldOverridePageVisibilityState( | 207 bool AwContentRendererClient::ShouldOverridePageVisibilityState( |
| 208 const content::RenderFrame* render_frame, | 208 const content::RenderFrame* render_frame, |
| 209 blink::WebPageVisibilityState* override_state) { | 209 blink::WebPageVisibilityState* override_state) { |
| 210 // webview is always visible due to rendering requirements. | 210 // webview is always visible due to rendering requirements. |
| 211 *override_state = blink::WebPageVisibilityStateVisible; | 211 *override_state = blink::WebPageVisibilityStateVisible; |
| 212 return true; | 212 return true; |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace android_webview | 215 } // namespace android_webview |
| OLD | NEW |