Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 frame_tree_(new NavigatorImpl(&controller_, this), | 328 frame_tree_(new NavigatorImpl(&controller_, this), |
| 329 this, this, this, this), | 329 this, this, this, this), |
| 330 is_loading_(false), | 330 is_loading_(false), |
| 331 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 331 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
| 332 crashed_error_code_(0), | 332 crashed_error_code_(0), |
| 333 waiting_for_response_(false), | 333 waiting_for_response_(false), |
| 334 load_state_(net::LOAD_STATE_IDLE, base::string16()), | 334 load_state_(net::LOAD_STATE_IDLE, base::string16()), |
| 335 upload_size_(0), | 335 upload_size_(0), |
| 336 upload_position_(0), | 336 upload_position_(0), |
| 337 displayed_insecure_content_(false), | 337 displayed_insecure_content_(false), |
| 338 has_accessed_initial_document_(false), | |
| 338 capturer_count_(0), | 339 capturer_count_(0), |
| 339 should_normally_be_visible_(true), | 340 should_normally_be_visible_(true), |
| 340 is_being_destroyed_(false), | 341 is_being_destroyed_(false), |
| 341 notify_disconnection_(false), | 342 notify_disconnection_(false), |
| 342 dialog_manager_(NULL), | 343 dialog_manager_(NULL), |
| 343 is_showing_before_unload_dialog_(false), | 344 is_showing_before_unload_dialog_(false), |
| 344 last_active_time_(base::TimeTicks::Now()), | 345 last_active_time_(base::TimeTicks::Now()), |
| 345 closed_by_user_gesture_(false), | 346 closed_by_user_gesture_(false), |
| 346 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), | 347 minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
| 347 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), | 348 maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2458 if (delegate_) { | 2459 if (delegate_) { |
| 2459 delegate_->DidNavigateMainFramePostCommit(this); | 2460 delegate_->DidNavigateMainFramePostCommit(this); |
| 2460 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); | 2461 view_->SetOverscrollControllerEnabled(delegate_->CanOverscrollContent()); |
| 2461 } | 2462 } |
| 2462 } | 2463 } |
| 2463 | 2464 |
| 2464 void WebContentsImpl::DidNavigateAnyFramePostCommit( | 2465 void WebContentsImpl::DidNavigateAnyFramePostCommit( |
| 2465 RenderFrameHostImpl* render_frame_host, | 2466 RenderFrameHostImpl* render_frame_host, |
| 2466 const LoadCommittedDetails& details, | 2467 const LoadCommittedDetails& details, |
| 2467 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { | 2468 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { |
| 2469 // Now that something has committed, we don't need to track whether the | |
| 2470 // initial page has been accessed. | |
| 2471 has_accessed_initial_document_ = false; | |
|
Avi (use Gerrit)
2014/04/25 20:24:44
This is the only thing that I'm unsure about. DidN
Charlie Reis
2014/04/25 20:38:02
Yep, that should be fine. If anything I think thi
| |
| 2472 | |
| 2468 // If we navigate off the page, close all JavaScript dialogs. | 2473 // If we navigate off the page, close all JavaScript dialogs. |
| 2469 if (dialog_manager_ && !details.is_in_page) | 2474 if (dialog_manager_ && !details.is_in_page) |
| 2470 dialog_manager_->CancelActiveAndPendingDialogs(this); | 2475 dialog_manager_->CancelActiveAndPendingDialogs(this); |
| 2471 | 2476 |
| 2472 // Notify observers about navigation. | 2477 // Notify observers about navigation. |
| 2473 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2478 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2474 DidNavigateAnyFrame(details, params)); | 2479 DidNavigateAnyFrame(details, params)); |
| 2475 } | 2480 } |
| 2476 | 2481 |
| 2477 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { | 2482 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2844 BeforeFormRepostWarningShow()); | 2849 BeforeFormRepostWarningShow()); |
| 2845 } | 2850 } |
| 2846 | 2851 |
| 2847 | 2852 |
| 2848 void WebContentsImpl::ActivateAndShowRepostFormWarningDialog() { | 2853 void WebContentsImpl::ActivateAndShowRepostFormWarningDialog() { |
| 2849 Activate(); | 2854 Activate(); |
| 2850 if (delegate_) | 2855 if (delegate_) |
| 2851 delegate_->ShowRepostFormWarningDialog(this); | 2856 delegate_->ShowRepostFormWarningDialog(this); |
| 2852 } | 2857 } |
| 2853 | 2858 |
| 2859 bool WebContentsImpl::HasAccessedInitialDocument() { | |
| 2860 return has_accessed_initial_document_; | |
| 2861 } | |
| 2862 | |
| 2854 // Notifies the RenderWidgetHost instance about the fact that the page is | 2863 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 2855 // loading, or done loading. | 2864 // loading, or done loading. |
| 2856 void WebContentsImpl::SetIsLoading(RenderViewHost* render_view_host, | 2865 void WebContentsImpl::SetIsLoading(RenderViewHost* render_view_host, |
| 2857 bool is_loading, | 2866 bool is_loading, |
| 2858 bool to_different_document, | 2867 bool to_different_document, |
| 2859 LoadNotificationDetails* details) { | 2868 LoadNotificationDetails* details) { |
| 2860 if (is_loading == is_loading_) | 2869 if (is_loading == is_loading_) |
| 2861 return; | 2870 return; |
| 2862 | 2871 |
| 2863 if (!is_loading) { | 2872 if (!is_loading) { |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3407 opener_ = NULL; | 3416 opener_ = NULL; |
| 3408 } | 3417 } |
| 3409 | 3418 |
| 3410 // Notify all swapped out RenderViewHosts for this tab. This is important | 3419 // Notify all swapped out RenderViewHosts for this tab. This is important |
| 3411 // in case we go back to them, or if another window in those processes tries | 3420 // in case we go back to them, or if another window in those processes tries |
| 3412 // to access window.opener. | 3421 // to access window.opener. |
| 3413 GetRenderManager()->DidDisownOpener(rvh); | 3422 GetRenderManager()->DidDisownOpener(rvh); |
| 3414 } | 3423 } |
| 3415 | 3424 |
| 3416 void WebContentsImpl::DidAccessInitialDocument() { | 3425 void WebContentsImpl::DidAccessInitialDocument() { |
| 3426 has_accessed_initial_document_ = true; | |
| 3427 | |
| 3417 // We may have left a failed browser-initiated navigation in the address bar | 3428 // We may have left a failed browser-initiated navigation in the address bar |
| 3418 // to let the user edit it and try again. Clear it now that content might | 3429 // to let the user edit it and try again. Clear it now that content might |
| 3419 // show up underneath it. | 3430 // show up underneath it. |
| 3420 if (!IsLoading() && controller_.GetPendingEntry()) | 3431 if (!IsLoading() && controller_.GetPendingEntry()) |
| 3421 controller_.DiscardPendingEntry(); | 3432 controller_.DiscardPendingEntry(); |
| 3422 | 3433 |
| 3423 // Update the URL display. | 3434 // Update the URL display. |
| 3424 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); | 3435 NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); |
| 3425 } | 3436 } |
| 3426 | 3437 |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3893 | 3904 |
| 3894 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3905 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3895 if (!delegate_) | 3906 if (!delegate_) |
| 3896 return; | 3907 return; |
| 3897 const gfx::Size new_size = GetPreferredSize(); | 3908 const gfx::Size new_size = GetPreferredSize(); |
| 3898 if (new_size != old_size) | 3909 if (new_size != old_size) |
| 3899 delegate_->UpdatePreferredSize(this, new_size); | 3910 delegate_->UpdatePreferredSize(this, new_size); |
| 3900 } | 3911 } |
| 3901 | 3912 |
| 3902 } // namespace content | 3913 } // namespace content |
| OLD | NEW |