Changeset 244360 in webkit


Ignore:
Timestamp:
Apr 16, 2019 3:43:55 PM (5 years ago)
Author:
Chris Dumez
Message:

Show prompt for device orientation access if the client does not implement the corresponding API delegate
https://bugs.webkit.org/show_bug.cgi?id=196971
<rdar://problem/49945840>

Reviewed by Alex Christensen.

Show prompt for device orientation access if the client does not implement the corresponding
API delegate, instead of rejecting access by default.

  • UIProcess/Cocoa/UIDelegate.mm:

(WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):

  • UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
  • UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.

(WebKit::presentOrientationAccessAlert):

  • WebKit.xcodeproj/project.pbxproj:
Location:
trunk/Source
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/en.lproj/Localizable.strings

    r244205 r244360  
    110110"Allow (cross-site cookie and website data access)" = "Allow";
    111111
     112/* Button title in Device Orientation Permission API prompt */
     113"Allow (device motion and orientation access)" = "Allow";
     114
    112115/* Message for requesting cross-site cookie and website data access. */
    113116"Allow \"%@\" to use cookies and website data while browsing \"%@\"?" = "Allow \"%@\" to use cookies and website data while browsing \"%@\"?";
     
    155158"Cancel" = "Cancel";
    156159
     160/* Button title in Device Orientation Permission API prompt */
     161"Cancel (device motion and orientation access)" = "Cancel";
     162
    157163/* Title for Cancel button label in button bar */
    158164"Cancel button label in button bar" = "Cancel";
     
    968974"Your password will be sent unencrypted." = "Your password will be sent unencrypted.";
    969975
     976/* Message for requesting access to the device motion and orientation */
     977"\"%@\" Would Like to Access Motion and Orientation" = "\"%@\" Would Like to Access Motion and Orientation";
     978
    970979/* HTTP result code string */
    971980"accepted" = "accepted";
  • trunk/Source/WebKit/ChangeLog

    r244356 r244360  
     12019-04-16  Chris Dumez  <cdumez@apple.com>
     2
     3        Show prompt for device orientation access if the client does not implement the corresponding API delegate
     4        https://bugs.webkit.org/show_bug.cgi?id=196971
     5        <rdar://problem/49945840>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Show prompt for device orientation access if the client does not implement the corresponding
     10        API delegate, instead of rejecting access by default.
     11
     12        * UIProcess/Cocoa/UIDelegate.mm:
     13        (WebKit::UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess):
     14        * UIProcess/Cocoa/WKOrientationAccessAlert.h: Added.
     15        * UIProcess/Cocoa/WKOrientationAccessAlert.mm: Added.
     16        (WebKit::presentOrientationAccessAlert):
     17        * WebKit.xcodeproj/project.pbxproj:
     18
    1192019-04-16  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm

    r243210 r244360  
    4040#import "WKNavigationActionInternal.h"
    4141#import "WKOpenPanelParametersInternal.h"
     42#import "WKOrientationAccessAlert.h"
    4243#import "WKSecurityOriginInternal.h"
    4344#import "WKStorageAccessAlert.h"
     
    850851void UIDelegate::UIClient::shouldAllowDeviceOrientationAndMotionAccess(WebKit::WebPageProxy&, WebFrameProxy& webFrameProxy, const WebCore::SecurityOriginData& securityOriginData, CompletionHandler<void(bool)>&& completionHandler)
    851852{
    852     if (!m_uiDelegate.m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessRequestedByFrameDecisionHandler)
     853    auto delegate = m_uiDelegate.m_delegate.get();
     854    if (!delegate)
    853855        return completionHandler(false);
    854856
    855     auto delegate = m_uiDelegate.m_delegate.get();
    856     if (!delegate)
    857         return completionHandler(false);
     857    if (!m_uiDelegate.m_delegateMethods.webViewShouldAllowDeviceOrientationAndMotionAccessRequestedByFrameDecisionHandler) {
     858        presentOrientationAccessAlert(m_uiDelegate.m_webView, securityOriginData.host, WTFMove(completionHandler));
     859        return;
     860    }
    858861
    859862    auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:shouldAllowDeviceOrientationAndMotionAccessRequestedByFrame:decisionHandler:));
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r244288 r244360  
    902902                463FD4801EB9459600A2982C /* WKProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */; settings = {ATTRIBUTES = (Private, ); }; };
    903903                463FD4821EB94EC000A2982C /* ProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */; };
     904                4657D88922664A2D005DE823 /* WKOrientationAccessAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 4657D88722664A19005DE823 /* WKOrientationAccessAlert.h */; };
     905                4657D88A22664A2F005DE823 /* WKOrientationAccessAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4657D88822664A1A005DE823 /* WKOrientationAccessAlert.mm */; };
    904906                466BC03C1FA266DA002FA9C1 /* WebSWContextManagerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */; };
    905907                467E43E82243FF7D00B13924 /* WebProcessDataStoreParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 467E43E72243FF6D00B13924 /* WebProcessDataStoreParameters.h */; };
     
    31293131                4651ECE622178A850067EB95 /* WebProcessCacheCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebProcessCacheCocoa.mm; sourceTree = "<group>"; };
    31303132                465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKit2InitializeCocoa.mm; sourceTree = "<group>"; };
     3133                4657D88722664A19005DE823 /* WKOrientationAccessAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKOrientationAccessAlert.h; sourceTree = "<group>"; };
     3134                4657D88822664A1A005DE823 /* WKOrientationAccessAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKOrientationAccessAlert.mm; sourceTree = "<group>"; };
    31313135                466BC0381FA266C9002FA9C1 /* WebSWContextManagerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWContextManagerConnection.cpp; sourceTree = "<group>"; };
    31323136                466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWContextManagerConnection.h; sourceTree = "<group>"; };
     
    54385442                                E1AEA22D14687BDB00804569 /* WKFullKeyboardAccessWatcher.h */,
    54395443                                E1AEA22E14687BDB00804569 /* WKFullKeyboardAccessWatcher.mm */,
     5444                                4657D88722664A19005DE823 /* WKOrientationAccessAlert.h */,
     5445                                4657D88822664A1A005DE823 /* WKOrientationAccessAlert.mm */,
    54405446                                1AD01BCB1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.h */,
    54415447                                1AD01BCA1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.mm */,
     
    99749980                                BC857FE612B843D800EDEB2E /* WKOpenPanelParametersRef.h in Headers */,
    99759981                                BC1DFE8F12B31CA8005DF730 /* WKOpenPanelResultListener.h in Headers */,
     9982                                4657D88922664A2D005DE823 /* WKOrientationAccessAlert.h in Headers */,
    99769983                                BCD597D7112B56DC00EC8C23 /* WKPage.h in Headers */,
    99779984                                7C89D29C1A67837B003A5FDE /* WKPageConfigurationRef.h in Headers */,
     
    1126411271                                2D93116A212F61B500044BFE /* WKContentViewInteraction.mm in Sources */,
    1126511272                                637281A321ADC744009E0DE6 /* WKDownloadProgress.mm in Sources */,
     11273                                4657D88A22664A2F005DE823 /* WKOrientationAccessAlert.mm in Sources */,
    1126611274                                5CA26D83217AD1B800F97A35 /* WKSafeBrowsingWarning.mm in Sources */,
    1126711275                                1DB01944211CF005009FB3E8 /* WKShareSheet.mm in Sources */,
Note: See TracChangeset for help on using the changeset viewer.