| 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 4381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4392 | 4392 |
| 4393 for (auto& observer : observers_) | 4393 for (auto& observer : observers_) |
| 4394 observer.RenderProcessGone(GetCrashedStatus()); | 4394 observer.RenderProcessGone(GetCrashedStatus()); |
| 4395 } | 4395 } |
| 4396 | 4396 |
| 4397 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { | 4397 void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { |
| 4398 for (auto& observer : observers_) | 4398 for (auto& observer : observers_) |
| 4399 observer.RenderViewDeleted(rvh); | 4399 observer.RenderViewDeleted(rvh); |
| 4400 } | 4400 } |
| 4401 | 4401 |
| 4402 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | |
| 4403 const PageState& page_state) { | |
| 4404 DCHECK(!SiteIsolationPolicy::UseSubframeNavigationEntries()); | |
| 4405 | |
| 4406 // Ensure that this state update comes from a RenderViewHost that belongs to | |
| 4407 // this WebContents. | |
| 4408 // TODO(nasko): This should go through RenderFrameHost. | |
| 4409 if (rvh->GetDelegate()->GetAsWebContents() != this) | |
| 4410 return; | |
| 4411 | |
| 4412 if (!rvh->GetMainFrame()) { | |
| 4413 // When UseSubframeNavigationEntries is turned off, state updates only come | |
| 4414 // in on main frames. When UseSubframeNavigationEntries is turned on, | |
| 4415 // UpdateStateForFrame() should have been called rather than this function. | |
| 4416 NOTREACHED(); | |
| 4417 return; | |
| 4418 } | |
| 4419 | |
| 4420 NavigationEntryImpl* entry = controller_.GetEntryWithUniqueID( | |
| 4421 static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame())->nav_entry_id()); | |
| 4422 | |
| 4423 if (page_state == entry->GetPageState()) | |
| 4424 return; // Nothing to update. | |
| 4425 entry->SetPageState(page_state); | |
| 4426 controller_.NotifyEntryChanged(entry); | |
| 4427 } | |
| 4428 | |
| 4429 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, | 4402 void WebContentsImpl::UpdateTargetURL(RenderViewHost* render_view_host, |
| 4430 const GURL& url) { | 4403 const GURL& url) { |
| 4431 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { | 4404 if (fullscreen_widget_routing_id_ != MSG_ROUTING_NONE) { |
| 4432 // If we're fullscreen only update the url if it's from the fullscreen | 4405 // If we're fullscreen only update the url if it's from the fullscreen |
| 4433 // renderer. | 4406 // renderer. |
| 4434 RenderWidgetHostView* fs = GetFullscreenRenderWidgetHostView(); | 4407 RenderWidgetHostView* fs = GetFullscreenRenderWidgetHostView(); |
| 4435 if (fs && fs->GetRenderWidgetHost() != render_view_host->GetWidget()) | 4408 if (fs && fs->GetRenderWidgetHost() != render_view_host->GetWidget()) |
| 4436 return; | 4409 return; |
| 4437 } | 4410 } |
| 4438 if (delegate_) | 4411 if (delegate_) |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4584 | 4557 |
| 4585 // TODO(avi): Remove. http://crbug.com/170921 | 4558 // TODO(avi): Remove. http://crbug.com/170921 |
| 4586 NotificationService::current()->Notify( | 4559 NotificationService::current()->Notify( |
| 4587 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 4560 NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 4588 Source<WebContents>(this), | 4561 Source<WebContents>(this), |
| 4589 NotificationService::NoDetails()); | 4562 NotificationService::NoDetails()); |
| 4590 } | 4563 } |
| 4591 | 4564 |
| 4592 void WebContentsImpl::UpdateStateForFrame(RenderFrameHost* render_frame_host, | 4565 void WebContentsImpl::UpdateStateForFrame(RenderFrameHost* render_frame_host, |
| 4593 const PageState& page_state) { | 4566 const PageState& page_state) { |
| 4594 DCHECK(SiteIsolationPolicy::UseSubframeNavigationEntries()); | |
| 4595 | |
| 4596 // The state update affects the last NavigationEntry associated with the given | 4567 // The state update affects the last NavigationEntry associated with the given |
| 4597 // |render_frame_host|. This may not be the last committed NavigationEntry (as | 4568 // |render_frame_host|. This may not be the last committed NavigationEntry (as |
| 4598 // in the case of an UpdateState from a frame being swapped out). We track | 4569 // in the case of an UpdateState from a frame being swapped out). We track |
| 4599 // which entry this is in the RenderFrameHost's nav_entry_id. | 4570 // which entry this is in the RenderFrameHost's nav_entry_id. |
| 4600 RenderFrameHostImpl* rfhi = | 4571 RenderFrameHostImpl* rfhi = |
| 4601 static_cast<RenderFrameHostImpl*>(render_frame_host); | 4572 static_cast<RenderFrameHostImpl*>(render_frame_host); |
| 4602 NavigationEntryImpl* entry = | 4573 NavigationEntryImpl* entry = |
| 4603 controller_.GetEntryWithUniqueID(rfhi->nav_entry_id()); | 4574 controller_.GetEntryWithUniqueID(rfhi->nav_entry_id()); |
| 4604 if (!entry) | 4575 if (!entry) |
| 4605 return; | 4576 return; |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5421 GetMainFrame()->AddMessageToConsole( | 5392 GetMainFrame()->AddMessageToConsole( |
| 5422 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 5393 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 5423 base::StringPrintf("This site does not have a valid SSL " | 5394 base::StringPrintf("This site does not have a valid SSL " |
| 5424 "certificate! Without SSL, your site's and " | 5395 "certificate! Without SSL, your site's and " |
| 5425 "visitors' data is vulnerable to theft and " | 5396 "visitors' data is vulnerable to theft and " |
| 5426 "tampering. Get a valid SSL certificate before" | 5397 "tampering. Get a valid SSL certificate before" |
| 5427 " releasing your website to the public.")); | 5398 " releasing your website to the public.")); |
| 5428 } | 5399 } |
| 5429 | 5400 |
| 5430 } // namespace content | 5401 } // namespace content |
| OLD | NEW |