Home | History | Annotate | Download | only in translate
      1 // Copyright (c) 2011 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.
      4 
      5 #ifndef CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_
      6 #define CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_
      7 #pragma once
      8 
      9 #include "chrome/browser/tab_contents/language_state.h"
     10 #include "chrome/common/translate_errors.h"
     11 #include "content/browser/tab_contents/tab_contents_observer.h"
     12 
     13 class TranslateTabHelper : public TabContentsObserver {
     14  public:
     15   explicit TranslateTabHelper(TabContents* tab_contents);
     16   ~TranslateTabHelper();
     17 
     18   LanguageState& language_state() { return language_state_; }
     19 
     20  private:
     21   // TabContentsObserver implementation.
     22   virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
     23   virtual void DidNavigateAnyFramePostCommit(
     24       const NavigationController::LoadCommittedDetails& details,
     25       const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
     26 
     27   void OnLanguageDetermined(const std::string& language,
     28                             bool page_translatable);
     29   void OnPageTranslated(int32 page_id,
     30                         const std::string& original_lang,
     31                         const std::string& translated_lang,
     32                         TranslateErrors::Type error_type);
     33 
     34   // Information about the language the page is in and has been translated to.
     35   LanguageState language_state_;
     36 
     37   DISALLOW_COPY_AND_ASSIGN(TranslateTabHelper);
     38 };
     39 
     40 #endif  // CHROME_BROWSER_TRANSLATE_TRANSLATE_TAB_HELPER_H_
     41