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

Side by Side Diff: ios/web_view/internal/cwv_web_view_configuration.mm

Issue 2965303002: Expose method to reset translate settings. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web_view/public/cwv_web_view_configuration.h" 5 #import "ios/web_view/public/cwv_web_view_configuration.h"
6 #import "ios/web_view/internal/cwv_web_view_configuration_internal.h" 6 #import "ios/web_view/internal/cwv_web_view_configuration_internal.h"
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/threading/thread_restrictions.h" 9 #include "base/threading/thread_restrictions.h"
10 #include "components/translate/core/browser/translate_download_manager.h" 10 #include "components/translate/core/browser/translate_prefs.h"
11 #include "ios/web_view/internal/app/application_context.h" 11 #include "ios/web_view/internal/app/application_context.h"
12 #import "ios/web_view/internal/cwv_user_content_controller_internal.h" 12 #import "ios/web_view/internal/cwv_user_content_controller_internal.h"
13 #include "ios/web_view/internal/pref_names.h"
13 #include "ios/web_view/internal/web_view_browser_state.h" 14 #include "ios/web_view/internal/web_view_browser_state.h"
14 #include "ios/web_view/internal/web_view_global_state_util.h" 15 #include "ios/web_view/internal/web_view_global_state_util.h"
15 16
16 #if !defined(__has_feature) || !__has_feature(objc_arc) 17 #if !defined(__has_feature) || !__has_feature(objc_arc)
17 #error "This file requires ARC support." 18 #error "This file requires ARC support."
18 #endif 19 #endif
19 20
20 @interface CWVWebViewConfiguration () { 21 @interface CWVWebViewConfiguration () {
21 // The BrowserState for this configuration. 22 // The BrowserState for this configuration.
22 std::unique_ptr<ios_web_view::WebViewBrowserState> _browserState; 23 std::unique_ptr<ios_web_view::WebViewBrowserState> _browserState;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 self = [super init]; 56 self = [super init];
56 if (self) { 57 if (self) {
57 _browserState = std::move(browserState); 58 _browserState = std::move(browserState);
58 59
59 _userContentController = 60 _userContentController =
60 [[CWVUserContentController alloc] initWithConfiguration:self]; 61 [[CWVUserContentController alloc] initWithConfiguration:self];
61 } 62 }
62 return self; 63 return self;
63 } 64 }
64 65
66 #pragma mark - Public Methods
67
68 - (void)resetTranslationPreferences {
69 translate::TranslatePrefs translatePrefs(_browserState->GetPrefs(),
70 prefs::kAcceptLanguages, nullptr);
71 translatePrefs.ResetToDefaults();
72 }
73
65 - (BOOL)isPersistent { 74 - (BOOL)isPersistent {
66 return !_browserState->IsOffTheRecord(); 75 return !_browserState->IsOffTheRecord();
67 } 76 }
68 77
78 #pragma mark - Private Methods
79
69 - (ios_web_view::WebViewBrowserState*)browserState { 80 - (ios_web_view::WebViewBrowserState*)browserState {
70 return _browserState.get(); 81 return _browserState.get();
71 } 82 }
72 83
73 @end 84 @end
OLDNEW
« no previous file with comments | « no previous file | ios/web_view/public/cwv_web_view_configuration.h » ('j') | ios/web_view/public/cwv_web_view_configuration.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698