| 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/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 10 #include "blimp/client/core/contents/tab_control_feature.h" | 10 #include "blimp/client/core/contents/tab_control_feature.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 BlimpContentsImplAndroid* blimp_contents_impl_android = | 60 BlimpContentsImplAndroid* blimp_contents_impl_android = |
| 61 static_cast<BlimpContentsImplAndroid*>( | 61 static_cast<BlimpContentsImplAndroid*>( |
| 62 GetUserData(kBlimpContentsImplAndroidKey)); | 62 GetUserData(kBlimpContentsImplAndroidKey)); |
| 63 if (!blimp_contents_impl_android) { | 63 if (!blimp_contents_impl_android) { |
| 64 blimp_contents_impl_android = new BlimpContentsImplAndroid(this); | 64 blimp_contents_impl_android = new BlimpContentsImplAndroid(this); |
| 65 SetUserData(kBlimpContentsImplAndroidKey, blimp_contents_impl_android); | 65 SetUserData(kBlimpContentsImplAndroidKey, blimp_contents_impl_android); |
| 66 } | 66 } |
| 67 return blimp_contents_impl_android; | 67 return blimp_contents_impl_android; |
| 68 } | 68 } |
| 69 | 69 |
| 70 // static |
| 71 BlimpContents* BlimpContents::FromJavaObject( |
| 72 JNIEnv* env, |
| 73 const base::android::JavaRef<jobject>& jobj) { |
| 74 BlimpContentsImplAndroid* blimp_contents_impl_android = |
| 75 BlimpContentsImplAndroid::FromJavaObject(env, jobj); |
| 76 if (!blimp_contents_impl_android) { |
| 77 return nullptr; |
| 78 } |
| 79 return blimp_contents_impl_android->blimp_contents_impl(); |
| 80 } |
| 81 |
| 70 #endif // defined(OS_ANDROID) | 82 #endif // defined(OS_ANDROID) |
| 71 | 83 |
| 72 BlimpNavigationControllerImpl& BlimpContentsImpl::GetNavigationController() { | 84 BlimpNavigationControllerImpl& BlimpContentsImpl::GetNavigationController() { |
| 73 return navigation_controller_; | 85 return navigation_controller_; |
| 74 } | 86 } |
| 75 | 87 |
| 76 gfx::NativeWindow BlimpContentsImpl::GetNativeWindow() { | 88 gfx::NativeWindow BlimpContentsImpl::GetNativeWindow() { |
| 77 return window_; | 89 return window_; |
| 78 } | 90 } |
| 79 | 91 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 observer.OnPageLoadingStateChanged(loading); | 130 observer.OnPageLoadingStateChanged(loading); |
| 119 } | 131 } |
| 120 | 132 |
| 121 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, | 133 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, |
| 122 float device_pixel_ratio) { | 134 float device_pixel_ratio) { |
| 123 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); | 135 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); |
| 124 } | 136 } |
| 125 | 137 |
| 126 } // namespace client | 138 } // namespace client |
| 127 } // namespace blimp | 139 } // namespace blimp |
| OLD | NEW |