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

Unified Diff: components/translate/core/browser/translate_infobar_delegate.h

Issue 2894553002: Replace OnPageTranslate Obsever by a responder of delegate. (Closed)
Patch Set: Fix Comments 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: 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..5e32a72d88eb5849bfef1e0e4bbef9beb7ba4ee6 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:
+ // An observer to handle different translate steps' UI changes.
+ class Observer {
+ public:
+ // Handles UI changes on the translate step given.
+ virtual void OnTranslateStepChanged(translate::TranslateStep step,
+ TranslateErrors::Type error_type){};
+ // Return whether user declined translate service.
+ virtual bool IsDeclinedByUser();
+
+ protected:
+ virtual ~Observer() {}
+ };
+
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 observer.
+ void SetObserver(Observer* observer);
+
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 observer to handle front-end changes on different steps.
+ // It's only used when we try to reuse the existing UI.
+ Observer* observer_;
+
DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarDelegate);
};

Powered by Google App Engine
This is Rietveld 408576698