OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" // Temporary | 10 #include "base/strings/string_number_conversions.h" // Temporary |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "content/browser/browser_url_handler_impl.h" | 14 #include "content/browser/browser_url_handler_impl.h" |
15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 15 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 16 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
17 #include "content/browser/frame_host/debug_urls.h" | 17 #include "content/browser/frame_host/debug_urls.h" |
18 #include "content/browser/frame_host/interstitial_page_impl.h" | 18 #include "content/browser/frame_host/interstitial_page_impl.h" |
19 #include "content/browser/frame_host/navigation_entry_impl.h" | 19 #include "content/browser/frame_host/navigation_entry_impl.h" |
20 #include "content/browser/frame_host/web_contents_screenshot_manager.h" | 20 #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" |
21 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary | 21 #include "content/browser/renderer_host/render_view_host_impl.h" // Temporary |
22 #include "content/browser/site_instance_impl.h" | 22 #include "content/browser/site_instance_impl.h" |
23 #include "content/common/view_messages.h" | 23 #include "content/common/view_messages.h" |
24 #include "content/public/browser/browser_context.h" | 24 #include "content/public/browser/browser_context.h" |
25 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
26 #include "content/public/browser/invalidate_type.h" | 26 #include "content/public/browser/invalidate_type.h" |
27 #include "content/public/browser/navigation_details.h" | 27 #include "content/public/browser/navigation_details.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/notification_types.h" | 29 #include "content/public/browser/notification_types.h" |
30 #include "content/public/browser/render_widget_host.h" | 30 #include "content/public/browser/render_widget_host.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 last_committed_entry_index_(-1), | 202 last_committed_entry_index_(-1), |
203 pending_entry_index_(-1), | 203 pending_entry_index_(-1), |
204 transient_entry_index_(-1), | 204 transient_entry_index_(-1), |
205 delegate_(delegate), | 205 delegate_(delegate), |
206 max_restored_page_id_(-1), | 206 max_restored_page_id_(-1), |
207 ssl_manager_(this), | 207 ssl_manager_(this), |
208 needs_reload_(false), | 208 needs_reload_(false), |
209 is_initial_navigation_(true), | 209 is_initial_navigation_(true), |
210 pending_reload_(NO_RELOAD), | 210 pending_reload_(NO_RELOAD), |
211 get_timestamp_callback_(base::Bind(&base::Time::Now)), | 211 get_timestamp_callback_(base::Bind(&base::Time::Now)), |
212 screenshot_manager_(new WebContentsScreenshotManager(this)) { | 212 screenshot_manager_(new NavigationEntryScreenshotManager(this)) { |
213 DCHECK(browser_context_); | 213 DCHECK(browser_context_); |
214 } | 214 } |
215 | 215 |
216 NavigationControllerImpl::~NavigationControllerImpl() { | 216 NavigationControllerImpl::~NavigationControllerImpl() { |
217 DiscardNonCommittedEntriesInternal(); | 217 DiscardNonCommittedEntriesInternal(); |
218 } | 218 } |
219 | 219 |
220 WebContents* NavigationControllerImpl::GetWebContents() const { | 220 WebContents* NavigationControllerImpl::GetWebContents() const { |
221 return delegate_->GetWebContents(); | 221 return delegate_->GetWebContents(); |
222 } | 222 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 int NavigationControllerImpl::GetIndexForOffset(int offset) const { | 499 int NavigationControllerImpl::GetIndexForOffset(int offset) const { |
500 return GetCurrentEntryIndex() + offset; | 500 return GetCurrentEntryIndex() + offset; |
501 } | 501 } |
502 | 502 |
503 void NavigationControllerImpl::TakeScreenshot() { | 503 void NavigationControllerImpl::TakeScreenshot() { |
504 screenshot_manager_->TakeScreenshot(); | 504 screenshot_manager_->TakeScreenshot(); |
505 } | 505 } |
506 | 506 |
507 void NavigationControllerImpl::SetScreenshotManager( | 507 void NavigationControllerImpl::SetScreenshotManager( |
508 WebContentsScreenshotManager* manager) { | 508 NavigationEntryScreenshotManager* manager) { |
509 screenshot_manager_.reset(manager ? manager : | 509 screenshot_manager_.reset(manager ? manager : |
510 new WebContentsScreenshotManager(this)); | 510 new NavigationEntryScreenshotManager(this)); |
511 } | 511 } |
512 | 512 |
513 bool NavigationControllerImpl::CanGoBack() const { | 513 bool NavigationControllerImpl::CanGoBack() const { |
514 return entries_.size() > 1 && GetCurrentEntryIndex() > 0; | 514 return entries_.size() > 1 && GetCurrentEntryIndex() > 0; |
515 } | 515 } |
516 | 516 |
517 bool NavigationControllerImpl::CanGoForward() const { | 517 bool NavigationControllerImpl::CanGoForward() const { |
518 int index = GetCurrentEntryIndex(); | 518 int index = GetCurrentEntryIndex(); |
519 return index >= 0 && index < (static_cast<int>(entries_.size()) - 1); | 519 return index >= 0 && index < (static_cast<int>(entries_.size()) - 1); |
520 } | 520 } |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 } | 1691 } |
1692 } | 1692 } |
1693 } | 1693 } |
1694 | 1694 |
1695 void NavigationControllerImpl::SetGetTimestampCallbackForTest( | 1695 void NavigationControllerImpl::SetGetTimestampCallbackForTest( |
1696 const base::Callback<base::Time()>& get_timestamp_callback) { | 1696 const base::Callback<base::Time()>& get_timestamp_callback) { |
1697 get_timestamp_callback_ = get_timestamp_callback; | 1697 get_timestamp_callback_ = get_timestamp_callback; |
1698 } | 1698 } |
1699 | 1699 |
1700 } // namespace content | 1700 } // namespace content |
OLD | NEW |