[iOS] Implement camera in custom file upload panel [chromium/src : main]

0 views
Skip to first unread message

Quentin Pubert (Gerrit)

unread,
Nov 5, 2025, 8:20:58 AM (2 days ago) Nov 5
to Olivier Robin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, srahim...@chromium.org
Attention needed from Olivier Robin

Quentin Pubert voted Auto-Submit+1

Auto-Submit+1
Open in Gerrit

Related details

Attention is currently required from:
  • Olivier Robin
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I5951db102f3c54448917cf0a9d3162ea426042da
Gerrit-Change-Number: 7112564
Gerrit-PatchSet: 4
Gerrit-Owner: Quentin Pubert <qpu...@google.com>
Gerrit-Reviewer: Olivier Robin <olivie...@chromium.org>
Gerrit-Reviewer: Quentin Pubert <qpu...@google.com>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Olivier Robin <olivie...@chromium.org>
Gerrit-Comment-Date: Wed, 05 Nov 2025 13:20:44 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Olivier Robin (Gerrit)

unread,
Nov 5, 2025, 10:04:45 AM (2 days ago) Nov 5
to Quentin Pubert, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, srahim...@chromium.org
Attention needed from Quentin Pubert

Olivier Robin added 10 comments

File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_coordinator.mm
Line 61, Patchset 4 (Latest): [self showCamera];
Olivier Robin . unresolved

are we bypassing the context menu here and below?
I understand that this is what webkit does, but one of the point of the refactor is to add drive in those scenarios

Line 291, Patchset 4 (Latest): _isPresentingSubMenu = YES;
Olivier Robin . unresolved

I find the name weird as none of these are sub menus

File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator.h
Line 55, Patchset 4 (Latest):- (void)adjustCaptureTypeToAvailableDevices;
Olivier Robin . unresolved

why do we need a method for this? Could this not be automatically computed by preferredCameraDevice ?

File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator.mm
Line 275, Patchset 4 (Latest): mediaInfo[UIImagePickerControllerMediaURL]];
Olivier Robin . unresolved

when is this deleted?

Line 281, Patchset 4 (Latest): CHECK_EQ(nil, mediaInfo[UIImagePickerControllerImageURL])
Olivier Robin . unresolved

is this guaranteed by documentation?

Line 344, Patchset 4 (Latest): [self submitFileSelection:@[ mediaURL ]];
Olivier Robin . unresolved

what happens if you have the multiple attribute?

File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator_unittest.mm
Line 266, Patchset 4 (Latest): UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
Olivier Robin . unresolved

ImageWithColor()

Line 301, Patchset 4 (Latest): EXPECT_TRUE(controller_->HasSubmittedSelection());
Olivier Robin . unresolved

check "IOS.FileUploadPanel.SubmittedFileCount" histogram?

File ios/chrome/browser/file_upload_panel/test/file_upload_panel_egtest.mm
Line 66, Patchset 4 (Latest): R"(<html><body><input type="file" id="fileInput" accept="image/*" /></body></html>)";
Olivier Robin . unresolved

can we format these?

Line 301, Patchset 4 (Latest): XCUIApplication* app = [[XCUIApplication alloc] init];
Olivier Robin . unresolved

Why can't you use EG if it is in the same process?

Open in Gerrit

Related details

Attention is currently required from:
  • Quentin Pubert
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I5951db102f3c54448917cf0a9d3162ea426042da
    Gerrit-Change-Number: 7112564
    Gerrit-PatchSet: 4
    Gerrit-Owner: Quentin Pubert <qpu...@google.com>
    Gerrit-Reviewer: Olivier Robin <olivie...@chromium.org>
    Gerrit-Reviewer: Quentin Pubert <qpu...@google.com>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Quentin Pubert <qpu...@google.com>
    Gerrit-Comment-Date: Wed, 05 Nov 2025 15:04:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Quentin Pubert (Gerrit)

    unread,
    Nov 6, 2025, 11:32:56 AM (24 hours ago) Nov 6
    to Olivier Robin, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, srahim...@chromium.org
    Attention needed from Olivier Robin

    Quentin Pubert voted and added 10 comments

    Votes added by Quentin Pubert

    Auto-Submit+1
    Commit-Queue+1

    10 comments

    File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_coordinator.mm
    Line 61, Patchset 4: [self showCamera];
    Olivier Robin . resolved

    are we bypassing the context menu here and below?
    I understand that this is what webkit does, but one of the point of the refactor is to add drive in those scenarios

    Quentin Pubert

    For now the goal is to reach parity with the native file upload menu. Once this is done then the Drive file picker can be integrated. However we can already expect that it it will be skipped if there is a capture attribute. If the input is meant to select a directory then we may need to adapt the Drive file picker accordingly, or at least move its output to a folder which could then be submitted. We can expect that all cases where the local file picker can be presented can eventually be eligible to also present the Drive file picker.

    Line 291, Patchset 4: _isPresentingSubMenu = YES;
    Olivier Robin . resolved

    I find the name weird as none of these are sub menus

    Quentin Pubert

    I will remove this variable and instead just check if one of the views is presented.

    File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator.h
    Line 55, Patchset 4:- (void)adjustCaptureTypeToAvailableDevices;
    Olivier Robin . resolved

    why do we need a method for this? Could this not be automatically computed by preferredCameraDevice ?

    Quentin Pubert

    This "stateful" behavior is meant to mimic the behavior of the native file upload menu.

    File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator.mm
    Line 275, Patchset 4: mediaInfo[UIImagePickerControllerMediaURL]];
    Olivier Robin . resolved

    when is this deleted?

    Quentin Pubert

    Based on what I could find online it's not well defined and appears to have changed at some point around iOS 13. It appears best to make a copy of the file before the delegate call returns on the main thread, which is what happens here when we submit the selection to the controller.

    Line 281, Patchset 4: CHECK_EQ(nil, mediaInfo[UIImagePickerControllerImageURL])
    Olivier Robin . resolved

    is this guaranteed by documentation?

    Quentin Pubert

    According to the document, info is "A dictionary containing the original image and the edited image, if an image was picked; or a filesystem URL for the movie, if a movie was picked." The native file upload menu also makes this verification although it probably does not crash in Release mode if unverified.

    Line 344, Patchset 4: [self submitFileSelection:@[ mediaURL ]];
    Olivier Robin . resolved

    what happens if you have the multiple attribute?

    Quentin Pubert

    This is irrelevant if the camera is used, as per the native behavior.

    File ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator_unittest.mm
    Line 266, Patchset 4: UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
    Olivier Robin . resolved

    ImageWithColor()

    Quentin Pubert

    Done

    Line 301, Patchset 4: EXPECT_TRUE(controller_->HasSubmittedSelection());
    Olivier Robin . resolved

    check "IOS.FileUploadPanel.SubmittedFileCount" histogram?

    Quentin Pubert

    Done

    File ios/chrome/browser/file_upload_panel/test/file_upload_panel_egtest.mm
    Line 66, Patchset 4: R"(<html><body><input type="file" id="fileInput" accept="image/*" /></body></html>)";
    Olivier Robin . resolved

    can we format these?

    Quentin Pubert

    Done

    Line 301, Patchset 4: XCUIApplication* app = [[XCUIApplication alloc] init];
    Olivier Robin . resolved

    Why can't you use EG if it is in the same process?

    Quentin Pubert

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Olivier Robin
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I5951db102f3c54448917cf0a9d3162ea426042da
      Gerrit-Change-Number: 7112564
      Gerrit-PatchSet: 5
      Gerrit-Owner: Quentin Pubert <qpu...@google.com>
      Gerrit-Reviewer: Olivier Robin <olivie...@chromium.org>
      Gerrit-Reviewer: Quentin Pubert <qpu...@google.com>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Olivier Robin <olivie...@chromium.org>
      Gerrit-Comment-Date: Thu, 06 Nov 2025 16:32:43 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Olivier Robin <olivie...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Olivier Robin (Gerrit)

      unread,
      4:46 AM (7 hours ago) 4:46 AM
      to Quentin Pubert, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, srahim...@chromium.org
      Attention needed from Quentin Pubert

      Olivier Robin voted

      Code-Review+1
      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Quentin Pubert
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I5951db102f3c54448917cf0a9d3162ea426042da
      Gerrit-Change-Number: 7112564
      Gerrit-PatchSet: 5
      Gerrit-Owner: Quentin Pubert <qpu...@google.com>
      Gerrit-Reviewer: Olivier Robin <olivie...@chromium.org>
      Gerrit-Reviewer: Quentin Pubert <qpu...@google.com>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Quentin Pubert <qpu...@google.com>
      Gerrit-Comment-Date: Fri, 07 Nov 2025 09:46:02 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Chromium LUCI CQ (Gerrit)

      unread,
      4:54 AM (7 hours ago) 4:54 AM
      to Quentin Pubert, Olivier Robin, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, feature-me...@chromium.org, ios-revie...@chromium.org, ios-r...@chromium.org, marq+...@chromium.org, srahim...@chromium.org

      Chromium LUCI CQ submitted the change

      Change information

      Commit message:
      [iOS] Implement camera in custom file upload panel

      This CL implements the camera action in the custom file upload panel. If
      a photo is taken, the JPEG representation of the photo is saved to a
      temporary location of the disk and this temporary location is forwarded
      to the web page. If there is a capture attribute, the file upload panel
      context menu can now be skipped and the camera will be presented
      directly.
      Bug: 441659098
      Change-Id: I5951db102f3c54448917cf0a9d3162ea426042da
      Commit-Queue: Olivier Robin <olivie...@chromium.org>
      Auto-Submit: Quentin Pubert <qpu...@google.com>
      Reviewed-by: Olivier Robin <olivie...@chromium.org>
      Cr-Commit-Position: refs/heads/main@{#1541674}
      Files:
      • M ios/chrome/app/strings/ios_strings.grd
      • A ios/chrome/app/strings/ios_strings_grd/IDS_IOS_FILE_UPLOAD_PANEL_TAKE_PHOTO_ACTION_LABEL.png.sha1
      • A ios/chrome/app/strings/ios_strings_grd/IDS_IOS_FILE_UPLOAD_PANEL_TAKE_VIDEO_ACTION_LABEL.png.sha1
      • M ios/chrome/browser/file_upload_panel/DEPS
      • M ios/chrome/browser/file_upload_panel/coordinator/BUILD.gn
      • M ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_coordinator.mm
      • M ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator.h
      • M ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator.mm
      • M ios/chrome/browser/file_upload_panel/coordinator/file_upload_panel_mediator_unittest.mm
      • M ios/chrome/browser/file_upload_panel/test/file_upload_panel_egtest.mm
      • M ios/chrome/browser/file_upload_panel/ui/constants.h
      • M tools/metrics/histograms/metadata/ios/enums.xml
      • M tools/metrics/histograms/metadata/ios/histograms.xml
      Change size: XL
      Delta: 13 files changed, 1297 insertions(+), 91 deletions(-)
      Branch: refs/heads/main
      Submit Requirements:
      • requirement satisfiedCode-Review: +1 by Olivier Robin
      Open in Gerrit
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: merged
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I5951db102f3c54448917cf0a9d3162ea426042da
      Gerrit-Change-Number: 7112564
      Gerrit-PatchSet: 6
      Gerrit-Owner: Quentin Pubert <qpu...@google.com>
      Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
      Gerrit-Reviewer: Olivier Robin <olivie...@chromium.org>
      Gerrit-Reviewer: Quentin Pubert <qpu...@google.com>
      open
      diffy
      satisfied_requirement
      Reply all
      Reply to author
      Forward
      0 new messages