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

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

Issue 2279403003: blimp: Hook up the layer holding the tab content into Chrome. (Closed)
Patch Set: Addressed comments 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"
9 #include "blimp/client/core/contents/tab_control_feature.h" 10 #include "blimp/client/core/contents/tab_control_feature.h"
10 #include "blimp/client/public/contents/blimp_contents_observer.h" 11 #include "blimp/client/public/contents/blimp_contents_observer.h"
11 12
12 #if defined(OS_ANDROID) 13 #if defined(OS_ANDROID)
13 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" 14 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h"
14 #endif // OS_ANDROID 15 #endif // OS_ANDROID
15 16
16 namespace blimp { 17 namespace blimp {
17 namespace client { 18 namespace client {
18 19
19 namespace { 20 namespace {
20 21
21 #if defined(OS_ANDROID) 22 #if defined(OS_ANDROID)
22 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; 23 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android";
23 #endif // OS_ANDROID 24 #endif // OS_ANDROID
24 } 25 }
25 26
26 BlimpContentsImpl::BlimpContentsImpl(int id, 27 BlimpContentsImpl::BlimpContentsImpl(int id,
27 TabControlFeature* tab_control_feature) 28 TabControlFeature* tab_control_feature)
28 : navigation_controller_(this, nullptr), 29 : navigation_controller_(this, nullptr),
29 id_(id), 30 id_(id),
30 tab_control_feature_(tab_control_feature) {} 31 tab_control_feature_(tab_control_feature) {
32 blimp_contents_view_ = BlimpContentsView::Create(this);
33 }
31 34
32 BlimpContentsImpl::~BlimpContentsImpl() { 35 BlimpContentsImpl::~BlimpContentsImpl() {
33 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); 36 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying());
34 } 37 }
35 38
36 #if defined(OS_ANDROID) 39 #if defined(OS_ANDROID)
37 40
38 base::android::ScopedJavaLocalRef<jobject> BlimpContentsImpl::GetJavaObject() { 41 base::android::ScopedJavaLocalRef<jobject> BlimpContentsImpl::GetJavaObject() {
39 return GetBlimpContentsImplAndroid()->GetJavaObject(); 42 return GetBlimpContentsImplAndroid()->GetJavaObject();
40 } 43 }
(...skipping 16 matching lines...) Expand all
57 } 60 }
58 61
59 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) { 62 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) {
60 observers_.AddObserver(observer); 63 observers_.AddObserver(observer);
61 } 64 }
62 65
63 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { 66 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) {
64 observers_.RemoveObserver(observer); 67 observers_.RemoveObserver(observer);
65 } 68 }
66 69
70 gfx::NativeView BlimpContentsImpl::GetNativeView() {
71 return blimp_contents_view_->GetNativeView();
72 }
73
67 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { 74 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) {
68 return observers_.HasObserver(observer); 75 return observers_.HasObserver(observer);
69 } 76 }
70 77
71 void BlimpContentsImpl::OnNavigationStateChanged() { 78 void BlimpContentsImpl::OnNavigationStateChanged() {
72 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, 79 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_,
73 OnNavigationStateChanged()); 80 OnNavigationStateChanged());
74 } 81 }
75 82
76 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, 83 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size,
77 float device_pixel_ratio) { 84 float device_pixel_ratio) {
78 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); 85 tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio);
79 } 86 }
80 87
81 } // namespace client 88 } // namespace client
82 } // namespace blimp 89 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/core/contents/blimp_contents_impl.h ('k') | blimp/client/core/contents/blimp_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698