Index: ios/chrome/browser/web/sad_tab_tab_helper.h |
diff --git a/ios/chrome/browser/web/sad_tab_tab_helper.h b/ios/chrome/browser/web/sad_tab_tab_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..051d4e858248e7fa807a8a06485ac7348ce3f9c4 |
--- /dev/null |
+++ b/ios/chrome/browser/web/sad_tab_tab_helper.h |
@@ -0,0 +1,43 @@ |
+// 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. |
+ |
+#import "ios/chrome/browser/web/sad_tab_tab_helper_delegate.h" |
Eugene But (OOO till 7-30)
2017/04/11 15:17:00
nit: Would predeclaration be sufficient here?
C++
peterlaurens
2017/04/11 21:57:26
Yes! Done, thanks!
|
+#import "ios/web/public/web_state/web_state_observer.h" |
+#import "ios/web/public/web_state/web_state_user_data.h" |
+ |
+#if !defined(__has_feature) || !__has_feature(objc_arc) |
+#error "This file requires ARC support." |
+#endif |
+ |
+// SadTabTabHelper listens to RenderProcessGone events and presents a |
+// SadTabView view appropriately. |
+class SadTabTabHelper : public web::WebStateUserData<SadTabTabHelper>, |
+ public web::WebStateObserver { |
+ public: |
+ // Create a SadTabTabHelper and attach it to a specific web_state object, |
Eugene But (OOO till 7-30)
2017/04/11 15:17:00
s/Create/Creates s/attach/attaches
peterlaurens
2017/04/11 21:57:26
Done, thanks.
|
+ // an optional delegate object can be provided to control presentation. |
+ static void CreateForWebState(web::WebState* web_state, |
+ id<SadTabTabHelperDelegate> delegate); |
+ |
+ private: |
+ // Constructor for SadTabTabHelper, assigning the helper to a web_state and |
+ // providing a delegate. |
+ SadTabTabHelper(web::WebState* web_state, |
+ id<SadTabTabHelperDelegate> delegate); |
+ |
+ // WebStateUserData: |
+ explicit SadTabTabHelper(web::WebState* web_state); |
sdefresne
2017/04/11 08:17:39
You should be able to remove this constructor.
No
kkhorimoto
2017/04/11 17:38:02
Are you sure it would cause a compilation error?
peterlaurens
2017/04/11 21:57:27
Done. Can confirm that a compilation error occurs
|
+ |
+ // Deconstructor for SadTabTabHelper. |
Eugene But (OOO till 7-30)
2017/04/11 15:17:00
nit: do we need this comment? Technically it is "D
peterlaurens
2017/04/11 21:57:26
Done.
|
+ ~SadTabTabHelper() override; |
+ |
+ // A TabHelperDelegate that can control aspects of this tab helper's behavior. |
+ __weak id<SadTabTabHelperDelegate> delegate_; |
Eugene But (OOO till 7-30)
2017/04/11 15:17:00
Could you please move data member to the bottom (a
peterlaurens
2017/04/11 21:57:26
Done, thanks!
|
+ |
+ // Presents a new SadTabView via the web_state object. |
+ void PresentSadTab(const GURL& url_causing_failure); |
+ |
+ // WebStateObserver: |
+ void RenderProcessGone() override; |
+}; |