OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 TranslateBubbleModelImpl::TranslateStepToViewState(step)); | 380 TranslateBubbleModelImpl::TranslateStepToViewState(step)); |
381 return; | 381 return; |
382 } | 382 } |
383 | 383 |
384 TranslateTabHelper* translate_tab_helper = | 384 TranslateTabHelper* translate_tab_helper = |
385 TranslateTabHelper::FromWebContents(web_contents); | 385 TranslateTabHelper::FromWebContents(web_contents); |
386 std::string source_language = | 386 std::string source_language = |
387 translate_tab_helper->GetLanguageState().original_language(); | 387 translate_tab_helper->GetLanguageState().original_language(); |
388 std::string target_language = TranslateDownloadManager::GetLanguageCode( | 388 std::string target_language = TranslateDownloadManager::GetLanguageCode( |
389 g_browser_process->GetApplicationLocale()); | 389 g_browser_process->GetApplicationLocale()); |
390 scoped_ptr<TranslateUIDelegate> ui_delegate(new TranslateUIDelegate( | 390 scoped_ptr<TranslateUIDelegate> ui_delegate( |
391 web_contents, source_language, target_language)); | 391 new TranslateUIDelegate(translate_tab_helper, |
| 392 translate_tab_helper->GetTranslateManager(), |
| 393 source_language, |
| 394 target_language)); |
392 model_.reset(new TranslateBubbleModelImpl(step, ui_delegate.Pass())); | 395 model_.reset(new TranslateBubbleModelImpl(step, ui_delegate.Pass())); |
393 } | 396 } |
394 | 397 |
395 TranslateBubbleModel* model() { return model_.get(); } | 398 TranslateBubbleModel* model() { return model_.get(); } |
396 | 399 |
397 private: | 400 private: |
398 scoped_ptr<TranslateBubbleModel> model_; | 401 scoped_ptr<TranslateBubbleModel> model_; |
399 | 402 |
400 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); | 403 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); |
401 }; | 404 }; |
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 // Check the bubble exists instead of the infobar. | 1550 // Check the bubble exists instead of the infobar. |
1548 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 1551 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
1549 ASSERT_TRUE(infobar == NULL); | 1552 ASSERT_TRUE(infobar == NULL); |
1550 TranslateBubbleModel* bubble = factory->model(); | 1553 TranslateBubbleModel* bubble = factory->model(); |
1551 ASSERT_TRUE(bubble != NULL); | 1554 ASSERT_TRUE(bubble != NULL); |
1552 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, | 1555 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, |
1553 bubble->GetViewState()); | 1556 bubble->GetViewState()); |
1554 } | 1557 } |
1555 | 1558 |
1556 #endif // defined(USE_AURA) | 1559 #endif // defined(USE_AURA) |
OLD | NEW |