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

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

Issue 2642463002: Implemented FormResubmissionTabHelper. (Closed)
Patch Set: Moved FormResubmissionTabHelper::CreateForWebState to init Created 3 years, 11 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/form_resubmission_tab_helper.h
diff --git a/ios/chrome/browser/web/form_resubmission_tab_helper.h b/ios/chrome/browser/web/form_resubmission_tab_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..532ca58a7380b72aa26837e1f0bae88d7f3647b1
--- /dev/null
+++ b/ios/chrome/browser/web/form_resubmission_tab_helper.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef IOS_CHROME_BROWSER_WEB_FORM_RESUBMISSION_TAB_HELPER_H_
+#define IOS_CHROME_BROWSER_WEB_FORM_RESUBMISSION_TAB_HELPER_H_
+
+#include <CoreGraphics/CoreGraphics.h>
+
+#include "base/callback.h"
+#include "base/macros.h"
+#import "base/mac/scoped_nsobject.h"
+#include "ios/web/public/web_state/web_state_observer.h"
+#import "ios/web/public/web_state/web_state_user_data.h"
+
+@class FormResubmissionCoordinator;
+
+// Allows presenting form resubmission dialog. Listens to web::WebState activity
+// and dismisses the dialog when necessary.
+class FormResubmissionTabHelper
+ : public web::WebStateUserData<FormResubmissionTabHelper>,
+ public web::WebStateObserver {
+ public:
+ explicit FormResubmissionTabHelper(web::WebState* web_state);
+ ~FormResubmissionTabHelper() override;
+
+ // Presents Form Resubmission Dialog at the given |location|. |callback| is
+ // called with true if resubmission was confirmed and with false if it was
+ // cancelled.
+ void PresentFormResubmissionDialog(
+ CGPoint location,
+ const base::Callback<void(bool)>& callback);
+
+ private:
+ // web::WebStateObserver overrides:
+ void ProvisionalNavigationStarted(const GURL&) override;
+ void WebStateDestroyed() override;
+
+ // Coordinates Form Resubmission dialog presentation.
+ base::scoped_nsobject<FormResubmissionCoordinator> coordinator_;
+
+ DISALLOW_COPY_AND_ASSIGN(FormResubmissionTabHelper);
+};
+
+#endif // IOS_CHROME_BROWSER_WEB_FORM_RESUBMISSION_TAB_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698