| 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" |   8 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" | 
 |   9 #include "blimp/client/core/contents/android/blimp_view.h" | 
|   9 #include "cc/layers/layer.h" |  10 #include "cc/layers/layer.h" | 
 |  11 #include "ui/android/window_android.h" | 
|  10  |  12  | 
|  11 namespace blimp { |  13 namespace blimp { | 
|  12 namespace client { |  14 namespace client { | 
|  13  |  15  | 
|  14 // static |  16 // static | 
|  15 std::unique_ptr<BlimpContentsView> BlimpContentsView::Create( |  17 std::unique_ptr<BlimpContentsView> BlimpContentsView::Create( | 
|  16     BlimpContentsImpl* blimp_contents, |  18     BlimpContentsImpl* blimp_contents, | 
|  17     scoped_refptr<cc::Layer> contents_layer) { |  19     scoped_refptr<cc::Layer> contents_layer) { | 
|  18   return base::MakeUnique<BlimpContentsViewAndroid>( |  20   return base::MakeUnique<BlimpContentsViewAndroid>(blimp_contents, | 
|  19       blimp_contents->GetBlimpContentsImplAndroid(), contents_layer); |  21                                                     contents_layer); | 
|  20 } |  22 } | 
|  21  |  23  | 
|  22 BlimpContentsViewAndroid::BlimpContentsViewAndroid( |  24 BlimpContentsViewAndroid::BlimpContentsViewAndroid( | 
|  23     BlimpContentsImplAndroid* blimp_contents, |  25     BlimpContentsImpl* blimp_contents, | 
|  24     scoped_refptr<cc::Layer> contents_layer) { |  26     scoped_refptr<cc::Layer> contents_layer) { | 
|  25   // TODO(khushalsagar): Get the ViewAndroidDelegate from java after it has a |  27   blimp_view_ = base::MakeUnique<BlimpView>(blimp_contents); | 
|  26   // BlimpView. Also get the WindowAndroid so this view can add itself as a |  28   view_ = base::MakeUnique<ui::ViewAndroid>( | 
|  27   // child to it. |  29       blimp_view_->CreateViewAndroidDelegate()); | 
|  28   view_.SetLayer(contents_layer); |  30   view_->SetLayer(contents_layer); | 
 |  31   blimp_contents->GetNativeWindow()->AddChild(view_.get()); | 
|  29 } |  32 } | 
|  30  |  33  | 
 |  34 BlimpContentsViewAndroid::~BlimpContentsViewAndroid() = default; | 
 |  35  | 
|  31 gfx::NativeView BlimpContentsViewAndroid::GetNativeView() { |  36 gfx::NativeView BlimpContentsViewAndroid::GetNativeView() { | 
|  32   return &view_; |  37   return view_.get(); | 
 |  38 } | 
 |  39  | 
 |  40 BlimpView* BlimpContentsViewAndroid::GetBlimpView() { | 
 |  41   return blimp_view_.get(); | 
|  33 } |  42 } | 
|  34  |  43  | 
|  35 }  // namespace client |  44 }  // namespace client | 
|  36 }  // namespace blimp |  45 }  // namespace blimp | 
| OLD | NEW |