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

Side by Side Diff: components/translate/core/browser/translate_driver.h

Issue 228483003: Remove most content-level dependencies from TranslateManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 LanguageState; 11 class LanguageState;
11 12
12 // Interface that allows Translate core code to interact with its driver (i.e., 13 // Interface that allows Translate core code to interact with its driver (i.e.,
13 // obtain information from it and give information to it). A concrete 14 // obtain information from it and give information to it). A concrete
14 // implementation must be provided by the driver. 15 // implementation must be provided by the driver.
15 class TranslateDriver { 16 class TranslateDriver {
16 public: 17 public:
17 // Returns true if the current page was navigated through a link. 18 // Returns true if the current page was navigated through a link.
18 virtual bool IsLinkNavigation() = 0; 19 virtual bool IsLinkNavigation() = 0;
19 20
20 // Called when Translate is enabled or disabled. 21 // Called when Translate is enabled or disabled.
21 virtual void OnTranslateEnabledChanged() = 0; 22 virtual void OnTranslateEnabledChanged() = 0;
22 23
23 // Called when the page is "translated" state of the page changed. 24 // Called when the page is "translated" state of the page changed.
24 virtual void OnIsPageTranslatedChanged() = 0; 25 virtual void OnIsPageTranslatedChanged() = 0;
25 26
26 // Gets the LanguageState associated with the driver. 27 // Gets the LanguageState associated with the driver.
27 virtual LanguageState& GetLanguageState() = 0; 28 virtual LanguageState& GetLanguageState() = 0;
28 29
29 // Translates the page contents from |source_lang| to |target_lang|. 30 // Translates the page contents from |source_lang| to |target_lang|.
30 virtual void TranslatePage(const std::string& translate_script, 31 virtual void TranslatePage(const std::string& translate_script,
31 const std::string& source_lang, 32 const std::string& source_lang,
32 const std::string& target_lang) = 0; 33 const std::string& target_lang) = 0;
33 34
34 // Reverts the contents of the page to its original language. 35 // Reverts the contents of the page to its original language.
35 virtual void RevertTranslation() = 0; 36 virtual void RevertTranslation() = 0;
36 37
37 // Returns whether the user is currently operating in off-the-record mode. 38 // Returns whether the user is currently operating in off-the-record mode.
38 virtual bool IsOffTheRecord() = 0; 39 virtual bool IsOffTheRecord() = 0;
40
41 // Returns the mime type of the current page.
42 virtual const std::string& GetContentsMimeType() = 0;
43
44 // Returns the last committed URL, or an empty GURL if there is no committed
45 // URL.
46 virtual const GURL& GetLastCommittedURL() = 0;
47
48 // Returns the active URL, or an empty GURL if there is no active URL.
49 virtual const GURL& GetActiveURL() = 0;
50
51 // Returns the visible URL, or an empty GURL if there is no visible URL.
52 virtual const GURL& GetVisibleURL() = 0;
53
54 // Returns whether the driver has access to the current page.
55 virtual bool HasCurrentPage() = 0;
56
57 // Returns an int identifying the current page. Should only be called if
58 // |HasCurrentPage()| is true.
59 virtual int GetCurrentPageID() = 0;
39 }; 60 };
40 61
41 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_ 62 #endif // COMPONENTS_TRANSLATE_CORE_BROWSER_TRANSLATE_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698