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

Unified Diff: ios/chrome/browser/web/sad_tab_tab_helper.h

Issue 2807843002: Refactor creation of SadTabView into a tab helper object (Closed)
Patch Set: Change to delegate interface and other misc review changes. 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
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..9e7e4a08ad4ff6774be711d8cfdd5a4bbcaf0f37
--- /dev/null
+++ b/ios/chrome/browser/web/sad_tab_tab_helper.h
@@ -0,0 +1,40 @@
+// 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"
+#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
kkhorimoto 2017/04/11 02:13:15 Please finish comments with a period here and else
PL 2017/04/11 03:08:56 Done! (Maybe this is something we can have git cl
+class SadTabTabHelper : public web::WebStateUserData<SadTabTabHelper>,
+ public web::WebStateObserver {
+ public:
+ // Create a SadTabTabHelper and attach it to a specific web_state object,
+ // 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 an optional delegate
kkhorimoto 2017/04/11 02:13:15 Do we want the delegate to be optional? I can't t
PL 2017/04/11 03:08:56 Done. This made more sense when I had the notion o
+ SadTabTabHelper(web::WebState* web_state,
+ id<SadTabTabHelperDelegate> delegate);
+
+ // Deconstructor for SadTabTabHelper
+ ~SadTabTabHelper() override;
+
+ // A TabHelperDelegate that can control aspects of this tab helper's behavior
+ __weak id<SadTabTabHelperDelegate> delegate_;
+
+ // Presents a new SadTabView via the web_state object
+ void PresentSadTab(const GURL& url_causing_failure);
+
+ // WebStateObserver:
+ void RenderProcessGone() override;
+};

Powered by Google App Engine
This is Rietveld 408576698