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 <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3224 if (event_time != 0.0) | 3224 if (event_time != 0.0) |
3225 navigation_state->set_request_time(Time::FromDoubleT(event_time)); | 3225 navigation_state->set_request_time(Time::FromDoubleT(event_time)); |
3226 } | 3226 } |
3227 | 3227 |
3228 // Start time is only set after request time. | 3228 // Start time is only set after request time. |
3229 navigation_state->set_start_load_time(Time::Now()); | 3229 navigation_state->set_start_load_time(Time::Now()); |
3230 | 3230 |
3231 bool is_top_most = !frame->parent(); | 3231 bool is_top_most = !frame->parent(); |
3232 if (is_top_most) { | 3232 if (is_top_most) { |
3233 navigation_gesture_ = frame->isProcessingUserGesture() ? | 3233 navigation_gesture_ = frame->isProcessingUserGesture() ? |
3234 NavigationGestureUnknown : NavigationGestureAuto; | 3234 NavigationGestureUser : NavigationGestureAuto; |
3235 | 3235 |
3236 // Make sure redirect tracking state is clear for the new load. | 3236 // Make sure redirect tracking state is clear for the new load. |
3237 completed_client_redirect_src_ = GURL(); | 3237 completed_client_redirect_src_ = GURL(); |
3238 } else if (frame->parent()->isLoading()) { | 3238 } else if (frame->parent()->isLoading()) { |
3239 // Take note of AUTO_SUBFRAME loads here, so that we can know how to | 3239 // Take note of AUTO_SUBFRAME loads here, so that we can know how to |
3240 // load an error page. See didFailProvisionalLoad. | 3240 // load an error page. See didFailProvisionalLoad. |
3241 navigation_state->set_transition_type(PageTransition::AUTO_SUBFRAME); | 3241 navigation_state->set_transition_type(PageTransition::AUTO_SUBFRAME); |
3242 } | 3242 } |
3243 | 3243 |
3244 Send(new ViewHostMsg_DidStartProvisionalLoadForFrame( | 3244 Send(new ViewHostMsg_DidStartProvisionalLoadForFrame( |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3592 request.setCachePolicy(state->cache_policy_override()); | 3592 request.setCachePolicy(state->cache_policy_override()); |
3593 } | 3593 } |
3594 | 3594 |
3595 if (top_data_source) { | 3595 if (top_data_source) { |
3596 NavigationState* state = NavigationState::FromDataSource(top_data_source); | 3596 NavigationState* state = NavigationState::FromDataSource(top_data_source); |
3597 if (state && request.targetType() == WebURLRequest::TargetIsPrefetch) | 3597 if (state && request.targetType() == WebURLRequest::TargetIsPrefetch) |
3598 state->set_was_prefetcher(true); | 3598 state->set_was_prefetcher(true); |
3599 } | 3599 } |
3600 | 3600 |
3601 request.setRequestorID(routing_id_); | 3601 request.setRequestorID(routing_id_); |
| 3602 request.setHasUserGesture(frame->isProcessingUserGesture()); |
| 3603 |
3602 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoReferrers)) | 3604 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoReferrers)) |
3603 request.clearHTTPHeaderField("Referer"); | 3605 request.clearHTTPHeaderField("Referer"); |
3604 | 3606 |
3605 // Temporary metrics, see site_isolation_metrics.h | 3607 // Temporary metrics, see site_isolation_metrics.h |
3606 SiteIsolationMetrics::AddRequest(identifier, request.targetType()); | 3608 SiteIsolationMetrics::AddRequest(identifier, request.targetType()); |
3607 } | 3609 } |
3608 | 3610 |
3609 void RenderView::didReceiveResponse( | 3611 void RenderView::didReceiveResponse( |
3610 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { | 3612 WebFrame* frame, unsigned identifier, const WebURLResponse& response) { |
3611 | 3613 |
(...skipping 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5687 external_popup_menu_.reset(); | 5689 external_popup_menu_.reset(); |
5688 } | 5690 } |
5689 #endif | 5691 #endif |
5690 | 5692 |
5691 void RenderView::AddErrorToRootConsole(const string16& message) { | 5693 void RenderView::AddErrorToRootConsole(const string16& message) { |
5692 if (webview() && webview()->mainFrame()) { | 5694 if (webview() && webview()->mainFrame()) { |
5693 webview()->mainFrame()->addMessageToConsole( | 5695 webview()->mainFrame()->addMessageToConsole( |
5694 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5696 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
5695 } | 5697 } |
5696 } | 5698 } |
OLD | NEW |