| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 TranslateBubbleModelImpl::TranslateStepToViewState(step)); | 377 TranslateBubbleModelImpl::TranslateStepToViewState(step)); |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 | 380 |
| 381 ChromeTranslateClient* chrome_translate_client = | 381 ChromeTranslateClient* chrome_translate_client = |
| 382 ChromeTranslateClient::FromWebContents(web_contents); | 382 ChromeTranslateClient::FromWebContents(web_contents); |
| 383 std::string source_language = | 383 std::string source_language = |
| 384 chrome_translate_client->GetLanguageState().original_language(); | 384 chrome_translate_client->GetLanguageState().original_language(); |
| 385 std::string target_language = TranslateDownloadManager::GetLanguageCode( | 385 std::string target_language = TranslateDownloadManager::GetLanguageCode( |
| 386 g_browser_process->GetApplicationLocale()); | 386 g_browser_process->GetApplicationLocale()); |
| 387 scoped_ptr<TranslateUIDelegate> ui_delegate( | 387 |
| 388 new TranslateUIDelegate(chrome_translate_client, | 388 scoped_ptr<TranslateUIDelegate> ui_delegate(new TranslateUIDelegate( |
| 389 chrome_translate_client->GetTranslateManager(), | 389 chrome_translate_client, |
| 390 source_language, | 390 chrome_translate_client->GetTranslateManager()->GetWeakPtr(), |
| 391 target_language)); | 391 source_language, |
| 392 target_language)); |
| 392 model_.reset(new TranslateBubbleModelImpl(step, ui_delegate.Pass())); | 393 model_.reset(new TranslateBubbleModelImpl(step, ui_delegate.Pass())); |
| 393 } | 394 } |
| 394 | 395 |
| 395 TranslateBubbleModel* model() { return model_.get(); } | 396 TranslateBubbleModel* model() { return model_.get(); } |
| 396 | 397 |
| 397 private: | 398 private: |
| 398 scoped_ptr<TranslateBubbleModel> model_; | 399 scoped_ptr<TranslateBubbleModel> model_; |
| 399 | 400 |
| 400 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); | 401 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); |
| 401 }; | 402 }; |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 // Check the bubble exists instead of the infobar. | 1549 // Check the bubble exists instead of the infobar. |
| 1549 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); | 1550 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); |
| 1550 ASSERT_TRUE(infobar == NULL); | 1551 ASSERT_TRUE(infobar == NULL); |
| 1551 TranslateBubbleModel* bubble = factory->model(); | 1552 TranslateBubbleModel* bubble = factory->model(); |
| 1552 ASSERT_TRUE(bubble != NULL); | 1553 ASSERT_TRUE(bubble != NULL); |
| 1553 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, | 1554 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, |
| 1554 bubble->GetViewState()); | 1555 bubble->GetViewState()); |
| 1555 } | 1556 } |
| 1556 | 1557 |
| 1557 #endif // defined(USE_AURA) | 1558 #endif // defined(USE_AURA) |
| OLD | NEW |