OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_ | 5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_ |
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_ | 6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 class GURL; | 10 class GURL; |
11 class LanguageState; | |
12 | 11 |
13 // Interface that allows Translate core code to interact with its driver (i.e., | 12 // Interface that allows Translate core code to interact with its driver (i.e., |
14 // obtain information from it and give information to it). A concrete | 13 // obtain information from it and give information to it). A concrete |
15 // implementation must be provided by the driver. | 14 // implementation must be provided by the driver. |
16 class TranslateDriver { | 15 class TranslateDriver { |
17 public: | 16 public: |
18 // Returns true if the current page was navigated through a link. | 17 // Returns true if the current page was navigated through a link. |
19 virtual bool IsLinkNavigation() = 0; | 18 virtual bool IsLinkNavigation() = 0; |
20 | 19 |
21 // Called when Translate is enabled or disabled. | 20 // Called when Translate is enabled or disabled. |
22 virtual void OnTranslateEnabledChanged() = 0; | 21 virtual void OnTranslateEnabledChanged() = 0; |
23 | 22 |
24 // Called when the page is "translated" state of the page changed. | 23 // Called when the page is "translated" state of the page changed. |
25 virtual void OnIsPageTranslatedChanged() = 0; | 24 virtual void OnIsPageTranslatedChanged() = 0; |
26 | 25 |
27 // Gets the LanguageState associated with the driver. | |
28 virtual LanguageState& GetLanguageState() = 0; | |
29 | |
30 // Translates the page contents from |source_lang| to |target_lang|. | 26 // Translates the page contents from |source_lang| to |target_lang|. |
31 virtual void TranslatePage(const std::string& translate_script, | 27 virtual void TranslatePage(const std::string& translate_script, |
32 const std::string& source_lang, | 28 const std::string& source_lang, |
33 const std::string& target_lang) = 0; | 29 const std::string& target_lang) = 0; |
34 | 30 |
35 // Reverts the contents of the page to its original language. | 31 // Reverts the contents of the page to its original language. |
36 virtual void RevertTranslation() = 0; | 32 virtual void RevertTranslation() = 0; |
37 | 33 |
38 // Returns whether the user is currently operating in off-the-record mode. | 34 // Returns whether the user is currently operating in off-the-record mode. |
39 virtual bool IsOffTheRecord() = 0; | 35 virtual bool IsOffTheRecord() = 0; |
(...skipping 16 matching lines...) Expand all Loading... |
56 | 52 |
57 // Returns an int identifying the current page. Should only be called if | 53 // Returns an int identifying the current page. Should only be called if |
58 // |HasCurrentPage()| is true. | 54 // |HasCurrentPage()| is true. |
59 virtual int GetCurrentPageID() = 0; | 55 virtual int GetCurrentPageID() = 0; |
60 | 56 |
61 // Opens |url| in a new tab. | 57 // Opens |url| in a new tab. |
62 virtual void OpenUrlInNewTab(const GURL& url) = 0; | 58 virtual void OpenUrlInNewTab(const GURL& url) = 0; |
63 }; | 59 }; |
64 | 60 |
65 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_ | 61 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_ |
OLD | NEW |