Index: chrome/browser/ui/android/infobars/translate_compact_infobar.h |
diff --git a/chrome/browser/ui/android/infobars/translate_compact_infobar.h b/chrome/browser/ui/android/infobars/translate_compact_infobar.h |
index aeabb616fe27b7a9b09335e18414955f6212d4bf..be5fce1c6ed90db49f596e95aa3a4255fa081655 100644 |
--- a/chrome/browser/ui/android/infobars/translate_compact_infobar.h |
+++ b/chrome/browser/ui/android/infobars/translate_compact_infobar.h |
@@ -9,7 +9,9 @@ |
#include "base/macros.h" |
#include "chrome/browser/translate/chrome_translate_client.h" |
#include "chrome/browser/ui/android/infobars/infobar_android.h" |
-#include "components/translate/content/browser/content_translate_driver.h" |
+#include "components/translate/core/browser/translate_infobar_delegate.h" |
+#include "components/translate/core/browser/translate_step.h" |
+#include "components/translate/core/common/translate_errors.h" |
namespace translate { |
class TranslateInfoBarDelegate; |
@@ -17,7 +19,7 @@ class TranslateInfoBarDelegate; |
class TranslateCompactInfoBar |
: public InfoBarAndroid, |
- public translate::ContentTranslateDriver::Observer { |
+ public translate::TranslateInfoBarDelegate::Responder { |
public: |
explicit TranslateCompactInfoBar( |
std::unique_ptr<translate::TranslateInfoBarDelegate> delegate); |
@@ -44,10 +46,10 @@ class TranslateCompactInfoBar |
JNIEnv* env, |
const base::android::JavaParamRef<jobject>& obj); |
- // ContentTranslateDriver::Observer implementation. |
- void OnPageTranslated(const std::string& original_lang, |
groby-ooo-7-16
2017/05/20 21:30:39
Who is notifying the ContentTranslateDriver now?
Leo
2017/05/21 04:15:20
This method is used when ContentTranslateDriver fi
|
- const std::string& translated_lang, |
- translate::TranslateErrors::Type error_type) override; |
+ // TranslateInfoBarDelegate::Responder implementation. |
+ void ActionOnStep(translate::TranslateStep step, |
+ translate::TranslateErrors::Type error_type) override; |
+ bool Declined() override; |
private: |
// InfoBarAndroid: |
@@ -58,7 +60,19 @@ class TranslateCompactInfoBar |
const base::android::JavaRef<jobject>& java_info_bar) override; |
translate::TranslateInfoBarDelegate* GetDelegate(); |
- translate::ContentTranslateDriver* translate_driver_; |
+ |
+ // Bits for trace user actions. |
+ unsigned int action_flags_; |
groby-ooo-7-16
2017/05/20 21:30:39
This should be of type ActionFlag if you use the e
napper
2017/05/21 23:24:16
I think the int type is correct here, since the en
Leo
2017/05/22 09:08:10
After a little discuss offline with Jon. Seems the
groby-ooo-7-16
2017/05/22 14:34:11
You are of course right about the int - sorry abou
groby-ooo-7-16
2017/05/22 14:34:11
No need to refactor if it introduces many other is
|
+ |
+ // User action flags to record what the user has done in each session. |
+ enum ActionFlag { |
+ FLAG_NONE = 0, |
+ FLAG_TRANSLATE = 1 << 0, |
+ FLAG_REVERT = 1 << 1, |
+ FLAG_ALWAYS_TRANSLATE = 1 << 2, |
+ FLAG_NEVER_LANGUAGE = 1 << 3, |
+ FLAG_NEVER_SITE = 1 << 4, |
+ }; |
// If number of consecutive translations is equal to this number, infobar will |
// automatically trigger "Always Translate". |