| 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/public/contents/blimp_contents_observer.h" | 9 #include "blimp/client/public/contents/blimp_contents_observer.h" |
| 10 | 10 |
| 11 #if defined(OS_ANDROID) | 11 #if defined(OS_ANDROID) |
| 12 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" | 12 #include "blimp/client/core/contents/android/blimp_contents_impl_android.h" |
| 13 #endif // OS_ANDROID | 13 #endif // OS_ANDROID |
| 14 | 14 |
| 15 namespace blimp { | 15 namespace blimp { |
| 16 namespace client { | 16 namespace client { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
| 21 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; | 21 const char kBlimpContentsImplAndroidKey[] = "blimp_contents_impl_android"; |
| 22 #endif // OS_ANDROID | 22 #endif // OS_ANDROID |
| 23 } | 23 } |
| 24 | 24 |
| 25 BlimpContentsImpl::BlimpContentsImpl() | 25 BlimpContentsImpl::BlimpContentsImpl(int id) |
| 26 : navigation_controller_(this, nullptr) {} | 26 : navigation_controller_(this, nullptr), id_(id) {} |
| 27 | 27 |
| 28 BlimpContentsImpl::~BlimpContentsImpl() {} | 28 BlimpContentsImpl::~BlimpContentsImpl() { |
| 29 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, BlimpContentsDying()); |
| 30 } |
| 29 | 31 |
| 30 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
| 31 | 33 |
| 32 base::android::ScopedJavaLocalRef<jobject> | 34 base::android::ScopedJavaLocalRef<jobject> |
| 33 BlimpContentsImpl::GetJavaBlimpContentsImpl() { | 35 BlimpContentsImpl::GetJavaBlimpContentsImpl() { |
| 34 return GetBlimpContentsImplAndroid()->GetJavaObject(); | 36 return GetBlimpContentsImplAndroid()->GetJavaObject(); |
| 35 } | 37 } |
| 36 | 38 |
| 37 BlimpContentsImplAndroid* BlimpContentsImpl::GetBlimpContentsImplAndroid() { | 39 BlimpContentsImplAndroid* BlimpContentsImpl::GetBlimpContentsImplAndroid() { |
| 38 BlimpContentsImplAndroid* blimp_contents_impl_android = | 40 BlimpContentsImplAndroid* blimp_contents_impl_android = |
| (...skipping 13 matching lines...) Expand all Loading... |
| 52 } | 54 } |
| 53 | 55 |
| 54 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) { | 56 void BlimpContentsImpl::AddObserver(BlimpContentsObserver* observer) { |
| 55 observers_.AddObserver(observer); | 57 observers_.AddObserver(observer); |
| 56 } | 58 } |
| 57 | 59 |
| 58 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { | 60 void BlimpContentsImpl::RemoveObserver(BlimpContentsObserver* observer) { |
| 59 observers_.RemoveObserver(observer); | 61 observers_.RemoveObserver(observer); |
| 60 } | 62 } |
| 61 | 63 |
| 64 bool BlimpContentsImpl::HasObserver(BlimpContentsObserver* observer) { |
| 65 return observers_.HasObserver(observer); |
| 66 } |
| 67 |
| 62 void BlimpContentsImpl::OnNavigationStateChanged() { | 68 void BlimpContentsImpl::OnNavigationStateChanged() { |
| 63 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, | 69 FOR_EACH_OBSERVER(BlimpContentsObserver, observers_, |
| 64 OnNavigationStateChanged()); | 70 OnNavigationStateChanged()); |
| 65 } | 71 } |
| 66 | 72 |
| 67 } // namespace client | 73 } // namespace client |
| 68 } // namespace blimp | 74 } // namespace blimp |
| OLD | NEW |