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