Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / translate / chrome_translate_client.h
index 3c22427..01529ff 100644 (file)
@@ -8,7 +8,6 @@
 #include <string>
 
 #include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
 #include "chrome/browser/ui/translate/translate_bubble_model.h"
 #include "components/translate/content/browser/browser_cld_data_provider.h"
 #include "components/translate/content/browser/content_translate_driver.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_user_data.h"
 
-namespace base {
-class File;
-}  // namespace base
-
 namespace content {
 class BrowserContext;
 class WebContents;
@@ -34,7 +29,6 @@ class ScopedCLDDynamicDataHarness;
 class PrefService;
 
 namespace translate {
-struct LanguageDetectionDetails;
 class LanguageState;
 class TranslateAcceptLanguages;
 class TranslatePrefs;
@@ -43,6 +37,7 @@ class TranslateManager;
 
 class ChromeTranslateClient
     : public translate::TranslateClient,
+      public translate::ContentTranslateDriver::Observer,
       public content::WebContentsObserver,
       public content::WebContentsUserData<ChromeTranslateClient> {
  public:
@@ -83,11 +78,6 @@ class ChromeTranslateClient
   // destroyed.
   content::WebContents* GetWebContents();
 
-  // Number of attempts before waiting for a page to be fully reloaded.
-  void set_translate_max_reload_attempts(int attempts) {
-    max_reload_check_attempts_ = attempts;
-  }
-
   // TranslateClient implementation.
   virtual translate::TranslateDriver* GetTranslateDriver() OVERRIDE;
   virtual PrefService* GetPrefs() OVERRIDE;
@@ -106,45 +96,32 @@ class ChromeTranslateClient
   virtual void ShowReportLanguageDetectionErrorUI(
       const GURL& report_url) OVERRIDE;
 
+  // ContentTranslateDriver::Observer implementation.
+  virtual void OnLanguageDetermined(
+      const translate::LanguageDetectionDetails& details) OVERRIDE;
+  virtual void OnPageTranslated(
+      const std::string& original_lang,
+      const std::string& translated_lang,
+      translate::TranslateErrors::Type error_type) OVERRIDE;
+
  private:
   explicit ChromeTranslateClient(content::WebContents* web_contents);
   friend class content::WebContentsUserData<ChromeTranslateClient>;
 
   // content::WebContentsObserver implementation.
-  virtual void NavigationEntryCommitted(
-      const content::LoadCommittedDetails& load_details) OVERRIDE;
   virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
-  virtual void DidNavigateAnyFrame(
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) OVERRIDE;
   virtual void WebContentsDestroyed() OVERRIDE;
 
-  // Initiates translation once the page is finished loading.
-  void InitiateTranslation(const std::string& page_lang, int attempt);
-
-  // IPC handlers.
-  void OnTranslateAssignedSequenceNumber(int page_seq_no);
-  void OnLanguageDetermined(const translate::LanguageDetectionDetails& details,
-                            bool page_needs_translation);
-  void OnPageTranslated(const std::string& original_lang,
-                        const std::string& translated_lang,
-                        translate::TranslateErrors::Type error_type);
-
   // Shows the translate bubble.
   void ShowBubble(translate::TranslateStep step,
                   translate::TranslateErrors::Type error_type);
 
-  // Max number of attempts before checking if a page has been reloaded.
-  int max_reload_check_attempts_;
-
   translate::ContentTranslateDriver translate_driver_;
   scoped_ptr<translate::TranslateManager> translate_manager_;
 
   // Provides CLD data for this process.
   scoped_ptr<translate::BrowserCldDataProvider> cld_data_provider_;
 
-  base::WeakPtrFactory<ChromeTranslateClient> weak_pointer_factory_;
-
   DISALLOW_COPY_AND_ASSIGN(ChromeTranslateClient);
 };