OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2396 matching lines...) Loading... |
2407 bool is_content_initiated = | 2407 bool is_content_initiated = |
2408 NavigationState::FromDataSource(frame->provisionalDataSource())-> | 2408 NavigationState::FromDataSource(frame->provisionalDataSource())-> |
2409 is_content_initiated(); | 2409 is_content_initiated(); |
2410 | 2410 |
2411 // We only care about navigations that are within the current tab (as opposed | 2411 // We only care about navigations that are within the current tab (as opposed |
2412 // to, for example, opening a new window). | 2412 // to, for example, opening a new window). |
2413 // But we sometimes navigate to about:blank to clear a tab, and we want to | 2413 // But we sometimes navigate to about:blank to clear a tab, and we want to |
2414 // still allow that. | 2414 // still allow that. |
2415 if (default_policy == WebKit::WebNavigationPolicyCurrentTab && | 2415 if (default_policy == WebKit::WebNavigationPolicyCurrentTab && |
2416 is_content_initiated && frame->parent() == NULL && | 2416 is_content_initiated && frame->parent() == NULL && |
| 2417 type != WebKit::WebNavigationTypeFormSubmitted && |
2417 !url.SchemeIs(chrome::kAboutScheme)) { | 2418 !url.SchemeIs(chrome::kAboutScheme)) { |
2418 // When we received such unsolicited navigations, we sometimes want to | 2419 // When we received such unsolicited navigations, we sometimes want to |
2419 // punt them up to the browser to handle. | 2420 // punt them up to the browser to handle. |
2420 if (CrossesExtensionExtents(frame, url) || | 2421 if (CrossesExtensionExtents(frame, url) || |
2421 BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) || | 2422 BindingsPolicy::is_dom_ui_enabled(enabled_bindings_) || |
2422 frame->isViewSourceModeEnabled() || | 2423 frame->isViewSourceModeEnabled() || |
2423 url.SchemeIs(chrome::kViewSourceScheme)) { | 2424 url.SchemeIs(chrome::kViewSourceScheme)) { |
2424 OpenURL(url, GURL(), default_policy); | 2425 OpenURL(url, GURL(), default_policy); |
2425 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2426 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2426 } | 2427 } |
2427 | 2428 |
2428 // We forward navigations from extensions to the browser if they are | 2429 // We forward navigations from extensions to the browser if they are |
2429 // top-level events, even if the browser hasn't expressed interest. | 2430 // top-level events, even if the browser hasn't expressed interest. |
2430 // | 2431 // |
2431 // Note that we've already forwarded cross-extension extents navigations | 2432 // Note that we've already forwarded cross-extension extents navigations |
2432 // above. | 2433 // above. |
2433 if (BindingsPolicy::is_extension_enabled(enabled_bindings_) && | 2434 if (BindingsPolicy::is_extension_enabled(enabled_bindings_) && |
2434 IsNonLocalTopLevelNavigation(url, frame, type)) { | 2435 IsNonLocalTopLevelNavigation(url, frame, type)) { |
2435 OpenURL(url, GURL(), default_policy); | 2436 OpenURL(url, GURL(), default_policy); |
2436 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. | 2437 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. |
2437 } | 2438 } |
2438 } | 2439 } |
2439 | 2440 |
2440 // Detect when a page is "forking" a new tab that can be safely rendered in | 2441 // Detect when a page is "forking" a new tab that can be safely rendered in |
2441 // its own process. This is done by sites like Gmail that try to open links | 2442 // its own process. This is done by sites like Gmail that try to open links |
2442 // in new windows without script connections back to the original page. We | 2443 // in new windows without script connections back to the original page. We |
2443 // treat such cases as browser navigations (in which we will create a new | 2444 // treat such cases as browser navigations (in which we will create a new |
2444 // renderer for a cross-site navigation), rather than WebKit navigations. | 2445 // renderer for a cross-site navigation), rather than WebKit navigations. |
(...skipping 2704 matching lines...) Loading... |
5149 webkit_glue::FormData form; | 5150 webkit_glue::FormData form; |
5150 const WebInputElement element = node.toConst<WebInputElement>(); | 5151 const WebInputElement element = node.toConst<WebInputElement>(); |
5151 if (!form_manager_.FindFormWithFormControlElement( | 5152 if (!form_manager_.FindFormWithFormControlElement( |
5152 element, FormManager::REQUIRE_NONE, &form)) | 5153 element, FormManager::REQUIRE_NONE, &form)) |
5153 return; | 5154 return; |
5154 | 5155 |
5155 autofill_action_ = action; | 5156 autofill_action_ = action; |
5156 Send(new ViewHostMsg_FillAutoFillFormData( | 5157 Send(new ViewHostMsg_FillAutoFillFormData( |
5157 routing_id_, autofill_query_id_, form, value, label)); | 5158 routing_id_, autofill_query_id_, form, value, label)); |
5158 } | 5159 } |
OLD | NEW |