| 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_impl.h" | 5 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
| 9 #include "blimp/client/core/contents/blimp_contents_view.h" | 9 #include "blimp/client/core/contents/blimp_contents_view.h" |
| 10 #include "blimp/client/core/contents/tab_control_feature.h" | 10 #include "blimp/client/core/contents/tab_control_feature.h" |
| 11 #include "blimp/client/public/contents/blimp_contents_observer.h" | 11 #include "blimp/client/public/contents/blimp_contents_observer.h" |
| 12 | 12 |
| 13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
| 14 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" | 14 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" |
| 15 #endif // OS_ANDROID | 15 #endif // OS_ANDROID |
| 16 | 16 |
| 17 namespace blimp { | 17 namespace blimp { |
| 18 namespace client { | 18 namespace client { |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
| 23 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; | 23 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; |
| 24 #endif // OS_ANDROID | 24 #endif // OS_ANDROID |
| 25 } | 25 } |
| 26 | 26 |
| 27 BlimpContentsImpl::BlimpContentsImpl(int id, | 27 BlimpContentsImpl::BlimpContentsImpl( |
| 28 ImeFeature* ime_feature, | 28 int id, |
| 29 NavigationFeature* navigation_feature, | 29 BlimpCompositorDependencies* compositor_deps, |
| 30 TabControlFeature* tab_control_feature) | 30 ImeFeature* ime_feature, |
| 31 NavigationFeature* navigation_feature, |
| 32 RenderWidgetFeature* render_widget_feature, |
| 33 TabControlFeature* tab_control_feature) |
| 31 : navigation_controller_(this, navigation_feature), | 34 : navigation_controller_(this, navigation_feature), |
| 35 compositor_manager_(render_widget_feature, compositor_deps), |
| 32 id_(id), | 36 id_(id), |
| 33 tab_control_feature_(tab_control_feature) { | 37 tab_control_feature_(tab_control_feature) { |
| 34 blimp_contents_view_ = BlimpContentsView::Create(this); | 38 blimp_contents_view_ = |
| 39 BlimpContentsView::Create(this, compositor_manager_.layer()); |
| 35 } | 40 } |
| 36 | 41 |
| 37 BlimpContentsImpl::~BlimpContentsImpl() { | 42 BlimpContentsImpl::~BlimpContentsImpl() { |
| 38 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); | 43 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); |
| 39 } | 44 } |
| 40 | 45 |
| 41 #if defined(OS_ANDROID) | 46 #if defined(OS_ANDROID) |
| 42 | 47 |
| 43 base::android::ScopedJavaLocalRef<jobject> BlimpContentsImpl::GetJavaObject() { | 48 base::android::ScopedJavaLocalRef<jobject> BlimpContentsImpl::GetJavaObject() { |
| 44 return GetBlimpContentsImplAndroid()->GetJavaObject(); | 49 return GetBlimpContentsImplAndroid()->GetJavaObject(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 66 } | 71 } |
| 67 | 72 |
| 68 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { | 73 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { |
| 69 observers_.RemoveObserver(observer); | 74 observers_.RemoveObserver(observer); |
| 70 } | 75 } |
| 71 | 76 |
| 72 gfx::NativeView BlimpContentsImpl::GetNativeView() { | 77 gfx::NativeView BlimpContentsImpl::GetNativeView() { |
| 73 return blimp_contents_view_->GetNativeView(); | 78 return blimp_contents_view_->GetNativeView(); |
| 74 } | 79 } |
| 75 | 80 |
| 81 void BlimpContentsImpl::Show() { |
| 82 compositor_manager_.SetVisible(true); |
| 83 } |
| 84 |
| 85 void BlimpContentsImpl::Hide() { |
| 86 compositor_manager_.SetVisible(false); |
| 87 } |
| 88 |
| 76 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { | 89 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { |
| 77 return observers_.HasObserver(observer); | 90 return observers_.HasObserver(observer); |
| 78 } | 91 } |
| 79 | 92 |
| 80 void BlimpContentsImpl::OnNavigationStateChanged() { | 93 void BlimpContentsImpl::OnNavigationStateChanged() { |
| 81 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 94 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 82 OnNavigationStateChanged()); | 95 OnNavigationStateChanged()); |
| 83 } | 96 } |
| 84 | 97 |
| 85 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, | 98 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, |
| 86 float device_pixel_ratio) { | 99 float device_pixel_ratio) { |
| 87 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); | 100 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); |
| 88 } | 101 } |
| 89 | 102 |
| 90 } // namespace client | 103 } // namespace client |
| 91 } // namespace blimp | 104 } // namespace blimp |
| OLD | NEW |