| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "blimp/client/core/contents/blimp_contents_view_android.h" | 5 #include "blimp/client/core/contents/blimp_contents_view_android.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" | |
| 9 #include "blimp/client/core/contents/android/blimp_view.h" | 8 #include "blimp/client/core/contents/android/blimp_view.h" |
| 9 #include "blimp/client/core/contents/android/ime_helper_dialog.h" |
| 10 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 10 #include "cc/layers/layer.h" | 11 #include "cc/layers/layer.h" |
| 11 #include "ui/android/window_android.h" | 12 #include "ui/android/window_android.h" |
| 12 | 13 |
| 13 namespace blimp { | 14 namespace blimp { |
| 14 namespace client { | 15 namespace client { |
| 15 | 16 |
| 16 // static | 17 // static |
| 17 std::unique_ptr<BlimpContentsView> BlimpContentsView::Create( | 18 std::unique_ptr<BlimpContentsView> BlimpContentsView::Create( |
| 18 BlimpContentsImpl* blimp_contents, | 19 BlimpContentsImpl* blimp_contents, |
| 19 scoped_refptr<cc::Layer> contents_layer) { | 20 scoped_refptr<cc::Layer> contents_layer) { |
| 20 return base::MakeUnique<BlimpContentsViewAndroid>(blimp_contents, | 21 return base::MakeUnique<BlimpContentsViewAndroid>(blimp_contents, |
| 21 contents_layer); | 22 contents_layer); |
| 22 } | 23 } |
| 23 | 24 |
| 24 BlimpContentsViewAndroid::BlimpContentsViewAndroid( | 25 BlimpContentsViewAndroid::BlimpContentsViewAndroid( |
| 25 BlimpContentsImpl* blimp_contents, | 26 BlimpContentsImpl* blimp_contents, |
| 26 scoped_refptr<cc::Layer> contents_layer) { | 27 scoped_refptr<cc::Layer> contents_layer) |
| 28 : ime_dialog_(new ImeHelperDialog(blimp_contents->GetNativeWindow())) { |
| 27 blimp_view_ = base::MakeUnique<BlimpView>(blimp_contents); | 29 blimp_view_ = base::MakeUnique<BlimpView>(blimp_contents); |
| 28 view_ = base::MakeUnique<ui::ViewAndroid>( | 30 view_ = base::MakeUnique<ui::ViewAndroid>( |
| 29 blimp_view_->CreateViewAndroidDelegate()); | 31 blimp_view_->CreateViewAndroidDelegate()); |
| 30 view_->SetLayer(contents_layer); | 32 view_->SetLayer(contents_layer); |
| 31 blimp_contents->GetNativeWindow()->AddChild(view_.get()); | 33 blimp_contents->GetNativeWindow()->AddChild(view_.get()); |
| 32 } | 34 } |
| 33 | 35 |
| 34 BlimpContentsViewAndroid::~BlimpContentsViewAndroid() = default; | 36 BlimpContentsViewAndroid::~BlimpContentsViewAndroid() = default; |
| 35 | 37 |
| 36 gfx::NativeView BlimpContentsViewAndroid::GetNativeView() { | 38 gfx::NativeView BlimpContentsViewAndroid::GetNativeView() { |
| 37 return view_.get(); | 39 return view_.get(); |
| 38 } | 40 } |
| 39 | 41 |
| 40 BlimpView* BlimpContentsViewAndroid::GetBlimpView() { | 42 BlimpView* BlimpContentsViewAndroid::GetBlimpView() { |
| 41 return blimp_view_.get(); | 43 return blimp_view_.get(); |
| 42 } | 44 } |
| 43 | 45 |
| 46 ImeFeature::Delegate* BlimpContentsViewAndroid::GetImeDelegate() { |
| 47 return ime_dialog_.get(); |
| 48 } |
| 49 |
| 44 } // namespace client | 50 } // namespace client |
| 45 } // namespace blimp | 51 } // namespace blimp |
| OLD | NEW |