| 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 27 matching lines...) Expand all Loading... |
| 38 id_(id), | 38 id_(id), |
| 39 ime_feature_(ime_feature), | 39 ime_feature_(ime_feature), |
| 40 window_(window), | 40 window_(window), |
| 41 tab_control_feature_(tab_control_feature) { | 41 tab_control_feature_(tab_control_feature) { |
| 42 blimp_contents_view_ = | 42 blimp_contents_view_ = |
| 43 BlimpContentsViewImpl::Create(this, document_manager_.layer()); | 43 BlimpContentsViewImpl::Create(this, document_manager_.layer()); |
| 44 ime_feature_->set_delegate(blimp_contents_view_->GetImeDelegate()); | 44 ime_feature_->set_delegate(blimp_contents_view_->GetImeDelegate()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 BlimpContentsImpl::~BlimpContentsImpl() { | 47 BlimpContentsImpl::~BlimpContentsImpl() { |
| 48 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); | 48 for (auto& observer : observers_) |
| 49 observer.BlimpContentsDying(); |
| 49 ime_feature_->set_delegate(nullptr); | 50 ime_feature_->set_delegate(nullptr); |
| 50 } | 51 } |
| 51 | 52 |
| 52 #if defined(OS_ANDROID) | 53 #if defined(OS_ANDROID) |
| 53 | 54 |
| 54 base::android::ScopedJavaLocalRef<jobject> BlimpContentsImpl::GetJavaObject() { | 55 base::android::ScopedJavaLocalRef<jobject> BlimpContentsImpl::GetJavaObject() { |
| 55 return GetBlimpContentsImplAndroid()->GetJavaObject(); | 56 return GetBlimpContentsImplAndroid()->GetJavaObject(); |
| 56 } | 57 } |
| 57 | 58 |
| 58 BlimpContentsImplAndroid* BlimpContentsImpl::GetBlimpContentsImplAndroid() { | 59 BlimpContentsImplAndroid* BlimpContentsImpl::GetBlimpContentsImplAndroid() { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 void BlimpContentsImpl::Hide() { | 97 void BlimpContentsImpl::Hide() { |
| 97 document_manager_.SetVisible(false); | 98 document_manager_.SetVisible(false); |
| 98 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", false); | 99 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", false); |
| 99 } | 100 } |
| 100 | 101 |
| 101 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { | 102 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { |
| 102 return observers_.HasObserver(observer); | 103 return observers_.HasObserver(observer); |
| 103 } | 104 } |
| 104 | 105 |
| 105 void BlimpContentsImpl::OnNavigationStateChanged() { | 106 void BlimpContentsImpl::OnNavigationStateChanged() { |
| 106 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 107 for (auto& observer : observers_) |
| 107 OnNavigationStateChanged()); | 108 observer.OnNavigationStateChanged(); |
| 108 } | 109 } |
| 109 | 110 |
| 110 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { | 111 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { |
| 111 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 112 for (auto& observer : observers_) |
| 112 OnLoadingStateChanged(loading)); | 113 observer.OnLoadingStateChanged(loading); |
| 113 } | 114 } |
| 114 | 115 |
| 115 void BlimpContentsImpl::OnPageLoadingStateChanged(bool loading) { | 116 void BlimpContentsImpl::OnPageLoadingStateChanged(bool loading) { |
| 116 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 117 for (auto& observer : observers_) |
| 117 OnPageLoadingStateChanged(loading)); | 118 observer.OnPageLoadingStateChanged(loading); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, | 121 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, |
| 121 float device_pixel_ratio) { | 122 float device_pixel_ratio) { |
| 122 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); | 123 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace client | 126 } // namespace client |
| 126 } // namespace blimp | 127 } // namespace blimp |
| OLD | NEW |