Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / chrome / browser / ui / translate / translate_bubble_model.h
blob0fc11cf7f9ea1d92bd58c325fb3816da5c703f7a
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.
5 #ifndef CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_
6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_
8 #include <string>
10 #include "base/strings/string16.h"
11 #include "components/translate/core/common/translate_errors.h"
13 // The model for the Translate bubble UX. This manages the user's manipulation
14 // of the bubble and offers the data to show on the bubble.
15 class TranslateBubbleModel {
16 public:
17 enum ViewState {
18 // The view state before translating.
19 VIEW_STATE_BEFORE_TRANSLATE,
21 // The view state during translating.
22 VIEW_STATE_TRANSLATING,
24 // The view state after translating.
25 VIEW_STATE_AFTER_TRANSLATE,
27 // The view state when an error of Translate happens.
28 VIEW_STATE_ERROR,
30 // The view state when the detailed settings is shown. This view appears
31 // when the user click a link 'Advanced' on other views.
32 VIEW_STATE_ADVANCED,
35 virtual ~TranslateBubbleModel() {}
37 // Returns the current view state.
38 virtual ViewState GetViewState() const = 0;
40 // Transitions the view state.
41 virtual void SetViewState(ViewState view_state) = 0;
43 // Shows an error.
44 virtual void ShowError(translate::TranslateErrors::Type error_type) = 0;
46 // Goes back from the 'Advanced' view state.
47 virtual void GoBackFromAdvanced() = 0;
49 // Returns the number of languages supported.
50 virtual int GetNumberOfLanguages() const = 0;
52 // Returns the displayable name for the language at |index|.
53 virtual base::string16 GetLanguageNameAt(int index) const = 0;
55 // Returns the original language index.
56 virtual int GetOriginalLanguageIndex() const = 0;
58 // Updates the original language index.
59 virtual void UpdateOriginalLanguageIndex(int index) = 0;
61 // Returns the target language index.
62 virtual int GetTargetLanguageIndex() const = 0;
64 // Updates the target language index.
65 virtual void UpdateTargetLanguageIndex(int index) = 0;
67 // Sets the value if the user doesn't want to have the page translated in the
68 // current page's language.
69 virtual void SetNeverTranslateLanguage(bool value) = 0;
71 // Sets the value if the user doesn't want to have the page translated the
72 // current page's domain.
73 virtual void SetNeverTranslateSite(bool value) = 0;
75 // Returns true if the webpage in the current original language should be
76 // translated into the current target language automatically.
77 virtual bool ShouldAlwaysTranslate() const = 0;
79 // Sets the value if the webpage in the current original language should be
80 // translated into the current target language automatically.
81 virtual void SetAlwaysTranslate(bool value) = 0;
83 // Starts translating the current page.
84 virtual void Translate() = 0;
86 // Reverts translation.
87 virtual void RevertTranslation() = 0;
89 // Processes when the user dismiss the bubble without translating.
90 // |explicitly_closed| is true if the user explicitly closed the UI, for
91 // example, clicking 'Nope' button.
92 virtual void TranslationDeclined(bool explicitly_closed) = 0;
94 // Returns true if the page is translated in the currently selected source
95 // and target language.
96 virtual bool IsPageTranslatedInCurrentLanguages() const = 0;
99 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_