| 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 #ifndef IOS_CHROME_BROWSER_WEB_FORM_RESUBMISSION_TAB_HELPER_H_ |
| 6 #define IOS_CHROME_BROWSER_WEB_FORM_RESUBMISSION_TAB_HELPER_H_ |
| 7 |
| 8 #include <CoreGraphics/CoreGraphics.h> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/macros.h" |
| 12 #import "base/mac/scoped_nsobject.h" |
| 13 #include "ios/web/public/web_state/web_state_observer.h" |
| 14 #import "ios/web/public/web_state/web_state_user_data.h" |
| 15 |
| 16 @class FormResubmissionCoordinator; |
| 17 |
| 18 // Allows presenting form resubmission dialog. Listens to web::WebState activity |
| 19 // and dismisses the dialog when necessary. |
| 20 class FormResubmissionTabHelper |
| 21 : public web::WebStateUserData<FormResubmissionTabHelper>, |
| 22 public web::WebStateObserver { |
| 23 public: |
| 24 explicit FormResubmissionTabHelper(web::WebState* web_state); |
| 25 ~FormResubmissionTabHelper() override; |
| 26 |
| 27 // Presents Form Resubmission Dialog at the given |location|. |callback| is |
| 28 // called with true if resubmission was confirmed and with false if it was |
| 29 // cancelled. |
| 30 void PresentFormResubmissionDialog( |
| 31 CGPoint location, |
| 32 const base::Callback<void(bool)>& callback); |
| 33 |
| 34 private: |
| 35 // web::WebStateObserver overrides: |
| 36 void ProvisionalNavigationStarted(const GURL&) override; |
| 37 void WebStateDestroyed() override; |
| 38 |
| 39 // Coordinates Form Resubmission dialog presentation. |
| 40 base::scoped_nsobject<FormResubmissionCoordinator> coordinator_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(FormResubmissionTabHelper); |
| 43 }; |
| 44 |
| 45 #endif // IOS_CHROME_BROWSER_WEB_FORM_RESUBMISSION_TAB_HELPER_H_ |
| OLD | NEW |