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 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" | 5 #include "chrome/browser/ui/views/translate/translate_bubble_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 return; | 136 return; |
137 } | 137 } |
138 | 138 |
139 std::string source_language; | 139 std::string source_language; |
140 std::string target_language; | 140 std::string target_language; |
141 ChromeTranslateClient::GetTranslateLanguages( | 141 ChromeTranslateClient::GetTranslateLanguages( |
142 web_contents, &source_language, &target_language); | 142 web_contents, &source_language, &target_language); |
143 | 143 |
144 scoped_ptr<TranslateUIDelegate> ui_delegate(new TranslateUIDelegate( | 144 scoped_ptr<TranslateUIDelegate> ui_delegate(new TranslateUIDelegate( |
145 ChromeTranslateClient::FromWebContents(web_contents), | 145 ChromeTranslateClient::GetManagerFromWebContents(web_contents) |
146 ChromeTranslateClient::GetManagerFromWebContents(web_contents), | 146 ->GetWeakPtr(), |
147 source_language, | 147 source_language, |
148 target_language)); | 148 target_language)); |
149 scoped_ptr<TranslateBubbleModel> model( | 149 scoped_ptr<TranslateBubbleModel> model( |
150 new TranslateBubbleModelImpl(step, ui_delegate.Pass())); | 150 new TranslateBubbleModelImpl(step, ui_delegate.Pass())); |
151 TranslateBubbleView* view = new TranslateBubbleView(anchor_view, | 151 TranslateBubbleView* view = new TranslateBubbleView(anchor_view, |
152 model.Pass(), | 152 model.Pass(), |
153 error_type, | 153 error_type, |
154 web_contents); | 154 web_contents); |
155 views::BubbleDelegateView::CreateBubble(view)->Show(); | 155 views::BubbleDelegateView::CreateBubble(view)->Show(); |
156 } | 156 } |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 model_->ShouldAlwaysTranslate()); | 765 model_->ShouldAlwaysTranslate()); |
766 } | 766 } |
767 | 767 |
768 base::string16 label; | 768 base::string16 label; |
769 if (model_->IsPageTranslatedInCurrentLanguages()) | 769 if (model_->IsPageTranslatedInCurrentLanguages()) |
770 label = l10n_util::GetStringUTF16(IDS_DONE); | 770 label = l10n_util::GetStringUTF16(IDS_DONE); |
771 else | 771 else |
772 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); | 772 label = l10n_util::GetStringUTF16(IDS_TRANSLATE_BUBBLE_ACCEPT); |
773 advanced_done_button_->SetText(label); | 773 advanced_done_button_->SetText(label); |
774 } | 774 } |
OLD | NEW |