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_CONTENT_BROWSER_CONTENT_TRANSLATE_DRIVER_H_
6 #define COMPONENTS_TRANSLATE_CONTENT_BROWSER_CONTENT_TRANSLATE_DRIVER_H_
8 #include "base/basictypes.h"
9 #include "components/translate/core/browser/translate_driver.h"
12 class NavigationController;
18 // Content implementation of TranslateDriver.
19 class ContentTranslateDriver : public TranslateDriver {
22 // The observer for the ContentTranslateDriver.
25 // Handles when the value of IsPageTranslated is changed.
26 virtual void OnIsPageTranslatedChanged(content::WebContents* source) = 0;
28 // Handles when the value of translate_enabled is changed.
29 virtual void OnTranslateEnabledChanged(content::WebContents* source) = 0;
32 virtual ~Observer() {}
35 ContentTranslateDriver(content::NavigationController* nav_controller);
36 virtual ~ContentTranslateDriver();
38 // Sets the Observer. Calling this method is optional.
39 void set_observer(Observer* observer) { observer_ = observer; }
41 // TranslateDriver methods.
42 virtual void OnIsPageTranslatedChanged() OVERRIDE;
43 virtual void OnTranslateEnabledChanged() OVERRIDE;
44 virtual bool IsLinkNavigation() OVERRIDE;
45 virtual void TranslatePage(int page_seq_no,
46 const std::string& translate_script,
47 const std::string& source_lang,
48 const std::string& target_lang) OVERRIDE;
49 virtual void RevertTranslation(int page_seq_no) OVERRIDE;
50 virtual bool IsOffTheRecord() OVERRIDE;
51 virtual const std::string& GetContentsMimeType() OVERRIDE;
52 virtual const GURL& GetLastCommittedURL() OVERRIDE;
53 virtual const GURL& GetActiveURL() OVERRIDE;
54 virtual const GURL& GetVisibleURL() OVERRIDE;
55 virtual bool HasCurrentPage() OVERRIDE;
56 virtual void OpenUrlInNewTab(const GURL& url) OVERRIDE;
59 // The navigation controller of the tab we are associated with.
60 content::NavigationController* navigation_controller_;
64 DISALLOW_COPY_AND_ASSIGN(ContentTranslateDriver);
67 } // namespace translate
69 #endif // COMPONENTS_TRANSLATE_CONTENT_BROWSER_CONTENT_TRANSLATE_DRIVER_H_