Chromium Code Reviews| 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/chrome/browser/web/form_resubmission_tab_helper.h" | |
| 6 | |
| 7 #import "ios/chrome/browser/ui/alert_coordinator/form_resubmission_coordinator.h " | |
| 8 #import "ios/chrome/browser/ui/util/top_view_controller.h" | |
| 9 | |
| 10 DEFINE_WEB_STATE_USER_DATA_KEY(FormResubmissionTabHelper); | |
| 11 | |
| 12 FormResubmissionTabHelper::FormResubmissionTabHelper(web::WebState* web_state) | |
| 13 : web::WebStateObserver(web_state) {} | |
| 14 | |
| 15 FormResubmissionTabHelper::~FormResubmissionTabHelper() = default; | |
| 16 | |
| 17 void FormResubmissionTabHelper::PresentFormResubmissionDialog( | |
| 18 CGPoint location, | |
| 19 const base::Callback<void(bool)>& callback) { | |
| 20 UIViewController* top_controller = | |
|
marq (ping after 24h)
2017/01/18 11:54:19
I'm fine with this as a refactoring step, but this
Eugene But (OOO till 7-30)
2017/01/18 16:13:24
With my next refactoring step, PresentFormResubmis
| |
| 21 top_view_controller::TopPresentedViewControllerFrom( | |
| 22 [UIApplication sharedApplication].keyWindow.rootViewController); | |
| 23 | |
| 24 base::Callback<void(bool)> local_callback(callback); | |
| 25 coordinator_.reset([[FormResubmissionCoordinator alloc] | |
| 26 initWithBaseViewController:top_controller | |
| 27 dialogLocation:location | |
| 28 webState:web_state() | |
| 29 completionHandler:^(BOOL should_continue) { | |
| 30 local_callback.Run(should_continue); | |
| 31 }]); | |
| 32 [coordinator_ start]; | |
| 33 } | |
| 34 | |
| 35 void FormResubmissionTabHelper::ProvisionalNavigationStarted(const GURL&) { | |
| 36 coordinator_.reset(); | |
| 37 } | |
| 38 | |
| 39 void FormResubmissionTabHelper::WebStateDestroyed() { | |
| 40 coordinator_.reset(); | |
| 41 } | |
| OLD | NEW |