| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/android/infobars/translate_infobar.h" | 5 #include "chrome/browser/ui/android/infobars/translate_infobar.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 11 #include "base/android/jni_array.h" |
| 11 #include "base/android/jni_string.h" | 12 #include "base/android/jni_string.h" |
| 12 #include "base/android/jni_weak_ref.h" | 13 #include "base/android/jni_weak_ref.h" |
| 13 #include "chrome/browser/translate/chrome_translate_client.h" | 14 #include "chrome/browser/translate/chrome_translate_client.h" |
| 14 #include "components/translate/core/browser/translate_infobar_delegate.h" | 15 #include "components/translate/core/browser/translate_infobar_delegate.h" |
| 15 #include "jni/TranslateInfoBar_jni.h" | 16 #include "jni/TranslateInfoBar_jni.h" |
| 16 | 17 |
| 17 // ChromeTranslateClient | 18 // ChromeTranslateClient |
| 18 // ---------------------------------------------------------- | 19 // ---------------------------------------------------------- |
| 19 | 20 |
| 20 scoped_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar( | 21 scoped_ptr<infobars::InfoBar> ChromeTranslateClient::CreateInfoBar( |
| 21 scoped_ptr<translate::TranslateInfoBarDelegate> delegate) const { | 22 scoped_ptr<translate::TranslateInfoBarDelegate> delegate) const { |
| 22 return make_scoped_ptr(new TranslateInfoBar(delegate.Pass())); | 23 return make_scoped_ptr(new TranslateInfoBar(std::move(delegate))); |
| 23 } | 24 } |
| 24 | 25 |
| 25 | 26 |
| 26 // TranslateInfoBar ----------------------------------------------------------- | 27 // TranslateInfoBar ----------------------------------------------------------- |
| 27 | 28 |
| 28 TranslateInfoBar::TranslateInfoBar( | 29 TranslateInfoBar::TranslateInfoBar( |
| 29 scoped_ptr<translate::TranslateInfoBarDelegate> delegate) | 30 scoped_ptr<translate::TranslateInfoBarDelegate> delegate) |
| 30 : InfoBarAndroid(delegate.Pass()) { | 31 : InfoBarAndroid(std::move(delegate)) {} |
| 31 } | |
| 32 | 32 |
| 33 TranslateInfoBar::~TranslateInfoBar() { | 33 TranslateInfoBar::~TranslateInfoBar() { |
| 34 } | 34 } |
| 35 | 35 |
| 36 ScopedJavaLocalRef<jobject> TranslateInfoBar::CreateRenderInfoBar(JNIEnv* env) { | 36 ScopedJavaLocalRef<jobject> TranslateInfoBar::CreateRenderInfoBar(JNIEnv* env) { |
| 37 translate::TranslateInfoBarDelegate* delegate = GetDelegate(); | 37 translate::TranslateInfoBarDelegate* delegate = GetDelegate(); |
| 38 std::vector<base::string16> languages; | 38 std::vector<base::string16> languages; |
| 39 std::vector<std::string> codes; | 39 std::vector<std::string> codes; |
| 40 languages.reserve(delegate->num_languages()); | 40 languages.reserve(delegate->num_languages()); |
| 41 codes.reserve(delegate->num_languages()); | 41 codes.reserve(delegate->num_languages()); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() { | 148 translate::TranslateInfoBarDelegate* TranslateInfoBar::GetDelegate() { |
| 149 return delegate()->AsTranslateInfoBarDelegate(); | 149 return delegate()->AsTranslateInfoBarDelegate(); |
| 150 } | 150 } |
| 151 | 151 |
| 152 | 152 |
| 153 // Native JNI methods --------------------------------------------------------- | 153 // Native JNI methods --------------------------------------------------------- |
| 154 | 154 |
| 155 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { | 155 bool RegisterTranslateInfoBarDelegate(JNIEnv* env) { |
| 156 return RegisterNativesImpl(env); | 156 return RegisterNativesImpl(env); |
| 157 } | 157 } |
| OLD | NEW |