Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Side by Side Diff: chrome/browser/ui/translate/translate_bubble_model_impl.cc

Issue 378253002: Fix translate namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h" 5 #include "chrome/browser/ui/translate/translate_bubble_model_impl.h"
6 6
7 #include "chrome/browser/translate/chrome_translate_client.h" 7 #include "chrome/browser/translate/chrome_translate_client.h"
8 #include "components/translate/core/browser/language_state.h" 8 #include "components/translate/core/browser/language_state.h"
9 #include "components/translate/core/browser/translate_ui_delegate.h" 9 #include "components/translate/core/browser/translate_ui_delegate.h"
10 10
11 TranslateBubbleModelImpl::TranslateBubbleModelImpl( 11 TranslateBubbleModelImpl::TranslateBubbleModelImpl(
12 translate::TranslateStep step, 12 translate::TranslateStep step,
13 scoped_ptr<TranslateUIDelegate> ui_delegate) 13 scoped_ptr<translate::TranslateUIDelegate> ui_delegate)
14 : ui_delegate_(ui_delegate.Pass()), 14 : ui_delegate_(ui_delegate.Pass()),
15 view_state_transition_(TranslateStepToViewState(step)) {} 15 view_state_transition_(TranslateStepToViewState(step)) {
16 }
16 17
17 TranslateBubbleModelImpl::~TranslateBubbleModelImpl() { 18 TranslateBubbleModelImpl::~TranslateBubbleModelImpl() {
18 } 19 }
19 20
20 // static 21 // static
21 TranslateBubbleModel::ViewState 22 TranslateBubbleModel::ViewState
22 TranslateBubbleModelImpl::TranslateStepToViewState( 23 TranslateBubbleModelImpl::TranslateStepToViewState(
23 translate::TranslateStep step) { 24 translate::TranslateStep step) {
24 switch (step) { 25 switch (step) {
25 case translate::TRANSLATE_STEP_BEFORE_TRANSLATE: 26 case translate::TRANSLATE_STEP_BEFORE_TRANSLATE:
(...skipping 12 matching lines...) Expand all
38 39
39 TranslateBubbleModel::ViewState TranslateBubbleModelImpl::GetViewState() const { 40 TranslateBubbleModel::ViewState TranslateBubbleModelImpl::GetViewState() const {
40 return view_state_transition_.view_state(); 41 return view_state_transition_.view_state();
41 } 42 }
42 43
43 void TranslateBubbleModelImpl::SetViewState( 44 void TranslateBubbleModelImpl::SetViewState(
44 TranslateBubbleModel::ViewState view_state) { 45 TranslateBubbleModel::ViewState view_state) {
45 view_state_transition_.SetViewState(view_state); 46 view_state_transition_.SetViewState(view_state);
46 } 47 }
47 48
48 void TranslateBubbleModelImpl::ShowError(TranslateErrors::Type error_type) { 49 void TranslateBubbleModelImpl::ShowError(
50 translate::TranslateErrors::Type error_type) {
49 ui_delegate_->OnErrorShown(error_type); 51 ui_delegate_->OnErrorShown(error_type);
50 } 52 }
51 53
52 void TranslateBubbleModelImpl::GoBackFromAdvanced() { 54 void TranslateBubbleModelImpl::GoBackFromAdvanced() {
53 view_state_transition_.GoBackFromAdvanced(); 55 view_state_transition_.GoBackFromAdvanced();
54 } 56 }
55 57
56 int TranslateBubbleModelImpl::GetNumberOfLanguages() const { 58 int TranslateBubbleModelImpl::GetNumberOfLanguages() const {
57 return ui_delegate_->GetNumberOfLanguages(); 59 return ui_delegate_->GetNumberOfLanguages();
58 } 60 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 101
100 void TranslateBubbleModelImpl::RevertTranslation() { 102 void TranslateBubbleModelImpl::RevertTranslation() {
101 ui_delegate_->RevertTranslation(); 103 ui_delegate_->RevertTranslation();
102 } 104 }
103 105
104 void TranslateBubbleModelImpl::TranslationDeclined(bool explicitly_closed) { 106 void TranslateBubbleModelImpl::TranslationDeclined(bool explicitly_closed) {
105 ui_delegate_->TranslationDeclined(explicitly_closed); 107 ui_delegate_->TranslationDeclined(explicitly_closed);
106 } 108 }
107 109
108 bool TranslateBubbleModelImpl::IsPageTranslatedInCurrentLanguages() const { 110 bool TranslateBubbleModelImpl::IsPageTranslatedInCurrentLanguages() const {
109 const LanguageState& language_state = ui_delegate_->GetLanguageState(); 111 const translate::LanguageState& language_state =
112 ui_delegate_->GetLanguageState();
110 return ui_delegate_->GetOriginalLanguageCode() == 113 return ui_delegate_->GetOriginalLanguageCode() ==
111 language_state.original_language() && 114 language_state.original_language() &&
112 ui_delegate_->GetTargetLanguageCode() == 115 ui_delegate_->GetTargetLanguageCode() ==
113 language_state.current_language(); 116 language_state.current_language();
114 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698