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

Side by Side Diff: chrome/browser/translate/translate_manager_render_view_host_unittest.cc

Issue 290573013: LanguageState should be owned by TranslateManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding TBR for CL Created 6 years, 6 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 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
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->GetTranslateManager()->GetWeakPtr(),
390 source_language, 390 source_language,
391 target_language)); 391 target_language));
392 model_.reset(new TranslateBubbleModelImpl(step, ui_delegate.Pass())); 392 model_.reset(new TranslateBubbleModelImpl(step, ui_delegate.Pass()));
393 } 393 }
394 394
395 TranslateBubbleModel* model() { return model_.get(); } 395 TranslateBubbleModel* model() { return model_.get(); }
396 396
397 private: 397 private:
398 scoped_ptr<TranslateBubbleModel> model_; 398 scoped_ptr<TranslateBubbleModel> model_;
399 399
400 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); 400 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory);
401 }; 401 };
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 // Check the bubble exists instead of the infobar. 1548 // Check the bubble exists instead of the infobar.
1549 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar(); 1549 TranslateInfoBarDelegate* infobar = GetTranslateInfoBar();
1550 ASSERT_TRUE(infobar == NULL); 1550 ASSERT_TRUE(infobar == NULL);
1551 TranslateBubbleModel* bubble = factory->model(); 1551 TranslateBubbleModel* bubble = factory->model();
1552 ASSERT_TRUE(bubble != NULL); 1552 ASSERT_TRUE(bubble != NULL);
1553 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING, 1553 EXPECT_EQ(TranslateBubbleModel::VIEW_STATE_TRANSLATING,
1554 bubble->GetViewState()); 1554 bubble->GetViewState());
1555 } 1555 }
1556 1556
1557 #endif // defined(USE_AURA) 1557 #endif // defined(USE_AURA)
OLDNEW
« no previous file with comments | « chrome/browser/translate/chrome_translate_client.cc ('k') | chrome/browser/ui/browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698