Chromium Code Reviews| 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/contents/blimp_navigation_controller_delegate.h" | 11 #include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" |
| 11 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" | 12 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" |
| 12 #include "blimp/client/public/contents/blimp_contents.h" | 13 #include "blimp/client/public/contents/blimp_contents.h" |
| 13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 15 | 16 |
| 16 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
| 17 #include "base/android/scoped_java_ref.h" | 18 #include "base/android/scoped_java_ref.h" |
| 18 #endif // defined(OS_ANDROID) | 19 #endif // defined(OS_ANDROID) |
| 19 | 20 |
| 20 namespace blimp { | 21 namespace blimp { |
| 21 namespace client { | 22 namespace client { |
| 22 | 23 |
| 23 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 24 class BlimpContentsImplAndroid; | 25 class BlimpContentsImplAndroid; |
| 25 #endif // defined(OS_ANDROID) | 26 #endif // defined(OS_ANDROID) |
| 26 | 27 |
| 28 class BlimpCompositorDependencies; | |
| 27 class BlimpContentsObserver; | 29 class BlimpContentsObserver; |
| 28 class BlimpContentsView; | 30 class BlimpContentsView; |
| 29 class BlimpNavigationController; | 31 class BlimpNavigationController; |
| 30 class ImeFeature; | 32 class ImeFeature; |
| 31 class NavigationFeature; | 33 class NavigationFeature; |
| 34 class RenderWidgetFeature; | |
| 32 class TabControlFeature; | 35 class TabControlFeature; |
| 33 | 36 |
| 34 class BlimpContentsImpl : public BlimpContents, | 37 class BlimpContentsImpl : public BlimpContents, |
| 35 public BlimpNavigationControllerDelegate { | 38 public BlimpNavigationControllerDelegate { |
| 36 public: | 39 public: |
| 37 // Ownership of the features remains with the caller. | 40 // Ownership of the features remains with the caller. |
| 38 explicit BlimpContentsImpl(int id, | 41 explicit BlimpContentsImpl(int id, |
| 42 BlimpCompositorDependencies* compositor_deps, | |
| 39 ImeFeature* ime_feature, | 43 ImeFeature* ime_feature, |
| 40 NavigationFeature* navigation_feature, | 44 NavigationFeature* navigation_feature, |
| 45 RenderWidgetFeature* render_widget_feature, | |
| 41 TabControlFeature* tab_control_feature); | 46 TabControlFeature* tab_control_feature); |
| 42 ~BlimpContentsImpl() override; | 47 ~BlimpContentsImpl() override; |
| 43 | 48 |
| 44 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
| 45 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; | 50 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; |
| 46 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid(); | 51 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid(); |
| 47 #endif // defined(OS_ANDROID) | 52 #endif // defined(OS_ANDROID) |
| 48 | 53 |
| 49 // BlimpContents implementation. | 54 // BlimpContents implementation. |
| 50 BlimpNavigationControllerImpl& GetNavigationController() override; | 55 BlimpNavigationControllerImpl& GetNavigationController() override; |
| 51 void AddObserver(BlimpContentsObserver* observer) override; | 56 void AddObserver(BlimpContentsObserver* observer) override; |
| 52 void RemoveObserver(BlimpContentsObserver* observer) override; | 57 void RemoveObserver(BlimpContentsObserver* observer) override; |
| 53 gfx::NativeView GetNativeView() override; | 58 gfx::NativeView GetNativeView() override; |
| 59 void Show() override; | |
| 60 void Hide() override; | |
| 54 | 61 |
| 55 // Check if some observer is in the observer list. | 62 // Check if some observer is in the observer list. |
| 56 bool HasObserver(BlimpContentsObserver* observer); | 63 bool HasObserver(BlimpContentsObserver* observer); |
| 57 | 64 |
| 58 // BlimpNavigationControllerDelegate implementation. | 65 // BlimpNavigationControllerDelegate implementation. |
| 59 void OnNavigationStateChanged() override; | 66 void OnNavigationStateChanged() override; |
| 60 | 67 |
| 61 // Pushes the size and scale information to the engine, which will affect the | 68 // Pushes the size and scale information to the engine, which will affect the |
| 62 // web content display area for all tabs. | 69 // web content display area for all tabs. |
| 63 void SetSizeAndScale(const gfx::Size& size, float device_pixel_ratio); | 70 void SetSizeAndScale(const gfx::Size& size, float device_pixel_ratio); |
| 64 | 71 |
| 65 int id() { return id_; } | 72 int id() { return id_; } |
| 66 | 73 |
| 67 private: | 74 private: |
| 68 // Handles the back/forward list and loading URLs. | 75 // Handles the back/forward list and loading URLs. |
| 69 BlimpNavigationControllerImpl navigation_controller_; | 76 BlimpNavigationControllerImpl navigation_controller_; |
| 70 | 77 |
| 78 BlimpCompositorManager compositor_manager_; | |
|
nyquist
2016/08/31 05:44:40
Nit: Should there be a comment explaining what thi
David Trainor- moved to gerrit
2016/08/31 06:49:33
Done.
| |
| 79 | |
| 71 // A list of all the observers of this BlimpContentsImpl. | 80 // A list of all the observers of this BlimpContentsImpl. |
| 72 base::ObserverList<BlimpContentsObserver> observers_; | 81 base::ObserverList<BlimpContentsObserver> observers_; |
| 73 | 82 |
| 74 // The id is assigned during contents creation. It is used by | 83 // The id is assigned during contents creation. It is used by |
| 75 // BlimpContentsManager to control the life time of the its observer. | 84 // BlimpContentsManager to control the life time of the its observer. |
| 76 int id_; | 85 int id_; |
| 77 | 86 |
| 78 // The tab control feature through which the BlimpContentsImpl is able to | 87 // The tab control feature through which the BlimpContentsImpl is able to |
| 79 // set size and scale. | 88 // set size and scale. |
| 80 // TODO(mlliu): in the long term, we want to put size and scale in a different | 89 // TODO(mlliu): in the long term, we want to put size and scale in a different |
| 81 // feature instead of tab control feature. crbug.com/639154. | 90 // feature instead of tab control feature. crbug.com/639154. |
| 82 TabControlFeature* tab_control_feature_ = nullptr; | 91 TabControlFeature* tab_control_feature_ = nullptr; |
| 83 | 92 |
| 84 // The BlimpContentsView abstracts the platform specific view system details | 93 // The BlimpContentsView abstracts the platform specific view system details |
| 85 // from the BlimpContents. | 94 // from the BlimpContents. |
| 86 std::unique_ptr<BlimpContentsView> blimp_contents_view_; | 95 std::unique_ptr<BlimpContentsView> blimp_contents_view_; |
| 87 | 96 |
| 88 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); | 97 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); |
| 89 }; | 98 }; |
| 90 | 99 |
| 91 } // namespace client | 100 } // namespace client |
| 92 } // namespace blimp | 101 } // namespace blimp |
| 93 | 102 |
| 94 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ | 103 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ |
| OLD | NEW |