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_IMPL_H_
6 #define CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/translate/chrome_translate_client.h"
11 #include "chrome/browser/ui/translate/translate_bubble_model.h"
12 #include "chrome/browser/ui/translate/translate_bubble_view_state_transition.h"
15 class TranslateUIDelegate
;
18 // The standard implementation of TranslateBubbleModel.
19 class TranslateBubbleModelImpl
: public TranslateBubbleModel
{
21 TranslateBubbleModelImpl(
22 translate::TranslateStep step
,
23 scoped_ptr
<translate::TranslateUIDelegate
> ui_delegate
);
24 ~TranslateBubbleModelImpl() override
;
26 // Converts a TranslateStep to a ViewState.
27 // This function never returns VIEW_STATE_ADVANCED.
28 static TranslateBubbleModel::ViewState
TranslateStepToViewState(
29 translate::TranslateStep step
);
31 // TranslateBubbleModel methods.
32 TranslateBubbleModel::ViewState
GetViewState() const override
;
33 void SetViewState(TranslateBubbleModel::ViewState view_state
) override
;
34 void ShowError(translate::TranslateErrors::Type error_type
) override
;
35 void GoBackFromAdvanced() override
;
36 int GetNumberOfLanguages() const override
;
37 base::string16
GetLanguageNameAt(int index
) const override
;
38 int GetOriginalLanguageIndex() const override
;
39 void UpdateOriginalLanguageIndex(int index
) override
;
40 int GetTargetLanguageIndex() const override
;
41 void UpdateTargetLanguageIndex(int index
) override
;
42 void SetNeverTranslateLanguage(bool value
) override
;
43 void SetNeverTranslateSite(bool value
) override
;
44 bool ShouldAlwaysTranslate() const override
;
45 void SetAlwaysTranslate(bool value
) override
;
46 void Translate() override
;
47 void RevertTranslation() override
;
48 void TranslationDeclined(bool explicitly_closed
) override
;
49 bool IsPageTranslatedInCurrentLanguages() const override
;
52 scoped_ptr
<translate::TranslateUIDelegate
> ui_delegate_
;
53 TranslateBubbleViewStateTransition view_state_transition_
;
55 DISALLOW_COPY_AND_ASSIGN(TranslateBubbleModelImpl
);
58 #endif // CHROME_BROWSER_UI_TRANSLATE_TRANSLATE_BUBBLE_MODEL_IMPL_H_