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

Unified Diff: chrome/browser/tab_contents/language_state.h

Issue 25373009: Translate: New Bubble UX (for the view toolkit) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the browser test Created 7 years, 2 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: chrome/browser/tab_contents/language_state.h
diff --git a/chrome/browser/tab_contents/language_state.h b/chrome/browser/tab_contents/language_state.h
index b5ac059c29f4c0e1c831066b95c5ce5fe1c230f4..a193edfc660e0d10976f43f3ad03b672251a73b3 100644
--- a/chrome/browser/tab_contents/language_state.h
+++ b/chrome/browser/tab_contents/language_state.h
@@ -10,8 +10,9 @@
#include "base/basictypes.h"
namespace content {
-class NavigationController;
struct LoadCommittedDetails;
+class NavigationController;
+class WebContents;
}
// This class holds the language state of the current page.
@@ -25,6 +26,14 @@ struct LoadCommittedDetails;
class LanguageState {
public:
+ class Observer {
+ public:
+ virtual void OnTranslateEnabledChanged(content::WebContents* source) = 0;
sky 2013/10/18 14:31:10 Add description. Also, I would prefer this in its
hajimehoshi 2013/10/21 10:29:12 Done.
+
+ protected:
+ virtual ~Observer() {}
+ };
+
explicit LanguageState(content::NavigationController* nav_controller);
~LanguageState();
@@ -71,6 +80,15 @@ class LanguageState {
// navigation.
bool in_page_navigation() const { return in_page_navigation_; }
+ bool translate_enabled() const { return translate_enabled_; }
+ void SetTranslateEnabled(bool value);
+
+ // Whether the current page's language is different from the previous
+ // language.
+ bool IsLanguageChanged() const;
sky 2013/10/18 14:31:10 HasLanguageChanged
hajimehoshi 2013/10/21 10:29:12 Done.
+
+ void set_observer(Observer* observer) { observer_ = observer; }
+
private:
// The languages this page is in. Note that current_lang_ is different from
// original_lang_ when the page has been translated.
@@ -109,6 +127,11 @@ class LanguageState {
// Whether the current navigation is a fragment navigation (in page).
bool in_page_navigation_;
+ // Whether the Translate is enabled.
+ bool translate_enabled_;
+
+ Observer* observer_;
+
DISALLOW_COPY_AND_ASSIGN(LanguageState);
};

Powered by Google App Engine
This is Rietveld 408576698