Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 | 77 |
| 78 NavigationManagerImpl::~NavigationManagerImpl() { | 78 NavigationManagerImpl::~NavigationManagerImpl() { |
| 79 // The facade layer should be deleted before this object. | 79 // The facade layer should be deleted before this object. |
| 80 DCHECK(!facade_delegate_); | 80 DCHECK(!facade_delegate_); |
| 81 | 81 |
| 82 [session_controller_ setNavigationManager:nullptr]; | 82 [session_controller_ setNavigationManager:nullptr]; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void NavigationManagerImpl::SetSessionController( | 85 void NavigationManagerImpl::SetSessionController( |
| 86 CRWSessionController* session_controller) { | 86 CRWSessionController* session_controller) { |
| 87 session_controller_.reset([session_controller retain]); | 87 session_controller_.reset(session_controller); |
| 88 [session_controller_ setNavigationManager:this]; | 88 [session_controller_ setNavigationManager:this]; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void NavigationManagerImpl::InitializeSession(NSString* window_name, | 91 void NavigationManagerImpl::InitializeSession(NSString* window_name, |
| 92 NSString* opener_id, | 92 NSString* opener_id, |
| 93 BOOL opened_by_dom, | 93 BOOL opened_by_dom, |
| 94 int opener_navigation_index) { | 94 int opener_navigation_index) { |
| 95 SetSessionController([[[CRWSessionController alloc] | 95 SetSessionController([[CRWSessionController alloc] |
| 96 initWithWindowName:window_name | 96 initWithWindowName:window_name |
| 97 openerId:opener_id | 97 openerId:opener_id |
| 98 openedByDOM:opened_by_dom | 98 openedByDOM:opened_by_dom |
| 99 openerNavigationIndex:opener_navigation_index | 99 openerNavigationIndex:opener_navigation_index |
| 100 browserState:browser_state_] autorelease]); | 100 browserState:browser_state_]); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void NavigationManagerImpl::ReplaceSessionHistory( | 103 void NavigationManagerImpl::ReplaceSessionHistory( |
| 104 ScopedVector<web::NavigationItem> items, | 104 ScopedVector<web::NavigationItem> items, |
| 105 int current_index) { | 105 int current_index) { |
| 106 SetSessionController([[[CRWSessionController alloc] | 106 SetSessionController([[CRWSessionController alloc] |
| 107 initWithNavigationItems:std::move(items) | 107 initWithNavigationItems:std::move(items) |
| 108 currentIndex:current_index | 108 currentIndex:current_index |
| 109 browserState:browser_state_] autorelease]); | 109 browserState:browser_state_]); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void NavigationManagerImpl::SetFacadeDelegate( | 112 void NavigationManagerImpl::SetFacadeDelegate( |
| 113 NavigationManagerFacadeDelegate* facade_delegate) { | 113 NavigationManagerFacadeDelegate* facade_delegate) { |
| 114 facade_delegate_ = facade_delegate; | 114 facade_delegate_ = facade_delegate; |
| 115 } | 115 } |
| 116 | 116 |
| 117 NavigationManagerFacadeDelegate* NavigationManagerImpl::GetFacadeDelegate() | 117 NavigationManagerFacadeDelegate* NavigationManagerImpl::GetFacadeDelegate() |
| 118 const { | 118 const { |
| 119 return facade_delegate_; | 119 return facade_delegate_; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 NavigationManagerImpl::GetTransientURLRewriters() { | 315 NavigationManagerImpl::GetTransientURLRewriters() { |
| 316 return std::move(transient_url_rewriters_); | 316 return std::move(transient_url_rewriters_); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void NavigationManagerImpl::RemoveTransientURLRewriters() { | 319 void NavigationManagerImpl::RemoveTransientURLRewriters() { |
| 320 transient_url_rewriters_.reset(); | 320 transient_url_rewriters_.reset(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void NavigationManagerImpl::CopyState( | 323 void NavigationManagerImpl::CopyState( |
| 324 NavigationManagerImpl* navigation_manager) { | 324 NavigationManagerImpl* navigation_manager) { |
| 325 SetSessionController( | 325 SetSessionController([navigation_manager->GetSessionController() copy]); |
|
Eugene But (OOO till 7-30)
2016/08/01 21:13:48
This looks like a leak too.
stkhapugin
2016/08/18 17:09:36
Same here, ARC always balances retains and release
| |
| 326 [[navigation_manager->GetSessionController() copy] autorelease]); | |
| 327 } | 326 } |
| 328 | 327 |
| 329 } // namespace web | 328 } // namespace web |
| OLD | NEW |