blob: 85b6cec4a1b7ec6368c5db920def675cb7d05e87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_
#define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_
#include <string>
#include "base/strings/string16.h"
#include "chrome/common/translate/translate_errors.h"
// The model for the Translate bubble UX. This manages the user's manipulation
// of the bubble and offers the data to show on the bubble.
class TranslateBubbleModel {
public:
enum ViewState {
// The view state before translating.
VIEW_STATE_BEFORE_TRANSLATE,
// The view state during translating.
VIEW_STATE_TRANSLATING,
// The view state after translating.
VIEW_STATE_AFTER_TRANSLATE,
// The view state when an error of Translate happens.
VIEW_STATE_ERROR,
// The view state when the detailed settings is shown. This view appears
// when the user click a link 'Advanced' on other views.
VIEW_STATE_ADVANCED,
};
virtual ~TranslateBubbleModel() {}
// Returns the current view state.
virtual ViewState GetViewState() const = 0;
// Transitions the view state.
virtual void SetViewState(ViewState view_state) = 0;
// Returns the error type.
virtual TranslateErrors::Type GetErrorType() const = 0;
// Sets the error type.
virtual void SetErrorType(TranslateErrors::Type error_type) = 0;
// Goes back from the 'Advanced' view state.
virtual void GoBackFromAdvanced() = 0;
// Returns the number of languages supported.
virtual int GetNumberOfLanguages() const = 0;
// Returns the displayable name for the language at |index|.
virtual base::string16 GetLanguageNameAt(int index) const = 0;
// Returns the original language index.
virtual int GetOriginalLanguageIndex() const = 0;
// Updates the original language index.
virtual void UpdateOriginalLanguageIndex(int index) = 0;
// Returns the target language index.
virtual int GetTargetLanguageIndex() const = 0;
// Updates the target language index.
virtual void UpdateTargetLanguageIndex(int index) = 0;
// Sets the value if the user doesn't want to have the page translated in the
// current page's language.
virtual void SetNeverTranslateLanguage(bool value) = 0;
// Sets the value if the user doesn't want to have the page translated the
// current page's domain.
virtual void SetNeverTranslateSite(bool value) = 0;
// Returns true if the webpage in the current original language should be
// translated into the current target language automatically.
virtual bool ShouldAlwaysTranslate() const = 0;
// Sets the value if the webpage in the current original language should be
// translated into the current target language automatically.
virtual void SetAlwaysTranslate(bool value) = 0;
// Starts translating the current page.
virtual void Translate() = 0;
// Reverts translation.
virtual void RevertTranslation() = 0;
// Processes when the user declines translation.
virtual void TranslationDeclined() = 0;
// Returns true if the page is translated in the currently selected source
// and target language.
virtual bool IsPageTranslatedInCurrentLanguages() const = 0;
};
#endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_H_
|