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 #ifndef BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ | 5 #ifndef BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ |
6 #define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ | 6 #define BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "blimp/client/core/compositor/blimp_compositor_manager.h" | 10 #include "blimp/client/core/compositor/blimp_compositor_manager.h" |
| 11 #include "blimp/client/core/contents/blimp_contents_view_impl.h" |
11 #include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" | 12 #include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" |
12 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" | 13 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" |
13 #include "blimp/client/public/contents/blimp_contents.h" | 14 #include "blimp/client/public/contents/blimp_contents.h" |
14 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
19 #include "base/android/scoped_java_ref.h" | 20 #include "base/android/scoped_java_ref.h" |
20 #endif // defined(OS_ANDROID) | 21 #endif // defined(OS_ANDROID) |
21 | 22 |
22 namespace blimp { | 23 namespace blimp { |
23 namespace client { | 24 namespace client { |
24 | 25 |
25 #if defined(OS_ANDROID) | 26 #if defined(OS_ANDROID) |
26 class BlimpContentsImplAndroid; | 27 class BlimpContentsImplAndroid; |
27 #endif // defined(OS_ANDROID) | 28 #endif // defined(OS_ANDROID) |
28 | 29 |
29 class BlimpCompositorDependencies; | 30 class BlimpCompositorDependencies; |
30 class BlimpContentsObserver; | 31 class BlimpContentsObserver; |
31 class BlimpContentsView; | |
32 class BlimpNavigationController; | 32 class BlimpNavigationController; |
33 class ImeFeature; | 33 class ImeFeature; |
34 class NavigationFeature; | 34 class NavigationFeature; |
35 class RenderWidgetFeature; | 35 class RenderWidgetFeature; |
36 class TabControlFeature; | 36 class TabControlFeature; |
37 | 37 |
38 class BlimpContentsImpl : public BlimpContents, | 38 class BlimpContentsImpl : public BlimpContents, |
39 public BlimpNavigationControllerDelegate { | 39 public BlimpNavigationControllerDelegate { |
40 public: | 40 public: |
41 // Ownership of the features remains with the caller. | 41 // Ownership of the features remains with the caller. |
42 // |window| must be the platform specific window that this will be shown in. | 42 // |window| must be the platform specific window that this will be shown in. |
43 explicit BlimpContentsImpl(int id, | 43 explicit BlimpContentsImpl(int id, |
44 gfx::NativeWindow window, | 44 gfx::NativeWindow window, |
45 BlimpCompositorDependencies* compositor_deps, | 45 BlimpCompositorDependencies* compositor_deps, |
46 ImeFeature* ime_feature, | 46 ImeFeature* ime_feature, |
47 NavigationFeature* navigation_feature, | 47 NavigationFeature* navigation_feature, |
48 RenderWidgetFeature* render_widget_feature, | 48 RenderWidgetFeature* render_widget_feature, |
49 TabControlFeature* tab_control_feature); | 49 TabControlFeature* tab_control_feature); |
50 ~BlimpContentsImpl() override; | 50 ~BlimpContentsImpl() override; |
51 | 51 |
52 #if defined(OS_ANDROID) | 52 #if defined(OS_ANDROID) |
53 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | 53 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; |
54 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid(); | 54 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid(); |
55 #endif // defined(OS_ANDROID) | 55 #endif // defined(OS_ANDROID) |
56 | 56 |
57 // BlimpContents implementation. | 57 // BlimpContents implementation. |
58 BlimpNavigationControllerImpl& GetNavigationController() override; | 58 BlimpNavigationControllerImpl& GetNavigationController() override; |
59 void AddObserver(BlimpContentsObserver* observer) override; | 59 void AddObserver(BlimpContentsObserver* observer) override; |
60 void RemoveObserver(BlimpContentsObserver* observer) override; | 60 void RemoveObserver(BlimpContentsObserver* observer) override; |
61 gfx::NativeView GetNativeView() override; | 61 BlimpContentsViewImpl* GetView() override; |
62 void Show() override; | 62 void Show() override; |
63 void Hide() override; | 63 void Hide() override; |
64 | 64 |
65 // Returns the platform specific window that this BlimpContents is showed in. | 65 // Returns the platform specific window that this BlimpContents is showed in. |
66 gfx::NativeWindow GetNativeWindow(); | 66 gfx::NativeWindow GetNativeWindow(); |
67 | 67 |
68 // Check if some observer is in the observer list. | 68 // Check if some observer is in the observer list. |
69 bool HasObserver(BlimpContentsObserver* observer); | 69 bool HasObserver(BlimpContentsObserver* observer); |
70 | 70 |
71 // BlimpNavigationControllerDelegate implementation. | 71 // BlimpNavigationControllerDelegate implementation. |
72 void OnNavigationStateChanged() override; | 72 void OnNavigationStateChanged() override; |
73 void OnLoadingStateChanged(bool loading) override; | 73 void OnLoadingStateChanged(bool loading) override; |
| 74 void OnPageLoadingStateChanged(bool loading) override; |
74 | 75 |
75 // Pushes the size and scale information to the engine, which will affect the | 76 // Pushes the size and scale information to the engine, which will affect the |
76 // web content display area for all tabs. | 77 // web content display area for all tabs. |
77 void SetSizeAndScale(const gfx::Size& size, float device_pixel_ratio); | 78 void SetSizeAndScale(const gfx::Size& size, float device_pixel_ratio); |
78 | 79 |
79 int id() { return id_; } | 80 int id() { return id_; } |
80 | 81 |
81 // Returns the BlimpContentsView for this BlimpContentsImpl. | |
82 BlimpContentsView* GetBlimpContentsView(); | |
83 | |
84 // TODO(nyquist): Remove this once the Android BlimpView uses a delegate. | 82 // TODO(nyquist): Remove this once the Android BlimpView uses a delegate. |
85 BlimpCompositorManager* compositor_manager() { return &compositor_manager_; } | 83 BlimpCompositorManager* compositor_manager() { return &compositor_manager_; } |
86 | 84 |
87 private: | 85 private: |
88 // Handles the back/forward list and loading URLs. | 86 // Handles the back/forward list and loading URLs. |
89 BlimpNavigationControllerImpl navigation_controller_; | 87 BlimpNavigationControllerImpl navigation_controller_; |
90 | 88 |
91 // Holds onto all active BlimpCompositor instances for this BlimpContents. | 89 // Holds onto all active BlimpCompositor instances for this BlimpContents. |
92 // This properly exposes the right rendered page content for the correct | 90 // This properly exposes the right rendered page content for the correct |
93 // BlimpCompositor based on the engine state. | 91 // BlimpCompositor based on the engine state. |
(...skipping 13 matching lines...) Expand all Loading... |
107 gfx::NativeWindow window_; | 105 gfx::NativeWindow window_; |
108 | 106 |
109 // The tab control feature through which the BlimpContentsImpl is able to | 107 // The tab control feature through which the BlimpContentsImpl is able to |
110 // set size and scale. | 108 // set size and scale. |
111 // TODO(mlliu): in the long term, we want to put size and scale in a different | 109 // TODO(mlliu): in the long term, we want to put size and scale in a different |
112 // feature instead of tab control feature. crbug.com/639154. | 110 // feature instead of tab control feature. crbug.com/639154. |
113 TabControlFeature* tab_control_feature_ = nullptr; | 111 TabControlFeature* tab_control_feature_ = nullptr; |
114 | 112 |
115 // The BlimpContentsView abstracts the platform specific view system details | 113 // The BlimpContentsView abstracts the platform specific view system details |
116 // from the BlimpContents. | 114 // from the BlimpContents. |
117 std::unique_ptr<BlimpContentsView> blimp_contents_view_; | 115 std::unique_ptr<BlimpContentsViewImpl> blimp_contents_view_; |
118 | 116 |
119 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); | 117 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); |
120 }; | 118 }; |
121 | 119 |
122 } // namespace client | 120 } // namespace client |
123 } // namespace blimp | 121 } // namespace blimp |
124 | 122 |
125 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ | 123 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ |
OLD | NEW |