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

Issue 2107743002: Add InfoBarPickerController for displaying a picker view from an infobar (Closed)

Created:
4 years, 5 months ago by Jackie Quinn
Modified:
4 years, 3 months ago
CC:
chromium-reviews, sdefresne+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@update_passwords_strings
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add InfoBarPickerController for displaying a picker view from an infobar Add InfoBarPickerController class for displaying a picker view upon tapping a link in an infobar. InfoBarPickerController presents a picker view and a navigation bar with "Cancel" and "Done" buttons. This is modeled after the picker view displayed in BeforeTranslateInfoBarController, and is meant to replace the implementation there and be shared with the upcoming update passwords infobar. BUG=622244

Patch Set 1 #

Total comments: 5

Patch Set 2 : InfoBarPickerView -> InfoBarPickerController #

Patch Set 3 : Delegate behavior #

Total comments: 8

Patch Set 4 : Rename InfoBarPickerController to InfoBarPickerViewController #

Unified diffs Side-by-side diffs Delta from patch set Stats (+316 lines, -5 lines) Patch
M ios/chrome/BUILD.gn View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M ios/chrome/browser/BUILD.gn View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
A ios/chrome/browser/infobars/infobar_picker_view_controller.h View 1 2 3 1 chunk +47 lines, -0 lines 0 comments Download
A ios/chrome/browser/infobars/infobar_picker_view_controller.mm View 1 2 3 1 chunk +136 lines, -0 lines 0 comments Download
A ios/chrome/browser/infobars/infobar_picker_view_controller_unittest.mm View 1 2 3 1 chunk +116 lines, -0 lines 0 comments Download
M ios/chrome/ios_chrome.gyp View 1 2 3 4 chunks +9 lines, -5 lines 0 comments Download
M ios/chrome/ios_chrome_tests.gyp View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download

Messages

Total messages: 12 (3 generated)
Jackie Quinn
4 years, 5 months ago (2016-06-28 10:52:14 UTC) #2
marq (ping after 24h)
https://codereview.chromium.org/2107743002/diff/1/ios/chrome/browser/infobars/infobar_picker_view.h File ios/chrome/browser/infobars/infobar_picker_view.h (right): https://codereview.chromium.org/2107743002/diff/1/ios/chrome/browser/infobars/infobar_picker_view.h#newcode12 ios/chrome/browser/infobars/infobar_picker_view.h:12: @protocol InfoBarPickerViewDelegate<NSObject> Instead of having a protocol for passing ...
4 years, 5 months ago (2016-06-28 13:43:18 UTC) #4
Jackie Quinn
https://codereview.chromium.org/2107743002/diff/1/ios/chrome/browser/infobars/infobar_picker_view.h File ios/chrome/browser/infobars/infobar_picker_view.h (right): https://codereview.chromium.org/2107743002/diff/1/ios/chrome/browser/infobars/infobar_picker_view.h#newcode20 ios/chrome/browser/infobars/infobar_picker_view.h:20: @property(nonatomic, weak) id<UIPickerViewDelegate> pickerDelegate; On 2016/06/28 13:43:18, marq wrote: ...
4 years, 5 months ago (2016-06-28 13:51:45 UTC) #5
marq (ping after 24h)
https://codereview.chromium.org/2107743002/diff/1/ios/chrome/browser/infobars/infobar_picker_view.h File ios/chrome/browser/infobars/infobar_picker_view.h (right): https://codereview.chromium.org/2107743002/diff/1/ios/chrome/browser/infobars/infobar_picker_view.h#newcode20 ios/chrome/browser/infobars/infobar_picker_view.h:20: @property(nonatomic, weak) id<UIPickerViewDelegate> pickerDelegate; On 2016/06/28 13:51:45, Jackie Quinn ...
4 years, 5 months ago (2016-06-28 14:43:21 UTC) #6
Jackie Quinn
Updated to be a UIViewController, and moved to target/action rather than delegate.
4 years, 5 months ago (2016-06-28 16:49:28 UTC) #8
Jackie Quinn
Added delegate protocol and incorporated UIPickerViewDataSource and UIPickerViewDelegate logic. PTAL.
4 years, 5 months ago (2016-06-30 11:55:21 UTC) #9
marq (ping after 24h)
First pass, I will pobably have some comments about the pickerView delegate and data source ...
4 years, 5 months ago (2016-06-30 16:10:11 UTC) #10
Jackie Quinn
https://codereview.chromium.org/2107743002/diff/40001/ios/chrome/browser/infobars/infobar_picker_controller.h File ios/chrome/browser/infobars/infobar_picker_controller.h (right): https://codereview.chromium.org/2107743002/diff/40001/ios/chrome/browser/infobars/infobar_picker_controller.h#newcode31 ios/chrome/browser/infobars/infobar_picker_controller.h:31: @interface InfoBarPickerController : UIViewController On 2016/06/30 16:10:11, marq wrote: ...
4 years, 5 months ago (2016-06-30 18:00:39 UTC) #11
marq (ping after 24h)
4 years, 5 months ago (2016-07-01 11:48:44 UTC) #12
https://codereview.chromium.org/2107743002/diff/40001/ios/chrome/browser/info...
File ios/chrome/browser/infobars/infobar_picker_controller.mm (right):

https://codereview.chromium.org/2107743002/diff/40001/ios/chrome/browser/info...
ios/chrome/browser/infobars/infobar_picker_controller.mm:38: _pickerView =
[[UIPickerView alloc] initWithFrame:CGRectZero];
On 2016/06/30 18:00:39, Jackie Quinn wrote:
> On 2016/06/30 16:10:11, marq wrote:
> >  View controllers usually create subviews in -viewDidLoad.
> 
> I created them originally to make sure delegate/target/action setting would
> happen properly. With what I suggested below, I'll move them to viewDidLoad.
Or
> maybe into loadView?

- loadView is called when a UIViewController's |view| property is accessed and
has a nil value. It should create the root view of the view controller's view
hierarchy and assign it to self.view. If this method isn't implemented and
there's a .xib file for the view controller, the view hierarchy is instantiated
from the .xib (we don't do this). If this method isn't implemented, a plain
UIView instance is created.

- viewDidLoad is called after the view hierarchy is loaded via -loadView, and
it's the expected place to perform "additional customization" of views. The
UIViewController docs recommend, if -loadView is being used to manually create a
root view (as it is here), that additional view initialization happens in
-viewDidLoad.

The additional view creation you're doing in loadView now is fine, since they
need to go inside the StackView, and it would be ugly to cast self.view into a
UIStackView later. But the view initialization in the -init can go into
viewDidLoad.

https://codereview.chromium.org/2107743002/diff/40001/ios/chrome/browser/info...
ios/chrome/browser/infobars/infobar_picker_controller.mm:79:
self.doneButton.target = target;
On 2016/06/30 18:00:39, Jackie Quinn wrote:
> On 2016/06/30 16:10:11, marq wrote:
> > This (and its companion method) should never be necessary. 
> > 
> > The view controller owns a view, and it should either handle the actions
sent
> by
> > its views, or they should be forwarded up the responder chain.
> > 
> > The controls should set a target of nil and an action selector that's either
> > defined and implemented in this class, or is implemented in a view
controller
> > further up in the responder chain. 
> 
> I agree... these seemed a bit silly to me. I didn't really understand your
> original comments. 
> 
> What happens when the ultimate responder isn't a view controller? In this case
> it's the infobar controller, which, sadly, is not a view controller. I could
> have this class respond and invoke delegate methods that looks more like
> infoBarPickerViewController:dismissWithSelection: or something like that,
would
> that work?

This is one problem we have with having these not-really-a-view-controller
controllers around. The next item in the responder chain will actually be the
application's root view controller, since that's what's presenting this VC.

Instead of explaining what I had in mind here, I'll add this as a (very good)
example in the Coordinators document.

Powered by Google App Engine
This is Rietveld 408576698