Chromium Code Reviews| 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 BEFORE_TRANSLATE, | |
| 18 TRANSLATING, | |
| 19 AFTER_TRANSLATE, | |
| 20 ERROR, | |
| 21 ADVANCED, | |
|
sky
2013/10/16 14:32:36
Document ADVANCED. It's not clear how the user get
hajimehoshi
2013/10/17 05:45:42
Done.
| |
| 22 }; | |
| 23 | |
| 24 virtual ~TranslateBubbleModel() {} | |
| 25 | |
| 26 // Returns the current view state. | |
| 27 virtual ViewState GetViewState() const = 0; | |
| 28 | |
| 29 // Transitions the view state. | |
| 30 virtual void SetViewState(ViewState view_state) = 0; | |
| 31 | |
| 32 // Goes back from the 'Advanced' view state. | |
| 33 virtual void GoBackFromAdvanced() = 0; | |
| 34 | |
| 35 // Returns the number of languages supported. | |
| 36 virtual int GetNumberOfLanguages() const = 0; | |
| 37 | |
| 38 // Returns the displayable name for the language at |index|. | |
| 39 virtual string16 GetLanguageNameAt(int index) const = 0; | |
| 40 | |
| 41 // Returns the original language index. | |
| 42 virtual int GetOriginalLanguageIndex() const = 0; | |
| 43 | |
| 44 // Sets the original language index. | |
| 45 virtual void SetOriginalLanguageIndex(int index) = 0; | |
| 46 | |
| 47 // Returns the target language index. | |
| 48 virtual int GetTargetLanguageIndex() const = 0; | |
| 49 | |
| 50 // Sets the target language index. | |
| 51 virtual void SetTargetLanguageIndex(int index) = 0; | |
| 52 | |
| 53 // Sets the value if the user doesn't want to have the page translated in the | |
| 54 // current page's language. | |
| 55 virtual void SetNeverTranslateLanguage(bool value) = 0; | |
| 56 | |
| 57 // Sets the value if the user doesn't want to have the page translated the | |
| 58 // current page's domain. | |
| 59 virtual void SetNeverTranslateSite(bool value) = 0; | |
| 60 | |
| 61 // Returns true if the webpage in the current original language should be | |
| 62 // translated into the current target language automatically. | |
| 63 virtual bool ShouldAlwaysTranslate() const = 0; | |
| 64 | |
| 65 // Sets the value if the webpage in the current original language should be | |
| 66 // translated into the current target language automatically. | |
| 67 virtual void SetAlwaysTranslate(bool value) = 0; | |
| 68 | |
| 69 // Starts translating the current page. | |
| 70 virtual void Translate() = 0; | |
| 71 | |
| 72 // Reverts translation. | |
| 73 virtual void RevertTranslation() = 0; | |
| 74 | |
| 75 // Processes when the user declines translation. | |
| 76 virtual void TranslationDeclined() = 0; | |
| 77 }; | |
| 78 | |
| 79 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_ | |
| OLD | NEW |