Chromium Code Reviews| Index: components/translate/core/browser/translate_infobar_delegate.h |
| diff --git a/components/translate/core/browser/translate_infobar_delegate.h b/components/translate/core/browser/translate_infobar_delegate.h |
| index 6a8a77b94dbb3de095bcfff8d57f2ea1170a0868..cb4a7bc4c002d5b10f99137629fe1d2a025ac689 100644 |
| --- a/components/translate/core/browser/translate_infobar_delegate.h |
| +++ b/components/translate/core/browser/translate_infobar_delegate.h |
| @@ -37,6 +37,19 @@ class TranslateManager; |
| class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { |
| public: |
| + // A responder to handle different translate steps' UI changes. |
|
groby-ooo-7-16
2017/05/20 21:30:39
If I remember correctly, you don't need this class
Leo
2017/05/21 04:15:20
I think the fact you described is the original lo
|
| + class Responder { |
|
groby-ooo-7-16
2017/05/20 21:30:39
We usually call those "Observer"
Leo
2017/05/22 09:08:10
Thanks for questioning the class name, I have stru
|
| + public: |
| + // Handles UI changes on the translate step given. |
| + virtual void ActionOnStep(translate::TranslateStep step, |
|
groby-ooo-7-16
2017/05/20 21:30:39
Suggested name: OnTranslateStepChanged()
That's c
Leo
2017/05/22 09:08:10
Thanks, Done.
|
| + TranslateErrors::Type error_type){}; |
| + // Return whether user declined translate service. |
|
groby-ooo-7-16
2017/05/20 21:30:39
Does "declined" include dismissing the infobar, or
Leo
2017/05/22 09:08:10
"declined" here is just a flag used to evaluate us
groby-ooo-7-16
2017/05/22 14:34:11
Thank you - the reason I asked was that we use "De
|
| + virtual bool Declined(); |
| + |
| + protected: |
| + virtual ~Responder() {} |
| + }; |
| + |
| static const size_t kNoIndex; |
| ~TranslateInfoBarDelegate() override; |
| @@ -182,6 +195,9 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { |
| // May return NULL if the driver has been destroyed. |
| TranslateDriver* GetTranslateDriver(); |
| + // Set a responder. |
| + void SetResponder(Responder* responder); |
| + |
| protected: |
| TranslateInfoBarDelegate( |
| const base::WeakPtr<TranslateManager>& translate_manager, |
| @@ -219,6 +235,10 @@ class TranslateInfoBarDelegate : public infobars::InfoBarDelegate { |
| // (due to language detection, preferences...) |
| bool triggered_from_menu_; |
| + // A responder to handle front-end changes on different steps. |
| + // It's only used when we try to reuse the existing UI. |
| + Responder* responder_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate); |
| }; |