| 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" | 
| 6 | 6 | 
| 7 #include <map> | 7 #include <map> | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" | 
| (...skipping 2703 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2714 | 2714 | 
| 2715   // Update the request time if WebKit has better knowledge of it. | 2715   // Update the request time if WebKit has better knowledge of it. | 
| 2716   if (document_state->request_time().is_null() && | 2716   if (document_state->request_time().is_null() && | 
| 2717           triggering_event_time != 0.0) { | 2717           triggering_event_time != 0.0) { | 
| 2718     document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); | 2718     document_state->set_request_time(Time::FromDoubleT(triggering_event_time)); | 
| 2719   } | 2719   } | 
| 2720 | 2720 | 
| 2721   // Start time is only set after request time. | 2721   // Start time is only set after request time. | 
| 2722   document_state->set_start_load_time(Time::Now()); | 2722   document_state->set_start_load_time(Time::Now()); | 
| 2723 | 2723 | 
|  | 2724   NavigationStateImpl* navigation_state = static_cast<NavigationStateImpl*>( | 
|  | 2725       document_state->navigation_state()); | 
| 2724   bool is_top_most = !frame->parent(); | 2726   bool is_top_most = !frame->parent(); | 
| 2725   if (is_top_most) { | 2727   if (is_top_most) { | 
| 2726     render_view_->set_navigation_gesture( | 2728     render_view_->set_navigation_gesture( | 
| 2727         WebUserGestureIndicator::isProcessingUserGesture() ? | 2729         WebUserGestureIndicator::isProcessingUserGesture() ? | 
| 2728             NavigationGestureUser : NavigationGestureAuto); | 2730             NavigationGestureUser : NavigationGestureAuto); | 
| 2729   } else if (ds->replacesCurrentHistoryItem()) { | 2731   } else if (ds->replacesCurrentHistoryItem()) { | 
| 2730     // Subframe navigations that don't add session history items must be | 2732     // Subframe navigations that don't add session history items must be | 
| 2731     // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we | 2733     // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we | 
| 2732     // handle loading of error pages. | 2734     // handle loading of error pages. | 
| 2733     static_cast<NavigationStateImpl*>(document_state->navigation_state()) | 2735     navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); | 
| 2734         ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); |  | 
| 2735   } | 2736   } | 
| 2736 | 2737 | 
|  | 2738   base::TimeTicks navigation_start = | 
|  | 2739       navigation_state->common_params().navigation_start; | 
|  | 2740   DCHECK(!navigation_start.is_null()); | 
|  | 2741 | 
| 2737   FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 2742   FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 
| 2738                     DidStartProvisionalLoad(frame)); | 2743                     DidStartProvisionalLoad(frame)); | 
| 2739   FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); | 2744   FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidStartProvisionalLoad()); | 
| 2740 | 2745 | 
| 2741   Send(new FrameHostMsg_DidStartProvisionalLoad(routing_id_, | 2746   Send(new FrameHostMsg_DidStartProvisionalLoad( | 
| 2742                                                 ds->request().url())); | 2747       routing_id_, ds->request().url(), navigation_start)); | 
| 2743 } | 2748 } | 
| 2744 | 2749 | 
| 2745 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 2750 void RenderFrameImpl::didReceiveServerRedirectForProvisionalLoad( | 
| 2746     blink::WebLocalFrame* frame) { | 2751     blink::WebLocalFrame* frame) { | 
| 2747   DCHECK(!frame_ || frame_ == frame); | 2752   DCHECK(!frame_ || frame_ == frame); | 
| 2748 | 2753 | 
| 2749   // We don't use HistoryController in OOPIF enabled modes. | 2754   // We don't use HistoryController in OOPIF enabled modes. | 
| 2750   if (SiteIsolationPolicy::UseSubframeNavigationEntries()) | 2755   if (SiteIsolationPolicy::UseSubframeNavigationEntries()) | 
| 2751     return; | 2756     return; | 
| 2752 | 2757 | 
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4343   RenderFrameImpl::PrepareRenderViewForNavigation( | 4348   RenderFrameImpl::PrepareRenderViewForNavigation( | 
| 4344       common_params.url, request_params, &is_reload, &cache_policy); | 4349       common_params.url, request_params, &is_reload, &cache_policy); | 
| 4345 | 4350 | 
| 4346   GetContentClient()->SetActiveURL(common_params.url); | 4351   GetContentClient()->SetActiveURL(common_params.url); | 
| 4347 | 4352 | 
| 4348   pending_navigation_params_.reset(new NavigationParams( | 4353   pending_navigation_params_.reset(new NavigationParams( | 
| 4349       common_params, StartNavigationParams(), request_params)); | 4354       common_params, StartNavigationParams(), request_params)); | 
| 4350 | 4355 | 
| 4351   // Inform the browser of the start of the provisional load. This is needed so | 4356   // Inform the browser of the start of the provisional load. This is needed so | 
| 4352   // that the load is properly tracked by the WebNavigation API. | 4357   // that the load is properly tracked by the WebNavigation API. | 
| 4353   Send( | 4358   Send(new FrameHostMsg_DidStartProvisionalLoad( | 
| 4354       new FrameHostMsg_DidStartProvisionalLoad(routing_id_, common_params.url)); | 4359       routing_id_, common_params.url, common_params.navigation_start)); | 
| 4355 | 4360 | 
| 4356   // Send the provisional load failure. | 4361   // Send the provisional load failure. | 
| 4357   blink::WebURLError error = | 4362   blink::WebURLError error = | 
| 4358       CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 4363       CreateWebURLError(common_params.url, has_stale_copy_in_cache, error_code); | 
| 4359   WebURLRequest failed_request = CreateURLRequestForNavigation( | 4364   WebURLRequest failed_request = CreateURLRequestForNavigation( | 
| 4360       common_params, scoped_ptr<StreamOverrideParameters>(), | 4365       common_params, scoped_ptr<StreamOverrideParameters>(), | 
| 4361       frame_->isViewSourceModeEnabled()); | 4366       frame_->isViewSourceModeEnabled()); | 
| 4362   SendFailedProvisionalLoad(failed_request, error, frame_); | 4367   SendFailedProvisionalLoad(failed_request, error, frame_); | 
| 4363 | 4368 | 
| 4364   if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 4369   if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { | 
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4678       new NavigationParams(common_params, start_params, request_params)); | 4683       new NavigationParams(common_params, start_params, request_params)); | 
| 4679 | 4684 | 
| 4680   // Unless the load is a WebFrameLoadType::Standard, this should remain | 4685   // Unless the load is a WebFrameLoadType::Standard, this should remain | 
| 4681   // uninitialized. It will be updated when the load type is determined to be | 4686   // uninitialized. It will be updated when the load type is determined to be | 
| 4682   // Standard, or after the previous document's unload handler has been | 4687   // Standard, or after the previous document's unload handler has been | 
| 4683   // triggered. This occurs in UpdateNavigationState. | 4688   // triggered. This occurs in UpdateNavigationState. | 
| 4684   // TODO(csharrison) See if we can always use the browser timestamp. | 4689   // TODO(csharrison) See if we can always use the browser timestamp. | 
| 4685   pending_navigation_params_->common_params.navigation_start = | 4690   pending_navigation_params_->common_params.navigation_start = | 
| 4686       base::TimeTicks(); | 4691       base::TimeTicks(); | 
| 4687 | 4692 | 
|  | 4693   // Unless the load is a WebFrameLoadType::Standard, this should remain | 
|  | 4694   // uninitialized. It will be updated when the load type is determined to be | 
|  | 4695   // Standard, or after the previous document's unload handler has been | 
|  | 4696   // triggered. This occurs in UpdateNavigationState. | 
|  | 4697   // TODO(csharrison) See if we can always use the browser timestamp. | 
|  | 4698   pending_navigation_params_->common_params.navigation_start = | 
|  | 4699       base::TimeTicks(); | 
|  | 4700 | 
| 4688   // Create parameters for a standard navigation. | 4701   // Create parameters for a standard navigation. | 
| 4689   blink::WebFrameLoadType load_type = blink::WebFrameLoadType::Standard; | 4702   blink::WebFrameLoadType load_type = blink::WebFrameLoadType::Standard; | 
| 4690   bool should_load_request = false; | 4703   bool should_load_request = false; | 
| 4691   WebHistoryItem item_for_history_navigation; | 4704   WebHistoryItem item_for_history_navigation; | 
| 4692   WebURLRequest request = CreateURLRequestForNavigation( | 4705   WebURLRequest request = CreateURLRequestForNavigation( | 
| 4693       common_params, stream_params.Pass(), frame_->isViewSourceModeEnabled()); | 4706       common_params, stream_params.Pass(), frame_->isViewSourceModeEnabled()); | 
| 4694 #if defined(OS_ANDROID) | 4707 #if defined(OS_ANDROID) | 
| 4695   request.setHasUserGesture(start_params.has_user_gesture); | 4708   request.setHasUserGesture(start_params.has_user_gesture); | 
| 4696 #endif | 4709 #endif | 
| 4697 | 4710 | 
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5360       media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5373       media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 
| 5361   scoped_refptr<media::AudioOutputDevice> device = | 5374   scoped_refptr<media::AudioOutputDevice> device = | 
| 5362       AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5375       AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 
| 5363                                           security_origin); | 5376                                           security_origin); | 
| 5364   media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5377   media::OutputDeviceStatus status = device->GetDeviceStatus(); | 
| 5365   device->Stop(); | 5378   device->Stop(); | 
| 5366   callback.Run(status); | 5379   callback.Run(status); | 
| 5367 } | 5380 } | 
| 5368 | 5381 | 
| 5369 }  // namespace content | 5382 }  // namespace content | 
| OLD | NEW | 
|---|