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

Unified Diff: ios/web_view/internal/cwv_web_view_configuration.mm

Issue 2965303002: Expose method to reset translate settings. (Closed)
Patch Set: update comment Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/web_view/internal/translate/cwv_translation_controller.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web_view/internal/cwv_web_view_configuration.mm
diff --git a/ios/web_view/internal/cwv_web_view_configuration.mm b/ios/web_view/internal/cwv_web_view_configuration.mm
index d123fbf31269fb56a676e6837bc5750f6fc7caf5..736dfbbd3fafcc0810b8aa849780bd4b3c28a064 100644
--- a/ios/web_view/internal/cwv_web_view_configuration.mm
+++ b/ios/web_view/internal/cwv_web_view_configuration.mm
@@ -7,7 +7,6 @@
#include "base/memory/ptr_util.h"
#include "base/threading/thread_restrictions.h"
-#include "components/translate/core/browser/translate_download_manager.h"
#include "ios/web_view/internal/app/application_context.h"
#import "ios/web_view/internal/cwv_user_content_controller_internal.h"
#include "ios/web_view/internal/web_view_browser_state.h"
@@ -32,14 +31,27 @@
@synthesize userContentController = _userContentController;
+ (instancetype)defaultConfiguration {
- auto browserState =
- base::MakeUnique<ios_web_view::WebViewBrowserState>(false);
- return [[self alloc] initWithBrowserState:std::move(browserState)];
+ static CWVWebViewConfiguration* defaultConfiguration;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ auto browserState =
+ base::MakeUnique<ios_web_view::WebViewBrowserState>(false);
+ defaultConfiguration =
+ [[self alloc] initWithBrowserState:std::move(browserState)];
+ });
+ return defaultConfiguration;
}
+ (instancetype)incognitoConfiguration {
- auto browserState = base::MakeUnique<ios_web_view::WebViewBrowserState>(true);
- return [[self alloc] initWithBrowserState:std::move(browserState)];
+ static CWVWebViewConfiguration* incognitoConfiguration;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ auto browserState =
+ base::MakeUnique<ios_web_view::WebViewBrowserState>(true);
+ incognitoConfiguration =
+ [[self alloc] initWithBrowserState:std::move(browserState)];
+ });
+ return incognitoConfiguration;
}
+ (void)initialize {
@@ -62,10 +74,14 @@
return self;
}
+#pragma mark - Public Methods
+
- (BOOL)isPersistent {
return !_browserState->IsOffTheRecord();
}
+#pragma mark - Private Methods
+
- (ios_web_view::WebViewBrowserState*)browserState {
return _browserState.get();
}
« no previous file with comments | « no previous file | ios/web_view/internal/translate/cwv_translation_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698