| 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 "ios/web/navigation/navigation_manager_impl.h" | 5 #include "ios/web/navigation/navigation_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "ios/web/navigation/crw_session_controller+private_constructors.h" | 8 #import "ios/web/navigation/crw_session_controller+private_constructors.h" |
| 9 #import "ios/web/navigation/crw_session_controller.h" | 9 #import "ios/web/navigation/crw_session_controller.h" |
| 10 #import "ios/web/navigation/crw_session_entry.h" | 10 #import "ios/web/navigation/crw_session_entry.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 url::Replacements<char> replacements; | 27 url::Replacements<char> replacements; |
| 28 replacements.ClearRef(); | 28 replacements.ClearRef(); |
| 29 return existing_url.ReplaceComponents(replacements) == | 29 return existing_url.ReplaceComponents(replacements) == |
| 30 new_url.ReplaceComponents(replacements); | 30 new_url.ReplaceComponents(replacements); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // anonymous namespace | 33 } // anonymous namespace |
| 34 | 34 |
| 35 namespace web { | 35 namespace web { |
| 36 | 36 |
| 37 NavigationManagerImpl::NavigationManagerImpl( | 37 NavigationManagerImpl::NavigationManagerImpl() |
| 38 NavigationManagerDelegate* delegate, | 38 : delegate_(nullptr), browser_state_(nullptr), facade_delegate_(nullptr) {} |
| 39 BrowserState* browser_state) | 39 |
| 40 : delegate_(delegate), | 40 NavigationManagerImpl::NavigationManagerImpl(const NavigationManagerImpl& other) |
| 41 browser_state_(browser_state), | 41 : delegate_(nullptr), |
| 42 facade_delegate_(nullptr) { | 42 browser_state_(other.browser_state_), |
| 43 DCHECK(browser_state_); | 43 session_controller_([other.session_controller_ copy]), |
| 44 facade_delegate_(nullptr) {} |
| 45 |
| 46 void NavigationManagerImpl::SetDelegate(NavigationManagerDelegate* delegate) { |
| 47 delegate_ = delegate; |
| 48 } |
| 49 |
| 50 void NavigationManagerImpl::SetBrowserState(BrowserState* browser_state) { |
| 51 browser_state_ = browser_state; |
| 44 } | 52 } |
| 45 | 53 |
| 46 NavigationManagerImpl::~NavigationManagerImpl() { | 54 NavigationManagerImpl::~NavigationManagerImpl() { |
| 47 // The facade layer should be deleted before this object. | 55 // The facade layer should be deleted before this object. |
| 48 DCHECK(!facade_delegate_); | 56 DCHECK(!facade_delegate_); |
| 49 | 57 |
| 50 [session_controller_ setNavigationManager:nullptr]; | 58 [session_controller_ setNavigationManager:nullptr]; |
| 51 } | 59 } |
| 52 | 60 |
| 53 CRWSessionController* NavigationManagerImpl::GetSessionController() { | 61 CRWSessionController* NavigationManagerImpl::GetSessionController() { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 74 | 82 |
| 75 void NavigationManagerImpl::ReplaceSessionHistory( | 83 void NavigationManagerImpl::ReplaceSessionHistory( |
| 76 ScopedVector<web::NavigationItem> items, | 84 ScopedVector<web::NavigationItem> items, |
| 77 int current_index) { | 85 int current_index) { |
| 78 SetSessionController([[[CRWSessionController alloc] | 86 SetSessionController([[[CRWSessionController alloc] |
| 79 initWithNavigationItems:items.Pass() | 87 initWithNavigationItems:items.Pass() |
| 80 currentIndex:current_index | 88 currentIndex:current_index |
| 81 browserState:browser_state_] autorelease]); | 89 browserState:browser_state_] autorelease]); |
| 82 } | 90 } |
| 83 | 91 |
| 92 scoped_ptr<NavigationManagerImpl> NavigationManagerImpl::CopyForSerialization() |
| 93 const { |
| 94 return scoped_ptr<NavigationManagerImpl>(new NavigationManagerImpl(*this)); |
| 95 } |
| 96 |
| 84 void NavigationManagerImpl::SetFacadeDelegate( | 97 void NavigationManagerImpl::SetFacadeDelegate( |
| 85 NavigationManagerFacadeDelegate* facade_delegate) { | 98 NavigationManagerFacadeDelegate* facade_delegate) { |
| 86 facade_delegate_ = facade_delegate; | 99 facade_delegate_ = facade_delegate; |
| 87 } | 100 } |
| 88 | 101 |
| 89 NavigationManagerFacadeDelegate* NavigationManagerImpl::GetFacadeDelegate() | 102 NavigationManagerFacadeDelegate* NavigationManagerImpl::GetFacadeDelegate() |
| 90 const { | 103 const { |
| 91 return facade_delegate_; | 104 return facade_delegate_; |
| 92 } | 105 } |
| 93 | 106 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 277 } |
| 265 | 278 |
| 266 void NavigationManagerImpl::CopyState( | 279 void NavigationManagerImpl::CopyState( |
| 267 NavigationManagerImpl* navigation_manager) { | 280 NavigationManagerImpl* navigation_manager) { |
| 268 SetSessionController( | 281 SetSessionController( |
| 269 [[navigation_manager->GetSessionController() copy] autorelease]); | 282 [[navigation_manager->GetSessionController() copy] autorelease]); |
| 270 } | 283 } |
| 271 | 284 |
| 272 } // namespace web | 285 } // namespace web |
| 273 | 286 |
| OLD | NEW |