| 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/tab_control_feature.h" |
| 9 #include "blimp/client/public/contents/blimp_contents_observer.h" | 10 #include "blimp/client/public/contents/blimp_contents_observer.h" |
| 10 | 11 |
| 11 #if defined(OS_ANDROID) | 12 #if defined(OS_ANDROID) |
| 12 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" | 13 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" |
| 13 #endif // OS_ANDROID | 14 #endif // OS_ANDROID |
| 14 | 15 |
| 15 namespace blimp { | 16 namespace blimp { |
| 16 namespace client { | 17 namespace client { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
| 21 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; | 22 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; |
| 22 #endif // OS_ANDROID | 23 #endif // OS_ANDROID |
| 23 } | 24 } |
| 24 | 25 |
| 25 BlimpContentsImpl::BlimpContentsImpl(int id) | 26 BlimpContentsImpl::BlimpContentsImpl(int id, |
| 26 : navigation_controller_(this, nullptr), id_(id) {} | 27 TabControlFeature* tab_control_feature) |
| 28 : navigation_controller_(this, nullptr), |
| 29 id_(id), |
| 30 tab_control_feature_(tab_control_feature) {} |
| 27 | 31 |
| 28 BlimpContentsImpl::~BlimpContentsImpl() { | 32 BlimpContentsImpl::~BlimpContentsImpl() { |
| 29 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); | 33 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); |
| 30 } | 34 } |
| 31 | 35 |
| 32 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
| 33 | 37 |
| 34 base::android::ScopedJavaLocalRef<jobject> | 38 base::android::ScopedJavaLocalRef<jobject> |
| 35 BlimpContentsImpl::GetJavaBlimpContentsImpl() { | 39 BlimpContentsImpl::GetJavaBlimpContentsImpl() { |
| 36 return GetBlimpContentsImplAndroid()->GetJavaObject(); | 40 return GetBlimpContentsImplAndroid()->GetJavaObject(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 63 | 67 |
| 64 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { | 68 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { |
| 65 return observers_.HasObserver(observer); | 69 return observers_.HasObserver(observer); |
| 66 } | 70 } |
| 67 | 71 |
| 68 void BlimpContentsImpl::OnNavigationStateChanged() { | 72 void BlimpContentsImpl::OnNavigationStateChanged() { |
| 69 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 73 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 70 OnNavigationStateChanged()); | 74 OnNavigationStateChanged()); |
| 71 } | 75 } |
| 72 | 76 |
| 77 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, |
| 78 float device_pixel_ratio) { |
| 79 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); |
| 80 } |
| 81 |
| 73 } // namespace client | 82 } // namespace client |
| 74 } // namespace blimp | 83 } // namespace blimp |
| OLD | NEW |