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: components/translate/core/browser/language_state.h

Issue 133273029: Move LanguageState to the translate component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 11 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/language_state.h
diff --git a/chrome/browser/tab_contents/language_state.h b/components/translate/core/browser/language_state.h
similarity index 86%
rename from chrome/browser/tab_contents/language_state.h
rename to components/translate/core/browser/language_state.h
index 79a3f3b2bed2472a82514099ca7c1943d1ae6a1d..7dd70cfe9484cf601720ae8466e81ae359ae9b90 100644
--- a/chrome/browser/tab_contents/language_state.h
+++ b/components/translate/core/browser/language_state.h
@@ -1,21 +1,15 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_TAB_CONTENTS_LANGUAGE_STATE_H_
-#define CHROME_BROWSER_TAB_CONTENTS_LANGUAGE_STATE_H_
+#ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_
+#define COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_
#include <string>
#include "base/basictypes.h"
-class LanguageStateObserver;
-
-namespace content {
-struct LoadCommittedDetails;
-class NavigationController;
-class WebContents;
-}
+class TranslateClient;
// This class holds the language state of the current page.
// There is one LanguageState instance per WebContents.
blundell 2014/01/17 15:09:39 s/per WebContents/per tab
droger 2014/01/17 16:14:21 Done.
@@ -28,12 +22,12 @@ class WebContents;
class LanguageState {
public:
- explicit LanguageState(content::NavigationController* nav_controller);
+ LanguageState(TranslateClient* client);
~LanguageState();
// Should be called when the page did a new navigation (whether it is a main
// frame or sub-frame navigation).
- void DidNavigate(const content::LoadCommittedDetails& details);
+ void DidNavigate(bool in_page_navigation, bool is_main_frame, bool reload);
// Should be called when the language of the page has been determined.
// |page_needs_translation| when false indicates that the browser should not
@@ -81,8 +75,6 @@ class LanguageState {
// language.
bool HasLanguageChanged() const;
- void set_observer(LanguageStateObserver* observer) { observer_ = observer; }
-
private:
void SetIsPageTranslated(bool value);
@@ -100,8 +92,7 @@ class LanguageState {
std::string prev_original_lang_;
std::string prev_current_lang_;
- // The navigation controller of the tab we are associated with.
- content::NavigationController* navigation_controller_;
+ TranslateClient* translate_client_;
// Whether it is OK to offer to translate the page. Some pages explictly
// specify that they should not be translated by the browser (this is the case
@@ -129,9 +120,7 @@ class LanguageState {
// Whether the Translate is enabled.
bool translate_enabled_;
- LanguageStateObserver* observer_;
-
DISALLOW_COPY_AND_ASSIGN(LanguageState);
};
-#endif // CHROME_BROWSER_TAB_CONTENTS_LANGUAGE_STATE_H_
+#endif // COMPONENTS_TRANSLATE_CORE_BROWSER_LANGUAGE_STATE_H_

Powered by Google App Engine
This is Rietveld 408576698