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

Unified Diff: chrome/browser/translate/translate_tab_helper.h

Issue 166963002: TranslateManager is no longer a singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp
Patch Set: rebase Created 6 years, 10 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/translate/translate_tab_helper.h
diff --git a/chrome/browser/translate/translate_tab_helper.h b/chrome/browser/translate/translate_tab_helper.h
index 3c35d4aacf387ab11cdacf30e5a5f6aad8b72a76..eef3e9c4807ff267e97810d36980b87dae963e40 100644
--- a/chrome/browser/translate/translate_tab_helper.h
+++ b/chrome/browser/translate/translate_tab_helper.h
@@ -8,6 +8,7 @@
#include <string>
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/translate/translate_manager.h"
#include "chrome/browser/ui/translate/translate_bubble_model.h"
#include "components/translate/content/browser/content_translate_driver.h"
#include "components/translate/core/common/translate_errors.h"
@@ -45,6 +46,17 @@ class TranslateTabHelper
static TranslateAcceptLanguages* GetTranslateAcceptLanguages(
content::BrowserContext* browser_context);
+ // Helper method to return the TranslateManager instance associated with
+ // |web_contents|.
+ static TranslateManager* GetManagerFromWebContents(
+ content::WebContents* web_contents);
+
+ // Gets the associated TranslateManager.
+ TranslateManager* GetTranslateManager();
+
+ // Gets the associated WebContents.
+ content::WebContents* GetWebContents();
+
// Denotes which state the user is in with respect to translate.
enum TranslateStep {
BEFORE_TRANSLATE,
@@ -56,7 +68,6 @@ class TranslateTabHelper
// Called when the embedder should present UI to the user corresponding to the
// user's current |step|.
void ShowTranslateUI(TranslateStep step,
- content::WebContents* web_contents,
const std::string source_language,
const std::string target_language,
TranslateErrors::Type error_type);
@@ -79,11 +90,10 @@ class TranslateTabHelper
TranslateErrors::Type error_type);
// Shows the translate bubble.
- void ShowBubble(content::WebContents* web_contents,
- TranslateStep step,
- TranslateErrors::Type error_type);
+ void ShowBubble(TranslateStep step, TranslateErrors::Type error_type);
ContentTranslateDriver translate_driver_;
+ TranslateManager translate_manager_;
DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper);
};

Powered by Google App Engine
This is Rietveld 408576698