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