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/navigation_controller_impl.h" | 5 #include "content/browser/web_contents/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 void NavigationControllerImpl::ContinuePendingReload() { | 359 void NavigationControllerImpl::ContinuePendingReload() { |
360 if (pending_reload_ == NO_RELOAD) { | 360 if (pending_reload_ == NO_RELOAD) { |
361 NOTREACHED(); | 361 NOTREACHED(); |
362 } else { | 362 } else { |
363 ReloadInternal(false, pending_reload_); | 363 ReloadInternal(false, pending_reload_); |
364 pending_reload_ = NO_RELOAD; | 364 pending_reload_ = NO_RELOAD; |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 bool NavigationControllerImpl::IsInitialNavigation() { | 368 bool NavigationControllerImpl::IsInitialNavigation() const { |
369 return is_initial_navigation_; | 369 return is_initial_navigation_; |
370 } | 370 } |
371 | 371 |
372 NavigationEntryImpl* NavigationControllerImpl::GetEntryWithPageID( | 372 NavigationEntryImpl* NavigationControllerImpl::GetEntryWithPageID( |
373 SiteInstance* instance, int32 page_id) const { | 373 SiteInstance* instance, int32 page_id) const { |
374 int index = GetEntryIndexWithPageID(instance, page_id); | 374 int index = GetEntryIndexWithPageID(instance, page_id); |
375 return (index != -1) ? entries_[index].get() : NULL; | 375 return (index != -1) ? entries_[index].get() : NULL; |
376 } | 376 } |
377 | 377 |
378 void NavigationControllerImpl::LoadEntry(NavigationEntryImpl* entry) { | 378 void NavigationControllerImpl::LoadEntry(NavigationEntryImpl* entry) { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 entry->SetCanLoadLocalResources(params.can_load_local_resources); | 818 entry->SetCanLoadLocalResources(params.can_load_local_resources); |
819 break; | 819 break; |
820 default: | 820 default: |
821 NOTREACHED(); | 821 NOTREACHED(); |
822 break; | 822 break; |
823 }; | 823 }; |
824 | 824 |
825 LoadEntry(entry); | 825 LoadEntry(entry); |
826 } | 826 } |
827 | 827 |
828 void NavigationControllerImpl::DocumentLoadedInFrame() { | |
829 is_initial_navigation_ = false; | |
830 } | |
831 | |
832 bool NavigationControllerImpl::RendererDidNavigate( | 828 bool NavigationControllerImpl::RendererDidNavigate( |
833 const ViewHostMsg_FrameNavigate_Params& params, | 829 const ViewHostMsg_FrameNavigate_Params& params, |
834 LoadCommittedDetails* details) { | 830 LoadCommittedDetails* details) { |
| 831 is_initial_navigation_ = false; |
| 832 |
835 // Save the previous state before we clobber it. | 833 // Save the previous state before we clobber it. |
836 if (GetLastCommittedEntry()) { | 834 if (GetLastCommittedEntry()) { |
837 details->previous_url = GetLastCommittedEntry()->GetURL(); | 835 details->previous_url = GetLastCommittedEntry()->GetURL(); |
838 details->previous_entry_index = GetLastCommittedEntryIndex(); | 836 details->previous_entry_index = GetLastCommittedEntryIndex(); |
839 } else { | 837 } else { |
840 details->previous_url = GURL(); | 838 details->previous_url = GURL(); |
841 details->previous_entry_index = -1; | 839 details->previous_entry_index = -1; |
842 } | 840 } |
843 | 841 |
844 // If we have a pending entry at this point, it should have a SiteInstance. | 842 // If we have a pending entry at this point, it should have a SiteInstance. |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 const base::Callback<base::Time()>& get_timestamp_callback) { | 1812 const base::Callback<base::Time()>& get_timestamp_callback) { |
1815 get_timestamp_callback_ = get_timestamp_callback; | 1813 get_timestamp_callback_ = get_timestamp_callback; |
1816 } | 1814 } |
1817 | 1815 |
1818 void NavigationControllerImpl::SetTakeScreenshotCallbackForTest( | 1816 void NavigationControllerImpl::SetTakeScreenshotCallbackForTest( |
1819 const base::Callback<void(RenderViewHost*)>& take_screenshot_callback) { | 1817 const base::Callback<void(RenderViewHost*)>& take_screenshot_callback) { |
1820 take_screenshot_callback_ = take_screenshot_callback; | 1818 take_screenshot_callback_ = take_screenshot_callback; |
1821 } | 1819 } |
1822 | 1820 |
1823 } // namespace content | 1821 } // namespace content |
OLD | NEW |