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 "components/translate/content/renderer/translate_helper.h" | 5 #include "components/translate/content/renderer/translate_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 TranslateErrors::Type error) { | 457 TranslateErrors::Type error) { |
458 DCHECK(translate_callback_pending_); | 458 DCHECK(translate_callback_pending_); |
459 // Notify the browser there was an error. | 459 // Notify the browser there was an error. |
460 translate_callback_pending_.Run(false, source_lang_, target_lang_, error); | 460 translate_callback_pending_.Run(false, source_lang_, target_lang_, error); |
461 translate_callback_pending_.Reset(); | 461 translate_callback_pending_.Reset(); |
462 } | 462 } |
463 | 463 |
464 const mojom::ContentTranslateDriverPtr& TranslateHelper::GetTranslateDriver() { | 464 const mojom::ContentTranslateDriverPtr& TranslateHelper::GetTranslateDriver() { |
465 if (!translate_driver_) { | 465 if (!translate_driver_) { |
466 render_frame()->GetRemoteInterfaces()->GetInterface( | 466 render_frame()->GetRemoteInterfaces()->GetInterface( |
467 mojo::GetProxy(&translate_driver_)); | 467 mojo::MakeRequest(&translate_driver_)); |
468 } | 468 } |
469 | 469 |
470 return translate_driver_; | 470 return translate_driver_; |
471 } | 471 } |
472 | 472 |
473 void TranslateHelper::ResetPage() { | 473 void TranslateHelper::ResetPage() { |
474 binding_.Close(); | 474 binding_.Close(); |
475 translate_callback_pending_.Reset(); | 475 translate_callback_pending_.Reset(); |
476 CancelPendingTranslation(); | 476 CancelPendingTranslation(); |
477 } | 477 } |
478 | 478 |
479 void TranslateHelper::OnDestruct() { | 479 void TranslateHelper::OnDestruct() { |
480 delete this; | 480 delete this; |
481 } | 481 } |
482 | 482 |
483 } // namespace translate | 483 } // namespace translate |
OLD | NEW |