OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "ios/web/public/web_state/web_state_observer.h" |
| 6 #import "ios/web/public/web_state/web_state_user_data.h" |
| 7 |
| 8 @protocol SadTabTabHelperDelegate; |
| 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 14 // SadTabTabHelper listens to RenderProcessGone events and presents a |
| 15 // SadTabView view appropriately. |
| 16 class SadTabTabHelper : public web::WebStateUserData<SadTabTabHelper>, |
| 17 public web::WebStateObserver { |
| 18 public: |
| 19 // Creates a SadTabTabHelper and attaches it to a specific web_state object, |
| 20 // a delegate object controls presentation. |
| 21 static void CreateForWebState(web::WebState* web_state, |
| 22 id<SadTabTabHelperDelegate> delegate); |
| 23 |
| 24 private: |
| 25 // Constructor for SadTabTabHelper, assigning the helper to a web_state and |
| 26 // providing a delegate. |
| 27 SadTabTabHelper(web::WebState* web_state, |
| 28 id<SadTabTabHelperDelegate> delegate); |
| 29 |
| 30 ~SadTabTabHelper() override; |
| 31 |
| 32 // Presents a new SadTabView via the web_state object. |
| 33 void PresentSadTab(const GURL& url_causing_failure); |
| 34 |
| 35 // WebStateObserver: |
| 36 void RenderProcessGone() override; |
| 37 |
| 38 // A TabHelperDelegate that can control aspects of this tab helper's behavior. |
| 39 __weak id<SadTabTabHelperDelegate> delegate_; |
| 40 }; |
OLD | NEW |