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

Unified Diff: ios/web_view/internal/translate/web_view_translate_client.h

Issue 2839093002: Implemented new Translate API for purely Objective-C clients. (Closed)
Patch Set: merge Created 3 years, 7 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
Index: ios/web_view/internal/translate/web_view_translate_client.h
diff --git a/ios/web_view/internal/translate/web_view_translate_client.h b/ios/web_view/internal/translate/web_view_translate_client.h
index e3f1d4dd7c006b4d802595dcfda6aa489deab2ab..b214e5f98946f7136e046d745beef6869d84401d 100644
--- a/ios/web_view/internal/translate/web_view_translate_client.h
+++ b/ios/web_view/internal/translate/web_view_translate_client.h
@@ -15,7 +15,8 @@
#import "components/translate/ios/browser/ios_translate_driver.h"
#include "ios/web/public/web_state/web_state_observer.h"
#import "ios/web/public/web_state/web_state_user_data.h"
-#import "ios/web_view/public/cwv_translate_delegate.h"
+
+@class CWVTranslationController;
class PrefService;
@@ -38,10 +39,13 @@ class WebViewTranslateClient
public:
~WebViewTranslateClient() override;
- // Sets the delegate passed by the embedder.
- // |delegate| is assumed to outlive this WebViewTranslateClient.
- void set_translate_delegate(id<CWVTranslateDelegate> delegate) {
- delegate_.reset(delegate);
+ // This |controller| is assumed to outlive this WebViewTranslateClient.
+ void set_translation_controller(CWVTranslationController* controller) {
+ translation_controller_.reset(controller);
+ }
+
+ translate::TranslateManager* translate_manager() {
+ return translate_manager_.get();
}
private:
@@ -73,8 +77,8 @@ class WebViewTranslateClient
std::unique_ptr<translate::TranslateManager> translate_manager_;
translate::IOSTranslateDriver translate_driver_;
- // Delegate provided by the embedder.
- base::WeakNSProtocol<id<CWVTranslateDelegate>> delegate_;
+ // ObjC class that wraps this class.
+ base::WeakNSObject<CWVTranslationController> translation_controller_;
DISALLOW_COPY_AND_ASSIGN(WebViewTranslateClient);
};

Powered by Google App Engine
This is Rietveld 408576698