OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 // HACK!! This code suppresses javascript: URLs from being added to | 402 // HACK!! This code suppresses javascript: URLs from being added to |
403 // session history, which is what we want to do for javascript: URLs that | 403 // session history, which is what we want to do for javascript: URLs that |
404 // do not generate content. What we really need is a message from the | 404 // do not generate content. What we really need is a message from the |
405 // renderer telling us that a new page was not created. The same message | 405 // renderer telling us that a new page was not created. The same message |
406 // could be used for mailto: URLs and the like. | 406 // could be used for mailto: URLs and the like. |
407 if (entry.GetURL().SchemeIs(url::kJavaScriptScheme)) | 407 if (entry.GetURL().SchemeIs(url::kJavaScriptScheme)) |
408 return false; | 408 return false; |
409 } | 409 } |
410 | 410 |
411 // Notify observers about navigation. | 411 // Notify observers about navigation. |
412 if (delegate_) { | 412 if (delegate_) |
413 delegate_->DidStartNavigationToPendingEntry(dest_render_frame_host, | 413 delegate_->DidStartNavigationToPendingEntry(entry.GetURL(), reload_type); |
414 entry.GetURL(), | |
415 reload_type); | |
416 } | |
417 | 414 |
418 return true; | 415 return true; |
419 } | 416 } |
420 | 417 |
421 bool NavigatorImpl::NavigateToPendingEntry( | 418 bool NavigatorImpl::NavigateToPendingEntry( |
422 FrameTreeNode* frame_tree_node, | 419 FrameTreeNode* frame_tree_node, |
423 NavigationController::ReloadType reload_type) { | 420 NavigationController::ReloadType reload_type) { |
424 return NavigateToEntry( | 421 return NavigateToEntry( |
425 frame_tree_node, | 422 frame_tree_node, |
426 *NavigationEntryImpl::FromNavigationEntry(controller_->GetPendingEntry()), | 423 *NavigationEntryImpl::FromNavigationEntry(controller_->GetPendingEntry()), |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
852 // If there is an ongoing request, replace it. | 849 // If there is an ongoing request, replace it. |
853 navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass()); | 850 navigation_request_map_.set(frame_tree_node_id, navigation_request.Pass()); |
854 | 851 |
855 // Have the current renderer execute its beforeUnload event if needed. If it | 852 // Have the current renderer execute its beforeUnload event if needed. If it |
856 // is not needed (eg. the renderer is not live), BeginNavigation should get | 853 // is not needed (eg. the renderer is not live), BeginNavigation should get |
857 // called. | 854 // called. |
858 NavigationRequest* request_to_send = | 855 NavigationRequest* request_to_send = |
859 navigation_request_map_.get(frame_tree_node_id); | 856 navigation_request_map_.get(frame_tree_node_id); |
860 request_to_send->SetWaitingForRendererResponse(); | 857 request_to_send->SetWaitingForRendererResponse(); |
861 frame_tree_node->current_frame_host()->DispatchBeforeUnload(true); | 858 frame_tree_node->current_frame_host()->DispatchBeforeUnload(true); |
859 | |
860 if (delegate_) | |
clamy
2015/02/23 10:52:34
As in the comment in the header file, I don't thin
carlosk
2015/03/04 19:42:40
Change was moved to another CL.
| |
861 delegate_->DidStartNavigationToPendingEntry(entry.GetURL(), reload_type); | |
862 } | 862 } |
863 | 863 |
864 void NavigatorImpl::BeginNavigation(FrameTreeNode* frame_tree_node) { | 864 void NavigatorImpl::BeginNavigation(FrameTreeNode* frame_tree_node) { |
865 NavigationRequest* navigation_request = | 865 NavigationRequest* navigation_request = |
866 navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); | 866 navigation_request_map_.get(frame_tree_node->frame_tree_node_id()); |
867 | 867 |
868 // A browser-initiated navigation could have been cancelled while it was | 868 // A browser-initiated navigation could have been cancelled while it was |
869 // waiting for the BeforeUnload event to execute. | 869 // waiting for the BeforeUnload event to execute. |
870 if (!navigation_request) | 870 if (!navigation_request) |
871 return; | 871 return; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
926 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", | 926 "Navigation.TimeToCommit_ExistingRenderer_BeforeUnloadDiscounted", |
927 time_to_commit); | 927 time_to_commit); |
928 UMA_HISTOGRAM_TIMES( | 928 UMA_HISTOGRAM_TIMES( |
929 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", | 929 "Navigation.TimeToURLJobStart_ExistingRenderer_BeforeUnloadDiscounted", |
930 time_to_network); | 930 time_to_network); |
931 } | 931 } |
932 navigation_data_.reset(); | 932 navigation_data_.reset(); |
933 } | 933 } |
934 | 934 |
935 } // namespace content | 935 } // namespace content |
OLD | NEW |