OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_ |
6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_ | 6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/translate/chrome_translate_client.h" | 10 #include "chrome/browser/translate/chrome_translate_client.h" |
11 #include "chrome/browser/ui/translate/translate_bubble_model.h" | 11 #include "chrome/browser/ui/translate/translate_bubble_model.h" |
12 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h" | 12 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h" |
13 | 13 |
| 14 namespace translate { |
14 class TranslateUIDelegate; | 15 class TranslateUIDelegate; |
| 16 } |
15 | 17 |
16 // The standard implementation of TranslateBubbleModel. | 18 // The standard implementation of TranslateBubbleModel. |
17 class TranslateBubbleModelImpl : public TranslateBubbleModel { | 19 class TranslateBubbleModelImpl : public TranslateBubbleModel { |
18 public: | 20 public: |
19 TranslateBubbleModelImpl(translate::TranslateStep step, | 21 TranslateBubbleModelImpl( |
20 scoped_ptr<TranslateUIDelegate> ui_delegate); | 22 translate::TranslateStep step, |
| 23 scoped_ptr<translate::TranslateUIDelegate> ui_delegate); |
21 virtual ~TranslateBubbleModelImpl(); | 24 virtual ~TranslateBubbleModelImpl(); |
22 | 25 |
23 // Converts a TranslateStep to a ViewState. | 26 // Converts a TranslateStep to a ViewState. |
24 // This function never returns VIEW_STATE_ADVANCED. | 27 // This function never returns VIEW_STATE_ADVANCED. |
25 static TranslateBubbleModel::ViewState TranslateStepToViewState( | 28 static TranslateBubbleModel::ViewState TranslateStepToViewState( |
26 translate::TranslateStep step); | 29 translate::TranslateStep step); |
27 | 30 |
28 // TranslateBubbleModel methods. | 31 // TranslateBubbleModel methods. |
29 virtual TranslateBubbleModel::ViewState GetViewState() const OVERRIDE; | 32 virtual TranslateBubbleModel::ViewState GetViewState() const OVERRIDE; |
30 virtual void SetViewState(TranslateBubbleModel::ViewState view_state) | 33 virtual void SetViewState(TranslateBubbleModel::ViewState view_state) |
31 OVERRIDE; | 34 OVERRIDE; |
32 virtual void ShowError(TranslateErrors::Type error_type) OVERRIDE; | 35 virtual void ShowError(translate::TranslateErrors::Type error_type) OVERRIDE; |
33 virtual void GoBackFromAdvanced() OVERRIDE; | 36 virtual void GoBackFromAdvanced() OVERRIDE; |
34 virtual int GetNumberOfLanguages() const OVERRIDE; | 37 virtual int GetNumberOfLanguages() const OVERRIDE; |
35 virtual base::string16 GetLanguageNameAt(int index) const OVERRIDE; | 38 virtual base::string16 GetLanguageNameAt(int index) const OVERRIDE; |
36 virtual int GetOriginalLanguageIndex() const OVERRIDE; | 39 virtual int GetOriginalLanguageIndex() const OVERRIDE; |
37 virtual void UpdateOriginalLanguageIndex(int index) OVERRIDE; | 40 virtual void UpdateOriginalLanguageIndex(int index) OVERRIDE; |
38 virtual int GetTargetLanguageIndex() const OVERRIDE; | 41 virtual int GetTargetLanguageIndex() const OVERRIDE; |
39 virtual void UpdateTargetLanguageIndex(int index) OVERRIDE; | 42 virtual void UpdateTargetLanguageIndex(int index) OVERRIDE; |
40 virtual void SetNeverTranslateLanguage(bool value) OVERRIDE; | 43 virtual void SetNeverTranslateLanguage(bool value) OVERRIDE; |
41 virtual void SetNeverTranslateSite(bool value) OVERRIDE; | 44 virtual void SetNeverTranslateSite(bool value) OVERRIDE; |
42 virtual bool ShouldAlwaysTranslate() const OVERRIDE; | 45 virtual bool ShouldAlwaysTranslate() const OVERRIDE; |
43 virtual void SetAlwaysTranslate(bool value) OVERRIDE; | 46 virtual void SetAlwaysTranslate(bool value) OVERRIDE; |
44 virtual void Translate() OVERRIDE; | 47 virtual void Translate() OVERRIDE; |
45 virtual void RevertTranslation() OVERRIDE; | 48 virtual void RevertTranslation() OVERRIDE; |
46 virtual void TranslationDeclined(bool explicitly_closed) OVERRIDE; | 49 virtual void TranslationDeclined(bool explicitly_closed) OVERRIDE; |
47 virtual bool IsPageTranslatedInCurrentLanguages() const OVERRIDE; | 50 virtual bool IsPageTranslatedInCurrentLanguages() const OVERRIDE; |
48 | 51 |
49 private: | 52 private: |
50 scoped_ptr<TranslateUIDelegate> ui_delegate_; | 53 scoped_ptr<translate::TranslateUIDelegate> ui_delegate_; |
51 TranslateBubbleViewStateTransition view_state_transition_; | 54 TranslateBubbleViewStateTransition view_state_transition_; |
52 | 55 |
53 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleModelImpl); | 56 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleModelImpl); |
54 }; | 57 }; |
55 | 58 |
56 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_ | 59 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_ |
OLD | NEW |