Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.mm

Issue 2815913004: Use ScopedObserver with WebStateListObserverBridge in FIP mediator (Closed)
Patch Set: Fix reference Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.mm
diff --git a/ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.mm b/ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.mm
index c5f7900e326ac1958ddfbd7fda30af0f22da5f22..645e739fc9b2cdfb01a669a30ad2c6ec56efe9ab 100644
--- a/ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.mm
+++ b/ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.mm
@@ -5,6 +5,7 @@
#import "ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.h"
#include "base/memory/ptr_util.h"
+#include "base/scoped_observer.h"
#import "ios/chrome/browser/find_in_page/find_in_page_model.h"
#import "ios/chrome/browser/find_in_page/find_tab_helper.h"
#include "ios/chrome/browser/web_state_list/web_state_list.h"
@@ -36,6 +37,8 @@
// Observes the WebStateList so that this mediator can update the UI when the
// active WebState changes.
std::unique_ptr<WebStateListObserverBridge> _webStateListObserver;
+ std::unique_ptr<ScopedObserver<WebStateList, WebStateListObserverBridge>>
+ _scopedWebStateListObserver;
}
@synthesize dispatcher = _dispatcher;
@@ -55,15 +58,14 @@
_dispatcher = dispatcher;
_webStateListObserver = base::MakeUnique<WebStateListObserverBridge>(self);
- _webStateList->AddObserver(_webStateListObserver.get());
+ _scopedWebStateListObserver = base::MakeUnique<
+ ScopedObserver<WebStateList, WebStateListObserverBridge>>(
+ _webStateListObserver.get());
+ _scopedWebStateListObserver->Add(_webStateList);
}
return self;
}
-- (void)dealloc {
- _webStateList->RemoveObserver(_webStateListObserver.get());
-}
-
- (void)stopFinding {
web::WebState* webState = self.webStateList->GetActiveWebState();
FindTabHelper* helper = FindTabHelper::FromWebState(webState);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698