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/contents/blimp_navigation_controller_delegate.h" | 10 #include "blimp/client/core/contents/blimp_navigation_controller_delegate.h" |
11 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" | 11 #include "blimp/client/core/contents/blimp_navigation_controller_impl.h" |
12 #include "blimp/client/public/contents/blimp_contents.h" | 12 #include "blimp/client/public/contents/blimp_contents.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 #if defined(OS_ANDROID) | 15 #if defined(OS_ANDROID) |
16 #include "base/android/scoped_java_ref.h" | 16 #include "base/android/scoped_java_ref.h" |
17 #endif // defined(OS_ANDROID) | 17 #endif // defined(OS_ANDROID) |
18 | 18 |
19 namespace blimp { | 19 namespace blimp { |
20 namespace client { | 20 namespace client { |
21 | 21 |
22 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
23 class BlimpContentsImplAndroid; | 23 class BlimpContentsImplAndroid; |
24 #endif // defined(OS_ANDROID) | 24 #endif // defined(OS_ANDROID) |
25 | 25 |
26 class BlimpContentsObserver; | 26 class BlimpContentsObserver; |
27 class BlimpNavigationController; | 27 class BlimpNavigationController; |
28 class TabControlFeature; | |
28 | 29 |
29 class BlimpContentsImpl : public BlimpContents, | 30 class BlimpContentsImpl : public BlimpContents, |
30 public BlimpNavigationControllerDelegate { | 31 public BlimpNavigationControllerDelegate { |
31 public: | 32 public: |
32 explicit BlimpContentsImpl(int id); | 33 explicit BlimpContentsImpl(int id); |
33 ~BlimpContentsImpl() override; | 34 ~BlimpContentsImpl() override; |
34 | 35 |
35 #if defined(OS_ANDROID) | 36 #if defined(OS_ANDROID) |
36 base::android::ScopedJavaLocalRef<jobject> GetJavaBlimpContentsImpl(); | 37 base::android::ScopedJavaLocalRef<jobject> GetJavaBlimpContentsImpl(); |
37 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid(); | 38 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid(); |
38 #endif // defined(OS_ANDROID) | 39 #endif // defined(OS_ANDROID) |
39 | 40 |
40 // BlimpContents implementation. | 41 // BlimpContents implementation. |
41 BlimpNavigationControllerImpl& GetNavigationController() override; | 42 BlimpNavigationControllerImpl& GetNavigationController() override; |
42 void AddObserver(BlimpContentsObserver* observer) override; | 43 void AddObserver(BlimpContentsObserver* observer) override; |
43 void RemoveObserver(BlimpContentsObserver* observer) override; | 44 void RemoveObserver(BlimpContentsObserver* observer) override; |
44 | 45 |
45 // Check if some observer is in the observer list. | 46 // Check if some observer is in the observer list. |
46 bool HasObserver(BlimpContentsObserver* observer); | 47 bool HasObserver(BlimpContentsObserver* observer); |
47 | 48 |
48 // BlimpNavigationControllerDelegate implementation. | 49 // BlimpNavigationControllerDelegate implementation. |
49 void OnNavigationStateChanged() override; | 50 void OnNavigationStateChanged() override; |
50 | 51 |
52 // Set the pointer to the tab control feature. | |
53 void SetTabControlFeature(TabControlFeature* tab_control_feature); | |
nyquist
2016/08/16 20:41:04
seems like this could just be set_tab_control_feat
Menglin
2016/08/16 21:10:09
if we pass in the tab control feature in BlimpCont
nyquist
2016/08/16 21:41:40
yeah
Menglin
2016/08/17 19:48:46
Done.
| |
54 | |
55 void SetSizeAndScale(const gfx::Size& size, | |
56 float device_pixel_ratio) override; | |
57 | |
58 // This method is added for testing purpose. | |
59 TabControlFeature* tab_control_feature() { return tab_control_feature_; } | |
60 | |
51 int id() { return id_; } | 61 int id() { return id_; } |
52 | 62 |
53 private: | 63 private: |
54 // Handles the back/forward list and loading URLs. | 64 // Handles the back/forward list and loading URLs. |
55 BlimpNavigationControllerImpl navigation_controller_; | 65 BlimpNavigationControllerImpl navigation_controller_; |
56 | 66 |
57 // A list of all the observers of this BlimpContentsImpl. | 67 // A list of all the observers of this BlimpContentsImpl. |
58 base::ObserverList<BlimpContentsObserver> observers_; | 68 base::ObserverList<BlimpContentsObserver> observers_; |
59 | 69 |
60 // The id is assigned during contents creation. It is used by | 70 // The id is assigned during contents creation. It is used by |
61 // BlimpContentsManager to control the life time of the its observer. | 71 // BlimpContentsManager to control the life time of the its observer. |
62 int id_; | 72 int id_; |
63 | 73 |
74 // The tab control feature through which the BlimpContentsImpl is able to | |
75 // set size and scale. | |
76 TabControlFeature* tab_control_feature_ = nullptr; | |
77 | |
64 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); | 78 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); |
65 }; | 79 }; |
66 | 80 |
67 } // namespace client | 81 } // namespace client |
68 } // namespace blimp | 82 } // namespace blimp |
69 | 83 |
70 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ | 84 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ |
OLD | NEW |