OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 }; | 330 }; |
331 | 331 |
332 class MockTranslateBubbleFactory : public TranslateBubbleFactory { | 332 class MockTranslateBubbleFactory : public TranslateBubbleFactory { |
333 public: | 333 public: |
334 MockTranslateBubbleFactory() { | 334 MockTranslateBubbleFactory() { |
335 } | 335 } |
336 | 336 |
337 virtual void ShowImplementation( | 337 virtual void ShowImplementation( |
338 BrowserWindow* window, | 338 BrowserWindow* window, |
339 content::WebContents* web_contents, | 339 content::WebContents* web_contents, |
340 TranslateBubbleModel::ViewState view_state) OVERRIDE { | 340 TranslateBubbleModel::ViewState view_state, |
| 341 TranslateErrors::Type error_type) OVERRIDE { |
341 if (model_) { | 342 if (model_) { |
342 model_->SetViewState(view_state); | 343 model_->SetViewState(view_state); |
343 return; | 344 return; |
344 } | 345 } |
345 | 346 |
346 TranslateTabHelper* translate_tab_helper = | 347 TranslateTabHelper* translate_tab_helper = |
347 TranslateTabHelper::FromWebContents(web_contents); | 348 TranslateTabHelper::FromWebContents(web_contents); |
348 std::string source_language = | 349 std::string source_language = |
349 translate_tab_helper->language_state().original_language(); | 350 translate_tab_helper->language_state().original_language(); |
350 std::string target_language = TranslateManager::GetLanguageCode( | 351 std::string target_language = TranslateManager::GetLanguageCode( |
351 g_browser_process->GetApplicationLocale()); | 352 g_browser_process->GetApplicationLocale()); |
352 scoped_ptr<TranslateUIDelegate> ui_delegate( | 353 scoped_ptr<TranslateUIDelegate> ui_delegate( |
353 new TranslateUIDelegate(web_contents, | 354 new TranslateUIDelegate(web_contents, |
354 source_language, | 355 source_language, |
355 target_language)); | 356 target_language, |
| 357 error_type)); |
356 model_.reset( | 358 model_.reset( |
357 new TranslateBubbleModelImpl(view_state, ui_delegate.Pass())); | 359 new TranslateBubbleModelImpl(view_state, ui_delegate.Pass())); |
358 } | 360 } |
359 | 361 |
360 TranslateBubbleModel* model() { return model_.get(); } | 362 TranslateBubbleModel* model() { return model_.get(); } |
361 | 363 |
362 private: | 364 private: |
363 scoped_ptr<TranslateBubbleModel> model_; | 365 scoped_ptr<TranslateBubbleModel> model_; |
364 | 366 |
365 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); | 367 DISALLOW_COPY_AND_ASSIGN(MockTranslateBubbleFactory); |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 content::WebContents* current_web_contents = | 1611 content::WebContents* current_web_contents = |
1610 browser()->tab_strip_model()->GetActiveWebContents(); | 1612 browser()->tab_strip_model()->GetActiveWebContents(); |
1611 content::Source<content::WebContents> source(current_web_contents); | 1613 content::Source<content::WebContents> source(current_web_contents); |
1612 | 1614 |
1613 ui_test_utils::WindowedNotificationObserverWithDetails< | 1615 ui_test_utils::WindowedNotificationObserverWithDetails< |
1614 LanguageDetectionDetails> | 1616 LanguageDetectionDetails> |
1615 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, | 1617 fr_language_detected_signal(chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, |
1616 source); | 1618 source); |
1617 fr_language_detected_signal.Wait(); | 1619 fr_language_detected_signal.Wait(); |
1618 } | 1620 } |
OLD | NEW |