| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 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_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/strings/string16.h" |
| 11 |
| 12 // The model for the Translate bubble UX. This manages the user's manipulation |
| 13 // of the bubble and offers the data to show on the bubble. |
| 14 class TranslateBubbleModel { |
| 15 public: |
| 16 enum ViewState { |
| 17 // The view state before translating. |
| 18 VIEW_STATE_BEFORE_TRANSLATE, |
| 19 |
| 20 // The view state during translating. |
| 21 VIEW_STATE_TRANSLATING, |
| 22 |
| 23 // The view state after translating. |
| 24 VIEW_STATE_AFTER_TRANSLATE, |
| 25 |
| 26 // The view state when an error of Translate happens. |
| 27 VIEW_STATE_ERROR, |
| 28 |
| 29 // The view state when the detailed settings is shown. This view appears |
| 30 // when the user click a link 'Advanced' on other views. |
| 31 VIEW_STATE_ADVANCED, |
| 32 }; |
| 33 |
| 34 virtual ~TranslateBubbleModel() {} |
| 35 |
| 36 // Returns the current view state. |
| 37 virtual ViewState GetViewState() const = 0; |
| 38 |
| 39 // Transitions the view state. |
| 40 virtual void SetViewState(ViewState view_state) = 0; |
| 41 |
| 42 // Goes back from the 'Advanced' view state. |
| 43 virtual void GoBackFromAdvanced() = 0; |
| 44 |
| 45 // Returns the number of languages supported. |
| 46 virtual int GetNumberOfLanguages() const = 0; |
| 47 |
| 48 // Returns the displayable name for the language at |index|. |
| 49 virtual string16 GetLanguageNameAt(int index) const = 0; |
| 50 |
| 51 // Returns the original language index. |
| 52 virtual int GetOriginalLanguageIndex() const = 0; |
| 53 |
| 54 // Sets the original language index. |
| 55 virtual void SetOriginalLanguageIndex(int index) = 0; |
| 56 |
| 57 // Returns the target language index. |
| 58 virtual int GetTargetLanguageIndex() const = 0; |
| 59 |
| 60 // Sets the target language index. |
| 61 virtual void SetTargetLanguageIndex(int index) = 0; |
| 62 |
| 63 // Sets the value if the user doesn't want to have the page translated in the |
| 64 // current page's language. |
| 65 virtual void SetNeverTranslateLanguage(bool value) = 0; |
| 66 |
| 67 // Sets the value if the user doesn't want to have the page translated the |
| 68 // current page's domain. |
| 69 virtual void SetNeverTranslateSite(bool value) = 0; |
| 70 |
| 71 // Returns true if the webpage in the current original language should be |
| 72 // translated into the current target language automatically. |
| 73 virtual bool ShouldAlwaysTranslate() const = 0; |
| 74 |
| 75 // Sets the value if the webpage in the current original language should be |
| 76 // translated into the current target language automatically. |
| 77 virtual void SetAlwaysTranslate(bool value) = 0; |
| 78 |
| 79 // Starts translating the current page. |
| 80 virtual void Translate() = 0; |
| 81 |
| 82 // Reverts translation. |
| 83 virtual void RevertTranslation() = 0; |
| 84 |
| 85 // Processes when the user declines translation. |
| 86 virtual void TranslationDeclined() = 0; |
| 87 }; |
| 88 |
| 89 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_ |
| OLD | NEW |