Index: ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.h |
diff --git a/ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.h b/ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..23796a7f0be640ab3523678a59e2a7f477537abc |
--- /dev/null |
+++ b/ios/clean/chrome/browser/ui/find_in_page/find_in_page_mediator.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef IOS_CLEAN_CHROME_BROWSER_UI_FIND_IN_PAGE_FIND_IN_PAGE_MEDIATOR_H_ |
+#define IOS_CLEAN_CHROME_BROWSER_UI_FIND_IN_PAGE_FIND_IN_PAGE_MEDIATOR_H_ |
+ |
+#include "base/macros.h" |
+#include "ios/shared/chrome/browser/tabs/web_state_list_observer.h" |
+#include "ios/web/public/web_state/web_state_observer.h" |
+ |
+@protocol FindInPageConsumer; |
+@class FindInPageModel; |
+ |
+class WebStateList; |
+ |
+@protocol FindInPageMediatorDelegate |
+// Called when the mediator needs a non-nil consumer. Implementors must call |
+// set_consumer() with a non-nil consumer before returning. |
+- (void)createConsumer; |
rohitrao (ping after 24h)
2017/03/14 01:10:37
8) In general, feature code can trigger model quer
marq (ping after 24h)
2017/03/16 13:37:05
I'm not 100% happy with this pattern, but I'm not
rohitrao (ping after 24h)
2017/03/16 14:00:18
We'll also have the opposite scenario, where "mode
|
+@end |
+ |
+class FindInPageMediator : public WebStateListObserver { |
marq (ping after 24h)
2017/03/16 13:37:05
Other mediators are (so far) ObjC objects, so we s
rohitrao (ping after 24h)
2017/03/16 14:00:18
Is it important to be consistent across mediators,
marq (ping after 24h)
2017/03/17 14:45:33
On one hand, consistency. On the other hand, media
|
+ public: |
+ FindInPageMediator(WebStateList* web_state_list, |
+ id<FindInPageMediatorDelegate> delegate); |
+ ~FindInPageMediator() override; |
+ |
+ // Sets the consumer for this mediator. Can be called with nil, in cases |
+ // where there is no current consumer. |
+ void set_consumer(id<FindInPageConsumer> consumer) { consumer_ = consumer; } |
+ |
+ // Called when the model signals that new results are available. |
+ void OnFindInPageResultsAvailable(FindInPageModel* model); |
+ |
+ // web::WebStateListObserver implementation. |
lpromero
2017/03/14 17:17:56
WebStateListObserver doesn't seem to be in the web
rohitrao (ping after 24h)
2017/03/16 14:00:17
Cruft that will be useful once TabCoordinator stop
|
+ |
+ private: |
+ WebStateList* web_state_list_; |
marq (ping after 24h)
2017/03/16 13:37:05
Why does this need the list rather than a specific
rohitrao (ping after 24h)
2017/03/16 14:00:17
Once TabCoordinator supports multiple WebStates, t
marq (ping after 24h)
2017/03/17 14:45:33
Or should something else be that observer and just
rohitrao (ping after 24h)
2017/03/20 23:37:55
As you said, we can either farm this out and make
|
+ __strong id<FindInPageConsumer> consumer_; |
+ __weak id<FindInPageMediatorDelegate> delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FindInPageMediator); |
+}; |
+ |
+#endif // IOS_CLEAN_CHROME_BROWSER_UI_FIND_IN_PAGE_FIND_IN_PAGE_MEDIATOR_H_ |