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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 2831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 OnUpdateContentRestrictions(0); | 2842 OnUpdateContentRestrictions(0); |
2843 | 2843 |
2844 // Notify observers about navigation. | 2844 // Notify observers about navigation. |
2845 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2845 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
2846 DidStartLoading(render_view_host)); | 2846 DidStartLoading(render_view_host)); |
2847 } | 2847 } |
2848 | 2848 |
2849 void WebContentsImpl::DidStopLoading(RenderViewHost* render_view_host) { | 2849 void WebContentsImpl::DidStopLoading(RenderViewHost* render_view_host) { |
2850 scoped_ptr<LoadNotificationDetails> details; | 2850 scoped_ptr<LoadNotificationDetails> details; |
2851 | 2851 |
2852 NavigationEntry* entry = controller_.GetActiveEntry(); | 2852 // Use the last committed entry rather than the active one, in case a |
| 2853 // pending entry has been created. |
| 2854 NavigationEntry* entry = controller_.GetLastCommittedEntry(); |
| 2855 |
2853 // An entry may not exist for a stop when loading an initial blank page or | 2856 // An entry may not exist for a stop when loading an initial blank page or |
2854 // if an iframe injected by script into a blank page finishes loading. | 2857 // if an iframe injected by script into a blank page finishes loading. |
2855 if (entry) { | 2858 if (entry) { |
2856 base::TimeDelta elapsed = base::TimeTicks::Now() - current_load_start_; | 2859 base::TimeDelta elapsed = base::TimeTicks::Now() - current_load_start_; |
2857 | 2860 |
2858 details.reset(new LoadNotificationDetails( | 2861 details.reset(new LoadNotificationDetails( |
2859 entry->GetVirtualURL(), | 2862 entry->GetVirtualURL(), |
2860 entry->GetTransitionType(), | 2863 entry->GetTransitionType(), |
2861 elapsed, | 2864 elapsed, |
2862 &controller_, | 2865 &controller_, |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3406 } | 3409 } |
3407 | 3410 |
3408 BrowserPluginGuestManager* | 3411 BrowserPluginGuestManager* |
3409 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3412 WebContentsImpl::GetBrowserPluginGuestManager() const { |
3410 return static_cast<BrowserPluginGuestManager*>( | 3413 return static_cast<BrowserPluginGuestManager*>( |
3411 GetBrowserContext()->GetUserData( | 3414 GetBrowserContext()->GetUserData( |
3412 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3415 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
3413 } | 3416 } |
3414 | 3417 |
3415 } // namespace content | 3418 } // namespace content |
OLD | NEW |