| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 node->render_manager()->ClearRFHsPendingShutdown(); | 507 node->render_manager()->ClearRFHsPendingShutdown(); |
| 508 node->render_manager()->ClearWebUIInstances(); | 508 node->render_manager()->ClearWebUIInstances(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 for (RenderWidgetHostImpl* widget : created_widgets_) | 511 for (RenderWidgetHostImpl* widget : created_widgets_) |
| 512 widget->DetachDelegate(); | 512 widget->DetachDelegate(); |
| 513 created_widgets_.clear(); | 513 created_widgets_.clear(); |
| 514 | 514 |
| 515 // Clear out any JavaScript state. | 515 // Clear out any JavaScript state. |
| 516 if (dialog_manager_) { | 516 if (dialog_manager_) { |
| 517 // This object is being destructed, so make sure that no callbacks happen. | 517 dialog_manager_->CancelDialogs(this, /*reset_state=*/true); |
| 518 dialog_manager_->CancelDialogs(this, | |
| 519 true, // suppress_callbacks, | |
| 520 true); // reset_state | |
| 521 } | 518 } |
| 522 | 519 |
| 523 if (color_chooser_info_.get()) | 520 if (color_chooser_info_.get()) |
| 524 color_chooser_info_->chooser->End(); | 521 color_chooser_info_->chooser->End(); |
| 525 | 522 |
| 526 NotifyDisconnected(); | 523 NotifyDisconnected(); |
| 527 | 524 |
| 528 // Notify any observer that have a reference on this WebContents. | 525 // Notify any observer that have a reference on this WebContents. |
| 529 NotificationService::current()->Notify( | 526 NotificationService::current()->Notify( |
| 530 NOTIFICATION_WEB_CONTENTS_DESTROYED, | 527 NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 void WebContentsImpl::SendPageMessage(IPC::Message* msg) { | 888 void WebContentsImpl::SendPageMessage(IPC::Message* msg) { |
| 892 frame_tree_.root()->render_manager()->SendPageMessage(msg, nullptr); | 889 frame_tree_.root()->render_manager()->SendPageMessage(msg, nullptr); |
| 893 } | 890 } |
| 894 | 891 |
| 895 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { | 892 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { |
| 896 return GetRenderManager()->current_host(); | 893 return GetRenderManager()->current_host(); |
| 897 } | 894 } |
| 898 | 895 |
| 899 void WebContentsImpl::CancelActiveAndPendingDialogs() { | 896 void WebContentsImpl::CancelActiveAndPendingDialogs() { |
| 900 if (dialog_manager_) { | 897 if (dialog_manager_) { |
| 901 dialog_manager_->CancelDialogs(this, | 898 dialog_manager_->CancelDialogs(this, /*reset_state=*/false); |
| 902 false, // suppress_callbacks, | |
| 903 false); // reset_state | |
| 904 } | 899 } |
| 905 if (browser_plugin_embedder_) | 900 if (browser_plugin_embedder_) |
| 906 browser_plugin_embedder_->CancelGuestDialogs(); | 901 browser_plugin_embedder_->CancelGuestDialogs(); |
| 907 } | 902 } |
| 908 | 903 |
| 909 void WebContentsImpl::ClosePage() { | 904 void WebContentsImpl::ClosePage() { |
| 910 GetRenderViewHost()->ClosePage(); | 905 GetRenderViewHost()->ClosePage(); |
| 911 } | 906 } |
| 912 | 907 |
| 913 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { | 908 RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() const { |
| (...skipping 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3463 // initial page has been accessed. | 3458 // initial page has been accessed. |
| 3464 has_accessed_initial_document_ = false; | 3459 has_accessed_initial_document_ = false; |
| 3465 | 3460 |
| 3466 // If we navigate off the page, close all JavaScript dialogs. | 3461 // If we navigate off the page, close all JavaScript dialogs. |
| 3467 if (!details.is_in_page) | 3462 if (!details.is_in_page) |
| 3468 CancelActiveAndPendingDialogs(); | 3463 CancelActiveAndPendingDialogs(); |
| 3469 | 3464 |
| 3470 // If this is a user-initiated navigation, start allowing JavaScript dialogs | 3465 // If this is a user-initiated navigation, start allowing JavaScript dialogs |
| 3471 // again. | 3466 // again. |
| 3472 if (params.gesture == NavigationGestureUser && dialog_manager_) { | 3467 if (params.gesture == NavigationGestureUser && dialog_manager_) { |
| 3473 dialog_manager_->CancelDialogs(this, | 3468 dialog_manager_->CancelDialogs(this, /*reset_state=*/true); |
| 3474 false, // suppress_callbacks, | |
| 3475 true); // reset_state | |
| 3476 } | 3469 } |
| 3477 | 3470 |
| 3478 // Notify observers about navigation. | 3471 // Notify observers about navigation. |
| 3479 for (auto& observer : observers_) | 3472 for (auto& observer : observers_) |
| 3480 observer.DidNavigateAnyFrame(render_frame_host, details, params); | 3473 observer.DidNavigateAnyFrame(render_frame_host, details, params); |
| 3481 } | 3474 } |
| 3482 | 3475 |
| 3483 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { | 3476 void WebContentsImpl::SetMainFrameMimeType(const std::string& mime_type) { |
| 3484 contents_mime_type_ = mime_type; | 3477 contents_mime_type_ = mime_type; |
| 3485 } | 3478 } |
| (...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4935 void WebContentsImpl::CancelModalDialogsForRenderManager() { | 4928 void WebContentsImpl::CancelModalDialogsForRenderManager() { |
| 4936 // We need to cancel modal dialogs when doing a process swap, since the load | 4929 // We need to cancel modal dialogs when doing a process swap, since the load |
| 4937 // deferrer would prevent us from swapping out. We also clear the state | 4930 // deferrer would prevent us from swapping out. We also clear the state |
| 4938 // because this is a cross-process navigation, which means that it's a new | 4931 // because this is a cross-process navigation, which means that it's a new |
| 4939 // site that should not have to pay for the sins of its predecessor. | 4932 // site that should not have to pay for the sins of its predecessor. |
| 4940 // | 4933 // |
| 4941 // Note that we don't bother telling browser_plugin_embedder_ because the | 4934 // Note that we don't bother telling browser_plugin_embedder_ because the |
| 4942 // cross-process navigation will either destroy the browser plugins or not | 4935 // cross-process navigation will either destroy the browser plugins or not |
| 4943 // require their dialogs to close. | 4936 // require their dialogs to close. |
| 4944 if (dialog_manager_) { | 4937 if (dialog_manager_) { |
| 4945 dialog_manager_->CancelDialogs(this, | 4938 dialog_manager_->CancelDialogs(this, /*reset_state=*/true); |
| 4946 false, // suppress_callbacks, | |
| 4947 true); // reset_state | |
| 4948 } | 4939 } |
| 4949 } | 4940 } |
| 4950 | 4941 |
| 4951 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host, | 4942 void WebContentsImpl::NotifySwappedFromRenderManager(RenderFrameHost* old_host, |
| 4952 RenderFrameHost* new_host, | 4943 RenderFrameHost* new_host, |
| 4953 bool is_main_frame) { | 4944 bool is_main_frame) { |
| 4954 if (is_main_frame) { | 4945 if (is_main_frame) { |
| 4955 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr, | 4946 NotifyViewSwapped(old_host ? old_host->GetRenderViewHost() : nullptr, |
| 4956 new_host->GetRenderViewHost()); | 4947 new_host->GetRenderViewHost()); |
| 4957 | 4948 |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5420 GetMainFrame()->AddMessageToConsole( | 5411 GetMainFrame()->AddMessageToConsole( |
| 5421 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 5412 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 5422 base::StringPrintf("This site does not have a valid SSL " | 5413 base::StringPrintf("This site does not have a valid SSL " |
| 5423 "certificate! Without SSL, your site's and " | 5414 "certificate! Without SSL, your site's and " |
| 5424 "visitors' data is vulnerable to theft and " | 5415 "visitors' data is vulnerable to theft and " |
| 5425 "tampering. Get a valid SSL certificate before" | 5416 "tampering. Get a valid SSL certificate before" |
| 5426 " releasing your website to the public.")); | 5417 " releasing your website to the public.")); |
| 5427 } | 5418 } |
| 5428 | 5419 |
| 5429 } // namespace content | 5420 } // namespace content |
| OLD | NEW |