| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 BlimpContentsImpl::BlimpContentsImpl( | 28 BlimpContentsImpl::BlimpContentsImpl( |
| 29 int id, | 29 int id, |
| 30 gfx::NativeWindow window, | 30 gfx::NativeWindow window, |
| 31 BlimpCompositorDependencies* compositor_deps, | 31 BlimpCompositorDependencies* compositor_deps, |
| 32 ImeFeature* ime_feature, | 32 ImeFeature* ime_feature, |
| 33 NavigationFeature* navigation_feature, | 33 NavigationFeature* navigation_feature, |
| 34 RenderWidgetFeature* render_widget_feature, | 34 RenderWidgetFeature* render_widget_feature, |
| 35 TabControlFeature* tab_control_feature) | 35 TabControlFeature* tab_control_feature) |
| 36 : navigation_controller_(id, this, navigation_feature), | 36 : navigation_controller_(id, this, navigation_feature), |
| 37 compositor_manager_(id, render_widget_feature, compositor_deps), | 37 document_manager_(id, render_widget_feature, compositor_deps), |
| 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, compositor_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_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); |
| 49 ime_feature_->set_delegate(nullptr); | 49 ime_feature_->set_delegate(nullptr); |
| 50 } | 50 } |
| 51 | 51 |
| 52 #if defined(OS_ANDROID) | 52 #if defined(OS_ANDROID) |
| 53 | 53 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 82 | 82 |
| 83 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { | 83 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { |
| 84 observers_.RemoveObserver(observer); | 84 observers_.RemoveObserver(observer); |
| 85 } | 85 } |
| 86 | 86 |
| 87 BlimpContentsViewImpl* BlimpContentsImpl::GetView() { | 87 BlimpContentsViewImpl* BlimpContentsImpl::GetView() { |
| 88 return blimp_contents_view_.get(); | 88 return blimp_contents_view_.get(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void BlimpContentsImpl::Show() { | 91 void BlimpContentsImpl::Show() { |
| 92 compositor_manager_.SetVisible(true); | 92 document_manager_.SetVisible(true); |
| 93 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", true); | 93 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", true); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void BlimpContentsImpl::Hide() { | 96 void BlimpContentsImpl::Hide() { |
| 97 compositor_manager_.SetVisible(false); | 97 document_manager_.SetVisible(false); |
| 98 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", false); | 98 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", false); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { | 101 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { |
| 102 return observers_.HasObserver(observer); | 102 return observers_.HasObserver(observer); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void BlimpContentsImpl::OnNavigationStateChanged() { | 105 void BlimpContentsImpl::OnNavigationStateChanged() { |
| 106 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 106 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 107 OnNavigationStateChanged()); | 107 OnNavigationStateChanged()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { | 110 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { |
| 111 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 111 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 112 OnLoadingStateChanged(loading)); | 112 OnLoadingStateChanged(loading)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void BlimpContentsImpl::OnPageLoadingStateChanged(bool loading) { | 115 void BlimpContentsImpl::OnPageLoadingStateChanged(bool loading) { |
| 116 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 116 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 117 OnPageLoadingStateChanged(loading)); | 117 OnPageLoadingStateChanged(loading)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, | 120 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, |
| 121 float device_pixel_ratio) { | 121 float device_pixel_ratio) { |
| 122 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); | 122 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace client | 125 } // namespace client |
| 126 } // namespace blimp | 126 } // namespace blimp |
| OLD | NEW |