Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Side by Side Diff: blimp/client/core/contents/blimp_contents_impl.cc

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Fix build break with chrome embedder Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/blimp_contents_view.h"
11 #include "blimp/client/core/contents/tab_control_feature.h" 10 #include "blimp/client/core/contents/tab_control_feature.h"
12 #include "blimp/client/public/contents/blimp_contents_observer.h" 11 #include "blimp/client/public/contents/blimp_contents_observer.h"
13 #include "ui/gfx/native_widget_types.h" 12 #include "ui/gfx/native_widget_types.h"
14 13
15 #if defined(OS_ANDROID) 14 #if defined(OS_ANDROID)
16 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" 15 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h"
17 #endif // OS_ANDROID 16 #endif // OS_ANDROID
18 17
19 namespace blimp { 18 namespace blimp {
20 namespace client { 19 namespace client {
(...skipping 13 matching lines...) Expand all
34 NavigationFeature* navigation_feature, 33 NavigationFeature* navigation_feature,
35 RenderWidgetFeature* render_widget_feature, 34 RenderWidgetFeature* render_widget_feature,
36 TabControlFeature* tab_control_feature) 35 TabControlFeature* tab_control_feature)
37 : navigation_controller_(id, this, navigation_feature), 36 : navigation_controller_(id, this, navigation_feature),
38 compositor_manager_(id, render_widget_feature, compositor_deps), 37 compositor_manager_(id, render_widget_feature, compositor_deps),
39 id_(id), 38 id_(id),
40 ime_feature_(ime_feature), 39 ime_feature_(ime_feature),
41 window_(window), 40 window_(window),
42 tab_control_feature_(tab_control_feature) { 41 tab_control_feature_(tab_control_feature) {
43 blimp_contents_view_ = 42 blimp_contents_view_ =
44 BlimpContentsView::Create(this, compositor_manager_.layer()); 43 BlimpContentsViewImpl::Create(this, compositor_manager_.layer());
45 ime_feature_->set_delegate(blimp_contents_view_->GetImeDelegate()); 44 ime_feature_->set_delegate(blimp_contents_view_->GetImeDelegate());
46 } 45 }
47 46
48 BlimpContentsImpl::~BlimpContentsImpl() { 47 BlimpContentsImpl::~BlimpContentsImpl() {
49 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); 48 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying());
50 ime_feature_->set_delegate(nullptr); 49 ime_feature_->set_delegate(nullptr);
51 } 50 }
52 51
53 #if defined(OS_ANDROID) 52 #if defined(OS_ANDROID)
54 53
(...skipping 23 matching lines...) Expand all
78 } 77 }
79 78
80 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) { 79 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) {
81 observers_.AddObserver(observer); 80 observers_.AddObserver(observer);
82 } 81 }
83 82
84 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { 83 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) {
85 observers_.RemoveObserver(observer); 84 observers_.RemoveObserver(observer);
86 } 85 }
87 86
88 gfx::NativeView BlimpContentsImpl::GetNativeView() { 87 BlimpContentsViewImpl* BlimpContentsImpl::GetView() {
89 return blimp_contents_view_->GetNativeView(); 88 return blimp_contents_view_.get();
90 } 89 }
91 90
92 void BlimpContentsImpl::Show() { 91 void BlimpContentsImpl::Show() {
93 compositor_manager_.SetVisible(true); 92 compositor_manager_.SetVisible(true);
94 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", true); 93 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", true);
95 } 94 }
96 95
97 void BlimpContentsImpl::Hide() { 96 void BlimpContentsImpl::Hide() {
98 compositor_manager_.SetVisible(false); 97 compositor_manager_.SetVisible(false);
99 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", false); 98 UMA_HISTOGRAM_BOOLEAN("Blimp.Tab.Visible", false);
100 } 99 }
101 100
102 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { 101 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) {
103 return observers_.HasObserver(observer); 102 return observers_.HasObserver(observer);
104 } 103 }
105 104
106 void BlimpContentsImpl::OnNavigationStateChanged() { 105 void BlimpContentsImpl::OnNavigationStateChanged() {
107 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, 106 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_,
108 OnNavigationStateChanged()); 107 OnNavigationStateChanged());
109 } 108 }
110 109
111 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { 110 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) {
112 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, 111 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_,
113 OnLoadingStateChanged(loading)); 112 OnLoadingStateChanged(loading));
114 } 113 }
115 114
115 void BlimpContentsImpl::OnPageLoadingStateChanged(bool loading) {
116 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_,
117 OnPageLoadingStateChanged(loading));
118 }
119
116 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, 120 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size,
117 float device_pixel_ratio) { 121 float device_pixel_ratio) {
118 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); 122 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio);
119 } 123 }
120 124
121 BlimpContentsView* BlimpContentsImpl::GetBlimpContentsView() {
122 return blimp_contents_view_.get();
123 }
124
125 } // namespace client 125 } // namespace client
126 } // namespace blimp 126 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/core/contents/blimp_contents_impl.h ('k') | blimp/client/core/contents/blimp_contents_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698