| 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 #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/blimp_contents_view.h" | 
|   10 #include "blimp/client/core/contents/tab_control_feature.h" |   10 #include "blimp/client/core/contents/tab_control_feature.h" | 
|   11 #include "blimp/client/public/contents/blimp_contents_observer.h" |   11 #include "blimp/client/public/contents/blimp_contents_observer.h" | 
 |   12 #include "ui/gfx/native_widget_types.h" | 
|   12  |   13  | 
|   13 #if defined(OS_ANDROID) |   14 #if defined(OS_ANDROID) | 
|   14 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" |   15 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" | 
|   15 #endif  // OS_ANDROID |   16 #endif  // OS_ANDROID | 
|   16  |   17  | 
|   17 namespace blimp { |   18 namespace blimp { | 
|   18 namespace client { |   19 namespace client { | 
|   19  |   20  | 
|   20 namespace { |   21 namespace { | 
|   21  |   22  | 
|   22 #if defined(OS_ANDROID) |   23 #if defined(OS_ANDROID) | 
|   23 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; |   24 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; | 
|   24 #endif  // OS_ANDROID |   25 #endif  // OS_ANDROID | 
|   25 } |   26 } | 
|   26  |   27  | 
|   27 BlimpContentsImpl::BlimpContentsImpl( |   28 BlimpContentsImpl::BlimpContentsImpl( | 
|   28     int id, |   29     int id, | 
 |   30     gfx::NativeWindow window, | 
|   29     BlimpCompositorDependencies* compositor_deps, |   31     BlimpCompositorDependencies* compositor_deps, | 
|   30     ImeFeature* ime_feature, |   32     ImeFeature* ime_feature, | 
|   31     NavigationFeature* navigation_feature, |   33     NavigationFeature* navigation_feature, | 
|   32     RenderWidgetFeature* render_widget_feature, |   34     RenderWidgetFeature* render_widget_feature, | 
|   33     TabControlFeature* tab_control_feature) |   35     TabControlFeature* tab_control_feature) | 
|   34     : navigation_controller_(this, navigation_feature), |   36     : navigation_controller_(this, navigation_feature), | 
|   35       compositor_manager_(render_widget_feature, compositor_deps), |   37       compositor_manager_(render_widget_feature, compositor_deps), | 
|   36       id_(id), |   38       id_(id), | 
 |   39       window_(window), | 
|   37       tab_control_feature_(tab_control_feature) { |   40       tab_control_feature_(tab_control_feature) { | 
|   38   blimp_contents_view_ = |   41   blimp_contents_view_ = | 
|   39       BlimpContentsView::Create(this, compositor_manager_.layer()); |   42       BlimpContentsView::Create(this, compositor_manager_.layer()); | 
|   40 } |   43 } | 
|   41  |   44  | 
|   42 BlimpContentsImpl::~BlimpContentsImpl() { |   45 BlimpContentsImpl::~BlimpContentsImpl() { | 
|   43   FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); |   46   FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); | 
|   44 } |   47 } | 
|   45  |   48  | 
|   46 #if defined(OS_ANDROID) |   49 #if defined(OS_ANDROID) | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
|   59   } |   62   } | 
|   60   return blimp_contents_impl_android; |   63   return blimp_contents_impl_android; | 
|   61 } |   64 } | 
|   62  |   65  | 
|   63 #endif  // defined(OS_ANDROID) |   66 #endif  // defined(OS_ANDROID) | 
|   64  |   67  | 
|   65 BlimpNavigationControllerImpl& BlimpContentsImpl::GetNavigationController() { |   68 BlimpNavigationControllerImpl& BlimpContentsImpl::GetNavigationController() { | 
|   66   return navigation_controller_; |   69   return navigation_controller_; | 
|   67 } |   70 } | 
|   68  |   71  | 
 |   72 gfx::NativeWindow BlimpContentsImpl::GetNativeWindow() { | 
 |   73   return window_; | 
 |   74 } | 
 |   75  | 
|   69 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) { |   76 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) { | 
|   70   observers_.AddObserver(observer); |   77   observers_.AddObserver(observer); | 
|   71 } |   78 } | 
|   72  |   79  | 
|   73 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { |   80 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { | 
|   74   observers_.RemoveObserver(observer); |   81   observers_.RemoveObserver(observer); | 
|   75 } |   82 } | 
|   76  |   83  | 
|   77 gfx::NativeView BlimpContentsImpl::GetNativeView() { |   84 gfx::NativeView BlimpContentsImpl::GetNativeView() { | 
|   78   return blimp_contents_view_->GetNativeView(); |   85   return blimp_contents_view_->GetNativeView(); | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
|   93 void BlimpContentsImpl::OnNavigationStateChanged() { |  100 void BlimpContentsImpl::OnNavigationStateChanged() { | 
|   94   FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |  101   FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 
|   95                     OnNavigationStateChanged()); |  102                     OnNavigationStateChanged()); | 
|   96 } |  103 } | 
|   97  |  104  | 
|   98 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, |  105 void BlimpContentsImpl::SetSizeAndScale(const gfx::Size& size, | 
|   99                                         float device_pixel_ratio) { |  106                                         float device_pixel_ratio) { | 
|  100   tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); |  107   tab_control_feature_->SetSizeAndScale(size, device_pixel_ratio); | 
|  101 } |  108 } | 
|  102  |  109  | 
 |  110 BlimpContentsView* BlimpContentsImpl::GetBlimpContentsView() { | 
 |  111   return blimp_contents_view_.get(); | 
 |  112 } | 
 |  113  | 
|  103 }  // namespace client |  114 }  // namespace client | 
|  104 }  // namespace blimp |  115 }  // namespace blimp | 
| OLD | NEW |