Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/reading_list/ios/reading_list_model_bridge_observer.h" | 5 #import "components/reading_list/ios/reading_list_model_bridge_observer.h" |
| 6 | 6 |
| 7 #include "components/reading_list/core/reading_list_entry.h" | 7 #include "components/reading_list/core/reading_list_entry.h" |
| 8 #include "components/reading_list/core/reading_list_model.h" | 8 #include "components/reading_list/core/reading_list_model.h" |
| 9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 11 #error "This file requires ARC support." | |
| 12 #endif | |
| 13 | |
| 10 ReadingListModelBridge::ReadingListModelBridge( | 14 ReadingListModelBridge::ReadingListModelBridge( |
| 11 id<ReadingListModelBridgeObserver> observer, | 15 id<ReadingListModelBridgeObserver> observer, |
| 12 ReadingListModel* model) | 16 ReadingListModel* model) |
| 13 : observer_(observer), model_(model) { | 17 : observer_(observer), model_(model) { |
|
noyau (Ping after 24h)
2017/05/29 11:57:59
This now has the side effect of retaining the mode
stkhapugin
2017/05/30 13:57:51
In reading_list_model_bridge_observer.h, replace:
lindsayw
2017/06/01 16:49:39
It won't build with __weak ReadingListModel* mod
stkhapugin
2017/06/01 16:58:43
Oh, disregard that then, turns out ReadingListMode
lindsayw
2017/06/02 14:13:08
I've added a toto to refactor the weak pointer. PT
| |
| 14 DCHECK(model); | 18 DCHECK(model); |
| 15 model_->AddObserver(this); | 19 model_->AddObserver(this); |
| 16 } | 20 } |
| 17 | 21 |
| 18 ReadingListModelBridge::~ReadingListModelBridge() { | 22 ReadingListModelBridge::~ReadingListModelBridge() { |
| 19 if (model_) { | 23 if (model_) { |
| 20 model_->RemoveObserver(this); | 24 model_->RemoveObserver(this); |
| 21 } | 25 } |
| 22 } | 26 } |
| 23 | 27 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 } | 99 } |
| 96 | 100 |
| 97 void ReadingListModelBridge::ReadingListWillUpdateEntry( | 101 void ReadingListModelBridge::ReadingListWillUpdateEntry( |
| 98 const ReadingListModel* model, | 102 const ReadingListModel* model, |
| 99 const GURL& url) { | 103 const GURL& url) { |
| 100 if ([observer_ | 104 if ([observer_ |
| 101 respondsToSelector:@selector(readingListModel:willUpdateEntry:)]) { | 105 respondsToSelector:@selector(readingListModel:willUpdateEntry:)]) { |
| 102 [observer_ readingListModel:model willUpdateEntry:url]; | 106 [observer_ readingListModel:model willUpdateEntry:url]; |
| 103 } | 107 } |
| 104 } | 108 } |
| OLD | NEW |