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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_
6 #define COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_
14 // Interface that allows Translate core code to interact with its driver (i.e.,
15 // obtain information from it and give information to it). A concrete
16 // implementation must be provided by the driver.
17 class TranslateDriver
{
19 // Returns true if the current page was navigated through a link.
20 virtual bool IsLinkNavigation() = 0;
22 // Called when Translate is enabled or disabled.
23 virtual void OnTranslateEnabledChanged() = 0;
25 // Called when the page is "translated" state of the page changed.
26 virtual void OnIsPageTranslatedChanged() = 0;
28 // Translates the page contents from |source_lang| to |target_lang|.
29 virtual void TranslatePage(int page_seq_no
,
30 const std::string
& translate_script
,
31 const std::string
& source_lang
,
32 const std::string
& target_lang
) = 0;
34 // Reverts the contents of the page to its original language.
35 virtual void RevertTranslation(int page_seq_no
) = 0;
37 // Returns whether the user is currently operating in off-the-record mode.
38 virtual bool IsOffTheRecord() = 0;
40 // Returns the mime type of the current page.
41 virtual const std::string
& GetContentsMimeType() = 0;
43 // Returns the last committed URL, or an empty GURL if there is no committed
45 virtual const GURL
& GetLastCommittedURL() = 0;
47 // Returns the visible URL, or an empty GURL if there is no visible URL.
48 virtual const GURL
& GetVisibleURL() = 0;
50 // Returns whether the driver has access to the current page.
51 virtual bool HasCurrentPage() = 0;
53 // Opens |url| in a new tab.
54 virtual void OpenUrlInNewTab(const GURL
& url
) = 0;
57 } // namespace translate
59 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_