New issue
Advanced search Search tips

Issue 884341 link

Starred by 1 user

Issue metadata

Status: Duplicate
Owner: ----
Closed: Dec 21
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: iOS
Pri: 3
Type: Task

Blocking:
issue 760598



Sign in to add a comment

Create ios/web public API for Browsing Data Clearing

Project Member Reported by eugene...@chromium.org, Sep 14

Issue description

Currently browsing data clearing works as follows:

1.) SetWebUsageEnabled(false) is called on every WebState
2.) -[WKWebsiteDataStore removeDataOfTypes:modifiedSince:completionHandler:] is called
3.) WKWebViewConfigurationProvider::Purge() is called in completion handler

This approach has a few issues:
1.) WKWebView concepts are leaked to ios/chrome layer
2.) SetWebUsageEnabled and Purge APIs are confusing
3.) Frequent CHECKs occur on attempting to load the URL before cookie clearing is finished

The proposal is the following:
1.) Add new function to ios/web/public/ responsible for browsing data clearing
2.) NavigationManager would not allow back forward navigation during cookie clearing
3.) NavigationManager would add a pending item instead of performing the load during cookie clearing


 
Blocking: 760598
The solution may look like this:

enum Type {
  TypeCookie,
  ....
};
void ClearBrowsingData(BrowserState* browser_state, Type types, base::OnceCallback callback) {
  BrowsingDataRemover::FromBrowserState(browser_state)->ClearBrowsingData(types, callback);
}


class BrowsingDataRemover() {
  static BrowsingDataRemover FromBrowserState(BrowserState* browser_state);

  ClearBrowsingData(Type types, base::OnceCallback callback) {
  // call willRemoveBrowsingData for each observer 

  [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes
                                             modifiedSince:
                                         completionHandler:^{
    web::WKWebViewConfigurationProvider::FromBrowserState(browser_state).Purge();
    // call didRemoveBrowsingData for each observer 
  }];

  }
  void AddObserver(BrowsingDataRemoverObserver*);
}

@interface BrowsingDataRemoverObserver
- (void)willRemoveBrowsingData;
- (void)didRemoveBrowsingData;
@end

@implementation CWVWebController <BrowsingDataRemoverObserver>
- (void)willRemoveBrowsingData {
  self.webUsageEnabled = NO;
}
- (void)willRemoveBrowsingData {
  self.webUsageEnabled = YES;
}
@end


Components: Mobile>iOSWeb
Components: -Mobile>WebView>Glue
Components: -Mobile>iOSWeb Mobile>iOSWeb>PublicAPI
Cc: gambard@chromium.org
Status: Available (was: Assigned)
Owner: ----
Mergedinto: 619783
Status: Duplicate (was: Available)

Sign in to add a comment