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

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: 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..55f83f440a3958097f886a7794face7b659a293e
--- /dev/null
+++ b/ios/chrome/browser/web/sad_tab_tab_helper.h
@@ -0,0 +1,35 @@
+// 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/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
+
+class SadTabTabHelper : public web::WebStateUserData<SadTabTabHelper>,
kkhorimoto 2017/04/10 22:31:09 Please add comments for this class
PL 2017/04/11 01:35:21 Done, thanks!
+ public web::WebStateObserver {
+ public:
+ explicit SadTabTabHelper(web::WebState* web_state);
+ SadTabTabHelper(web::WebState* web_state, id<TabHelperDelegate> delegate);
+ ~SadTabTabHelper() override;
kkhorimoto 2017/04/10 22:31:10 If we want to enforce that this object is created
PL 2017/04/11 01:35:21 Done: I don't need the first one, so I've taken th
+
+ static void CreateForWebState(web::WebState* web_state,
kkhorimoto 2017/04/10 22:31:09 Needs a comment.
PL 2017/04/11 01:35:21 Done, thank you!
+ id<TabHelperDelegate> delegate);
+
+ // A TabHelperDelegate that can control aspects of this tab helper's behavior
+ __weak id<TabHelperDelegate> delegate;
kkhorimoto 2017/04/10 22:31:10 C++ ivars require a trailing underscore. Also, we
Eugene But (OOO till 7-30) 2017/04/10 22:56:28 More on Access Control here: https://google.github
PL 2017/04/11 01:35:21 Done! I've made the delegate variable private. I'm
+
+ private:
+ // Presents a new SadTabView via the web_state object
+ void presentSadTab(const GURL& urlCausingFailure);
kkhorimoto 2017/04/10 22:31:09 s/urlCausingFailure/url_causing_failure
kkhorimoto 2017/04/10 22:31:10 s/presentSadTab/PresentSadTab
PL 2017/04/11 01:35:21 Done. My Objective-C is showing, thanks!
+
+ // An overridden callback that notifies SadTabTabHelper of a renderer crash
+ // via the web_state_observer superclass
+ void RenderProcessGone() override;
kkhorimoto 2017/04/10 22:31:09 Typically for overridden functions, we just commen
PL 2017/04/11 01:35:21 Done, thanks!
+
+ NSString* helperID();
+};

Powered by Google App Engine
This is Rietveld 408576698