| 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/supports_user_data.h" | 9 #include "base/supports_user_data.h" |
| 9 #include "blimp/client/core/contents/blimp_contents_view.h" | 10 #include "blimp/client/core/contents/blimp_contents_view.h" |
| 10 #include "blimp/client/core/contents/tab_control_feature.h" | 11 #include "blimp/client/core/contents/tab_control_feature.h" |
| 11 #include "blimp/client/public/contents/blimp_contents_observer.h" | 12 #include "blimp/client/public/contents/blimp_contents_observer.h" |
| 12 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 13 | 14 |
| 14 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
| 15 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" | 16 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" |
| 16 #endif // OS_ANDROID | 17 #endif // OS_ANDROID |
| 17 | 18 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { | 84 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { |
| 84 observers_.RemoveObserver(observer); | 85 observers_.RemoveObserver(observer); |
| 85 } | 86 } |
| 86 | 87 |
| 87 gfx::NativeView BlimpContentsImpl::GetNativeView() { | 88 gfx::NativeView BlimpContentsImpl::GetNativeView() { |
| 88 return blimp_contents_view_->GetNativeView(); | 89 return blimp_contents_view_->GetNativeView(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void BlimpContentsImpl::Show() { | 92 void BlimpContentsImpl::Show() { |
| 92 compositor_manager_.SetVisible(true); | 93 compositor_manager_.SetVisible(true); |
| 94 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", true); |
| 93 } | 95 } |
| 94 | 96 |
| 95 void BlimpContentsImpl::Hide() { | 97 void BlimpContentsImpl::Hide() { |
| 96 compositor_manager_.SetVisible(false); | 98 compositor_manager_.SetVisible(false); |
| 99 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", false); |
| 97 } | 100 } |
| 98 | 101 |
| 99 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { | 102 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { |
| 100 return observers_.HasObserver(observer); | 103 return observers_.HasObserver(observer); |
| 101 } | 104 } |
| 102 | 105 |
| 103 void BlimpContentsImpl::OnNavigationStateChanged() { | 106 void BlimpContentsImpl::OnNavigationStateChanged() { |
| 104 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 107 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 105 OnNavigationStateChanged()); | 108 OnNavigationStateChanged()); |
| 106 } | 109 } |
| 107 | 110 |
| 108 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { | 111 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { |
| 109 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 112 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 110 OnLoadingStateChanged(loading)); | 113 OnLoadingStateChanged(loading)); |
| 111 } | 114 } |
| 112 | 115 |
| 113 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, | 116 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, |
| 114 float device_pixel_ratio) { | 117 float device_pixel_ratio) { |
| 115 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); | 118 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); |
| 116 } | 119 } |
| 117 | 120 |
| 118 BlimpContentsView* BlimpContentsImpl::GetBlimpContentsView() { | 121 BlimpContentsView* BlimpContentsImpl::GetBlimpContentsView() { |
| 119 return blimp_contents_view_.get(); | 122 return blimp_contents_view_.get(); |
| 120 } | 123 } |
| 121 | 124 |
| 122 } // namespace client | 125 } // namespace client |
| 123 } // namespace blimp | 126 } // namespace blimp |
| OLD | NEW |