Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_mediator.h" | 5 #import "ios/clean/chrome/browser/ui/tab_collection/tab_collection_mediator.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/scoped_observer.h" | 8 #include "base/scoped_observer.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #import "ios/chrome/browser/web_state_list/web_state_list.h" | 10 #import "ios/chrome/browser/web_state_list/web_state_list.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 } | 42 } |
| 43 | 43 |
| 44 - (void)dealloc { | 44 - (void)dealloc { |
| 45 [self disconnect]; | 45 [self disconnect]; |
| 46 } | 46 } |
| 47 | 47 |
| 48 #pragma mark - Public | 48 #pragma mark - Public |
| 49 | 49 |
| 50 - (void)disconnect { | 50 - (void)disconnect { |
| 51 _webStateList = nullptr; | 51 _webStateList = nullptr; |
| 52 _webStateObserver.reset(); | 52 _scopedWebStateListObserver->RemoveAll(); |
|
sdefresne
2017/06/12 09:48:07
I don't understand the comment that ScopedObserver
marq (ping after 24h)
2017/06/13 08:18:53
Yeah, brain fart on my part.
Does it make sense t
sdefresne
2017/06/13 09:00:27
WebStateObserver is a weird observer that auto-unr
| |
| 53 } | 53 } |
| 54 | 54 |
| 55 #pragma mark - Properties | 55 #pragma mark - Properties |
| 56 | 56 |
| 57 - (void)setWebStateList:(WebStateList*)webStateList { | 57 - (void)setWebStateList:(WebStateList*)webStateList { |
| 58 DCHECK(webStateList); | 58 DCHECK(webStateList); |
| 59 _scopedWebStateListObserver->RemoveAll(); | 59 _scopedWebStateListObserver->RemoveAll(); |
| 60 _webStateList = webStateList; | 60 _webStateList = webStateList; |
| 61 _scopedWebStateListObserver->Add(_webStateList); | 61 _scopedWebStateListObserver->Add(_webStateList); |
| 62 _webStateObserver = base::MakeUnique<web::WebStateObserverBridge>( | 62 _webStateObserver = base::MakeUnique<web::WebStateObserverBridge>( |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 - (void)populateConsumerItems { | 167 - (void)populateConsumerItems { |
| 168 if (self.consumer && self.webStateList) { | 168 if (self.consumer && self.webStateList) { |
| 169 [self.consumer | 169 [self.consumer |
| 170 populateItems:[self | 170 populateItems:[self |
| 171 tabCollectionItemsFromWebStateList:self.webStateList] | 171 tabCollectionItemsFromWebStateList:self.webStateList] |
| 172 selectedIndex:self.webStateList->active_index()]; | 172 selectedIndex:self.webStateList->active_index()]; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 @end | 176 @end |
| OLD | NEW |