OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ |
6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // Helper method to return the TranslateAcceptLanguages instance associated | 46 // Helper method to return the TranslateAcceptLanguages instance associated |
47 // with |browser_context|. | 47 // with |browser_context|. |
48 static TranslateAcceptLanguages* GetTranslateAcceptLanguages( | 48 static TranslateAcceptLanguages* GetTranslateAcceptLanguages( |
49 content::BrowserContext* browser_context); | 49 content::BrowserContext* browser_context); |
50 | 50 |
51 // Helper method to return the TranslateManager instance associated with | 51 // Helper method to return the TranslateManager instance associated with |
52 // |web_contents|, or NULL if there is no such associated instance. | 52 // |web_contents|, or NULL if there is no such associated instance. |
53 static TranslateManager* GetManagerFromWebContents( | 53 static TranslateManager* GetManagerFromWebContents( |
54 content::WebContents* web_contents); | 54 content::WebContents* web_contents); |
55 | 55 |
| 56 // Gets |source| and |target| language for translation. |
| 57 static void GetTranslateLanguages(content::WebContents* web_contents, |
| 58 std::string* source, |
| 59 std::string* target); |
| 60 |
56 // Gets the associated TranslateManager. | 61 // Gets the associated TranslateManager. |
57 TranslateManager* GetTranslateManager(); | 62 TranslateManager* GetTranslateManager(); |
58 | 63 |
59 // Gets the associated WebContents. Returns NULL if the WebContents is being | 64 // Gets the associated WebContents. Returns NULL if the WebContents is being |
60 // destroyed. | 65 // destroyed. |
61 content::WebContents* GetWebContents(); | 66 content::WebContents* GetWebContents(); |
62 | 67 |
63 // Denotes which state the user is in with respect to translate. | 68 // Denotes which state the user is in with respect to translate. |
64 enum TranslateStep { | 69 enum TranslateStep { |
65 BEFORE_TRANSLATE, | 70 BEFORE_TRANSLATE, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Shows the translate bubble. | 109 // Shows the translate bubble. |
105 void ShowBubble(TranslateStep step, TranslateErrors::Type error_type); | 110 void ShowBubble(TranslateStep step, TranslateErrors::Type error_type); |
106 | 111 |
107 ContentTranslateDriver translate_driver_; | 112 ContentTranslateDriver translate_driver_; |
108 scoped_ptr<TranslateManager> translate_manager_; | 113 scoped_ptr<TranslateManager> translate_manager_; |
109 | 114 |
110 DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper); | 115 DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper); |
111 }; | 116 }; |
112 | 117 |
113 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ | 118 #endif // CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_ |
OLD | NEW |