Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: blimp/client/core/contents/blimp_contents_impl.h

Issue 2270323004: Add BlimpView to a Chrome tab when Blimp is enabled. (Closed)
Patch Set: Magic now happens Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/native_widget_types.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
27 class BlimpContentsObserver; 28 class BlimpContentsObserver;
28 class BlimpNavigationController; 29 class BlimpNavigationController;
29 class ImeFeature; 30 class ImeFeature;
30 class NavigationFeature; 31 class NavigationFeature;
31 class TabControlFeature; 32 class TabControlFeature;
32 33
33 class BlimpContentsImpl : public BlimpContents, 34 class BlimpContentsImpl : public BlimpContents,
34 public BlimpNavigationControllerDelegate { 35 public BlimpNavigationControllerDelegate {
35 public: 36 public:
36 // Ownership of the features remains with the caller. 37 // Ownership of the features remains with the caller.
38 // |window| must be the platform specific window that this will be shown in.
37 explicit BlimpContentsImpl(int id, 39 explicit BlimpContentsImpl(int id,
40 gfx::NativeWindow window,
38 ImeFeature* ime_feature, 41 ImeFeature* ime_feature,
39 NavigationFeature* navigation_feature, 42 NavigationFeature* navigation_feature,
40 TabControlFeature* tab_control_feature); 43 TabControlFeature* tab_control_feature);
41 ~BlimpContentsImpl() override; 44 ~BlimpContentsImpl() override;
42 45
43 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
44 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; 47 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override;
45 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid(); 48 BlimpContentsImplAndroid* GetBlimpContentsImplAndroid();
46 #endif // defined(OS_ANDROID) 49 #endif // defined(OS_ANDROID)
47 50
48 // BlimpContents implementation. 51 // BlimpContents implementation.
49 BlimpNavigationControllerImpl& GetNavigationController() override; 52 BlimpNavigationControllerImpl& GetNavigationController() override;
50 void AddObserver(BlimpContentsObserver* observer) override; 53 void AddObserver(BlimpContentsObserver* observer) override;
51 void RemoveObserver(BlimpContentsObserver* observer) override; 54 void RemoveObserver(BlimpContentsObserver* observer) override;
52 55
56 // Returns the platform specific window that this BlimpContents is showed in.
57 gfx::NativeWindow GetNativeWindow();
58
53 // Check if some observer is in the observer list. 59 // Check if some observer is in the observer list.
54 bool HasObserver(BlimpContentsObserver* observer); 60 bool HasObserver(BlimpContentsObserver* observer);
55 61
56 // BlimpNavigationControllerDelegate implementation. 62 // BlimpNavigationControllerDelegate implementation.
57 void OnNavigationStateChanged() override; 63 void OnNavigationStateChanged() override;
58 64
59 // Pushes the size and scale information to the engine, which will affect the 65 // Pushes the size and scale information to the engine, which will affect the
60 // web content display area for all tabs. 66 // web content display area for all tabs.
61 void SetSizeAndScale(const gfx::Size& size, float device_pixel_ratio); 67 void SetSizeAndScale(const gfx::Size& size, float device_pixel_ratio);
62 68
63 int id() { return id_; } 69 int id() { return id_; }
64 70
65 private: 71 private:
66 // Handles the back/forward list and loading URLs. 72 // Handles the back/forward list and loading URLs.
67 BlimpNavigationControllerImpl navigation_controller_; 73 BlimpNavigationControllerImpl navigation_controller_;
68 74
69 // A list of all the observers of this BlimpContentsImpl. 75 // A list of all the observers of this BlimpContentsImpl.
70 base::ObserverList<BlimpContentsObserver> observers_; 76 base::ObserverList<BlimpContentsObserver> observers_;
71 77
72 // The id is assigned during contents creation. It is used by 78 // The id is assigned during contents creation. It is used by
73 // BlimpContentsManager to control the life time of the its observer. 79 // BlimpContentsManager to control the life time of the its observer.
74 int id_; 80 int id_;
75 81
82 // The platform specific window that this BlimpContents is showed in.
83 gfx::NativeWindow window_;
84
76 // The tab control feature through which the BlimpContentsImpl is able to 85 // The tab control feature through which the BlimpContentsImpl is able to
77 // set size and scale. 86 // set size and scale.
78 // TODO(mlliu): in the long term, we want to put size and scale in a different 87 // TODO(mlliu): in the long term, we want to put size and scale in a different
79 // feature instead of tab control feature. crbug.com/639154. 88 // feature instead of tab control feature. crbug.com/639154.
80 TabControlFeature* tab_control_feature_ = nullptr; 89 TabControlFeature* tab_control_feature_ = nullptr;
81 90
82 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl); 91 DISALLOW_COPY_AND_ASSIGN(BlimpContentsImpl);
83 }; 92 };
84 93
85 } // namespace client 94 } // namespace client
86 } // namespace blimp 95 } // namespace blimp
87 96
88 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_ 97 #endif // BLIMP_CLIENT_CORE_CONTENTS_BLIMP_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698