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

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

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Addressed more comments, added thread restriction bypass for tests. 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/supports_user_data.h" 8 #include "base/supports_user_data.h"
9 #include "blimp/client/core/contents/blimp_contents_view.h"
10 #include "blimp/client/core/contents/tab_control_feature.h" 9 #include "blimp/client/core/contents/tab_control_feature.h"
11 #include "blimp/client/public/contents/blimp_contents_observer.h" 10 #include "blimp/client/public/contents/blimp_contents_observer.h"
12 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
13 12
14 #if defined(OS_ANDROID) 13 #if defined(OS_ANDROID)
15 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" 14 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h"
16 #endif // OS_ANDROID 15 #endif // OS_ANDROID
17 16
18 namespace blimp { 17 namespace blimp {
19 namespace client { 18 namespace client {
(...skipping 13 matching lines...) Expand all
33 NavigationFeature* navigation_feature, 32 NavigationFeature* navigation_feature,
34 RenderWidgetFeature* render_widget_feature, 33 RenderWidgetFeature* render_widget_feature,
35 TabControlFeature* tab_control_feature) 34 TabControlFeature* tab_control_feature)
36 : navigation_controller_(this, navigation_feature), 35 : navigation_controller_(this, navigation_feature),
37 compositor_manager_(render_widget_feature, compositor_deps), 36 compositor_manager_(render_widget_feature, compositor_deps),
38 id_(id), 37 id_(id),
39 ime_feature_(ime_feature), 38 ime_feature_(ime_feature),
40 window_(window), 39 window_(window),
41 tab_control_feature_(tab_control_feature) { 40 tab_control_feature_(tab_control_feature) {
42 blimp_contents_view_ = 41 blimp_contents_view_ =
43 BlimpContentsView::Create(this, compositor_manager_.layer()); 42 BlimpContentsViewImpl::Create(this, compositor_manager_.layer());
44 ime_feature_->set_delegate(blimp_contents_view_->GetImeDelegate()); 43 ime_feature_->set_delegate(blimp_contents_view_->GetImeDelegate());
45 } 44 }
46 45
47 BlimpContentsImpl::~BlimpContentsImpl() { 46 BlimpContentsImpl::~BlimpContentsImpl() {
48 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); 47 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying());
49 ime_feature_->set_delegate(nullptr); 48 ime_feature_->set_delegate(nullptr);
50 } 49 }
51 50
52 #if defined(OS_ANDROID) 51 #if defined(OS_ANDROID)
53 52
(...skipping 23 matching lines...) Expand all
77 } 76 }
78 77
79 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) { 78 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) {
80 observers_.AddObserver(observer); 79 observers_.AddObserver(observer);
81 } 80 }
82 81
83 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { 82 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) {
84 observers_.RemoveObserver(observer); 83 observers_.RemoveObserver(observer);
85 } 84 }
86 85
87 gfx::NativeView BlimpContentsImpl::GetNativeView() { 86 BlimpContentsViewImpl* BlimpContentsImpl::GetView() {
88 return blimp_contents_view_->GetNativeView(); 87 return blimp_contents_view_.get();
89 } 88 }
90 89
91 void BlimpContentsImpl::Show() { 90 void BlimpContentsImpl::Show() {
92 compositor_manager_.SetVisible(true); 91 compositor_manager_.SetVisible(true);
93 } 92 }
94 93
95 void BlimpContentsImpl::Hide() { 94 void BlimpContentsImpl::Hide() {
96 compositor_manager_.SetVisible(false); 95 compositor_manager_.SetVisible(false);
97 } 96 }
98 97
99 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { 98 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) {
100 return observers_.HasObserver(observer); 99 return observers_.HasObserver(observer);
101 } 100 }
102 101
103 void BlimpContentsImpl::OnNavigationStateChanged() { 102 void BlimpContentsImpl::OnNavigationStateChanged() {
104 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, 103 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_,
105 OnNavigationStateChanged()); 104 OnNavigationStateChanged());
106 } 105 }
107 106
108 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) { 107 void BlimpContentsImpl::OnLoadingStateChanged(bool loading) {
109 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, 108 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_,
110 OnLoadingStateChanged(loading)); 109 OnLoadingStateChanged(loading));
111 } 110 }
112 111
112 void BlimpContentsImpl::OnPageLoadingStateChanged(bool loading) {
113 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_,
114 OnPageLoadingStateChanged(loading));
115 }
116
113 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, 117 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size,
114 float device_pixel_ratio) { 118 float device_pixel_ratio) {
115 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); 119 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio);
116 } 120 }
117 121
118 BlimpContentsView* BlimpContentsImpl::GetBlimpContentsView() {
119 return blimp_contents_view_.get();
120 }
121
122 } // namespace client 122 } // namespace client
123 } // namespace blimp 123 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698