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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mus.cc

Issue 1461243002: [OLD ATTEMPT, DO NOT REVIEW] mustash: Enable connections to mus from the Chrome renderer Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Invert connection creation flow. Needs lots of work. Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/browser/renderer_host/render_widget_host_view_mus.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mus.h"
6 6
7 #include "components/mus/public/cpp/window.h"
8 #include "components/mus/public/cpp/window_tree_connection.h"
9 #include "content/browser/mojo/mojo_shell_client_host.h"
10 #include "content/browser/renderer_host/render_process_host_impl.h"
7 #include "content/browser/renderer_host/render_widget_host_impl.h" 11 #include "content/browser/renderer_host/render_widget_host_impl.h"
12 #include "content/public/common/mojo_shell_connection.h"
13 #include "mojo/application/public/cpp/application_impl.h"
8 14
9 namespace blink { 15 namespace blink {
10 struct WebScreenInfo; 16 struct WebScreenInfo;
11 } 17 }
12 18
13 namespace content { 19 namespace content {
14 20
15 RenderWidgetHostViewMus::RenderWidgetHostViewMus( 21 RenderWidgetHostViewMus::RenderWidgetHostViewMus(
22 mus::Window* parent_window,
16 RenderWidgetHostImpl* host, 23 RenderWidgetHostImpl* host,
17 base::WeakPtr<RenderWidgetHostViewBase> platform_view) 24 base::WeakPtr<RenderWidgetHostViewBase> platform_view)
18 : host_(host), platform_view_(platform_view) { 25 : host_(host), platform_view_(platform_view) {
26 DCHECK(parent_window);
27 mus::Window* window = parent_window->connection()->NewWindow();
28 window->SetVisible(true);
29 window->SetBounds(parent_window->bounds());
30 parent_window->AddChild(window);
31 window_.reset(new mus::ScopedWindowPtr(window));
19 host_->SetView(this); 32 host_->SetView(this);
33
34 //if (!host_->GetProcess()->IsReady()) {
Fady Samuel 2015/11/24 04:42:38 Delete this.
35 // host_->GetProcess()->AddObserver(this);
36 // return;
37 //}
38
39 //EmbedClient();
20 } 40 }
21 41
22 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} 42 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {}
23 43
24 void RenderWidgetHostViewMus::Show() { 44 void RenderWidgetHostViewMus::Show() {
25 // TODO(fsamuel): Update visibility in Mus. 45 // TODO(fsamuel): Update visibility in Mus.
26 // There is some interstitial complexity that we'll need to figure out here. 46 // There is some interstitial complexity that we'll need to figure out here.
27 host_->WasShown(ui::LatencyInfo()); 47 host_->WasShown(ui::LatencyInfo());
28 } 48 }
29 49
30 void RenderWidgetHostViewMus::Hide() { 50 void RenderWidgetHostViewMus::Hide() {
31 host_->WasHidden(); 51 host_->WasHidden();
32 } 52 }
33 53
34 bool RenderWidgetHostViewMus::IsShowing() { 54 bool RenderWidgetHostViewMus::IsShowing() {
35 return !host_->is_hidden(); 55 return !host_->is_hidden();
36 } 56 }
37 57
38 void RenderWidgetHostViewMus::SetSize(const gfx::Size& size) { 58 void RenderWidgetHostViewMus::SetSize(const gfx::Size& size) {
39 size_ = size; 59 gfx::Rect bounds = window_->window()->bounds();
40 host_->WasResized(); 60 bounds.set_size(size);
61 SetBounds(bounds);
41 } 62 }
42 63
43 void RenderWidgetHostViewMus::SetBounds(const gfx::Rect& rect) { 64 void RenderWidgetHostViewMus::SetBounds(const gfx::Rect& rect) {
44 SetSize(rect.size()); 65 window_->window()->SetBounds(rect);
66 host_->WasResized();
45 } 67 }
46 68
47 void RenderWidgetHostViewMus::Focus() { 69 void RenderWidgetHostViewMus::Focus() {
48 // TODO(fsamuel): Request focus for the associated Mus::Window 70 // TODO(fsamuel): Request focus for the associated Mus::Window
49 // We need to be careful how we propagate focus as we navigate to and 71 // We need to be careful how we propagate focus as we navigate to and
50 // from interstitials. 72 // from interstitials.
73 window_->window()->SetFocus();
51 } 74 }
52 75
53 bool RenderWidgetHostViewMus::HasFocus() const { 76 bool RenderWidgetHostViewMus::HasFocus() const {
54 return true; 77 return true;
55 } 78 }
56 79
57 bool RenderWidgetHostViewMus::IsSurfaceAvailableForCopy() const { 80 bool RenderWidgetHostViewMus::IsSurfaceAvailableForCopy() const {
58 NOTIMPLEMENTED(); 81 NOTIMPLEMENTED();
59 return false; 82 return false;
60 } 83 }
61 84
62 gfx::Rect RenderWidgetHostViewMus::GetViewBounds() const { 85 gfx::Rect RenderWidgetHostViewMus::GetViewBounds() const {
63 return gfx::Rect(size_); 86 return window_->window()->bounds();
64 } 87 }
65 88
66 gfx::Vector2dF RenderWidgetHostViewMus::GetLastScrollOffset() const { 89 gfx::Vector2dF RenderWidgetHostViewMus::GetLastScrollOffset() const {
67 return gfx::Vector2dF(); 90 return gfx::Vector2dF();
68 } 91 }
69 92
70 void RenderWidgetHostViewMus::RenderProcessGone(base::TerminationStatus status, 93 void RenderWidgetHostViewMus::RenderProcessGone(base::TerminationStatus status,
71 int error_code) { 94 int error_code) {
72 // TODO(fsamuel): Figure out the interstitial lifetime issues here. 95 // TODO(fsamuel): Figure out the interstitial lifetime issues here.
73 platform_view_->Destroy(); 96 platform_view_->Destroy();
(...skipping 10 matching lines...) Expand all
84 107
85 base::string16 RenderWidgetHostViewMus::GetSelectedText() const { 108 base::string16 RenderWidgetHostViewMus::GetSelectedText() const {
86 return platform_view_->GetSelectedText(); 109 return platform_view_->GetSelectedText();
87 } 110 }
88 111
89 void RenderWidgetHostViewMus::SetTooltipText( 112 void RenderWidgetHostViewMus::SetTooltipText(
90 const base::string16& tooltip_text) { 113 const base::string16& tooltip_text) {
91 // TOOD(fsamuel): Ask window manager for tooltip? 114 // TOOD(fsamuel): Ask window manager for tooltip?
92 } 115 }
93 116
117 void RenderWidgetHostViewMus::EmbedWindowTreeClient(
118 mus::mojom::WindowTreeClientPtr tree_client) {
119 fprintf(stderr, ">>>%s\n", __PRETTY_FUNCTION__);
120 window_->window()->Embed(tree_client.Pass());
121 }
122
94 void RenderWidgetHostViewMus::InitAsChild(gfx::NativeView parent_view) { 123 void RenderWidgetHostViewMus::InitAsChild(gfx::NativeView parent_view) {
95 platform_view_->InitAsChild(parent_view); 124 platform_view_->InitAsChild(parent_view);
96 } 125 }
97 126
98 RenderWidgetHost* RenderWidgetHostViewMus::GetRenderWidgetHost() const { 127 RenderWidgetHost* RenderWidgetHostViewMus::GetRenderWidgetHost() const {
99 return host_; 128 return host_;
100 } 129 }
101 130
102 void RenderWidgetHostViewMus::InitAsPopup( 131 void RenderWidgetHostViewMus::InitAsPopup(
103 RenderWidgetHostView* parent_host_view, 132 RenderWidgetHostView* parent_host_view,
104 const gfx::Rect& bounds) { 133 const gfx::Rect& bounds) {
105 // TODO(fsamuel): Implement popups in Mus. 134 // TODO(fsamuel): Implement popups in Mus.
106 } 135 }
107 136
108 void RenderWidgetHostViewMus::InitAsFullscreen( 137 void RenderWidgetHostViewMus::InitAsFullscreen(
109 RenderWidgetHostView* reference_host_view) { 138 RenderWidgetHostView* reference_host_view) {
110 // TODO(fsamuel): Implement full screen windows in Mus. 139 // TODO(fsamuel): Implement full screen windows in Mus.
111 } 140 }
112 141
113 gfx::NativeView RenderWidgetHostViewMus::GetNativeView() const { 142 gfx::NativeView RenderWidgetHostViewMus::GetNativeView() const {
114 return gfx::NativeView(); 143 return platform_view_->GetNativeView();
115 } 144 }
116 145
117 gfx::NativeViewId RenderWidgetHostViewMus::GetNativeViewId() const { 146 gfx::NativeViewId RenderWidgetHostViewMus::GetNativeViewId() const {
118 return gfx::NativeViewId(); 147 return platform_view_->GetNativeViewId();
119 } 148 }
120 149
121 gfx::NativeViewAccessible RenderWidgetHostViewMus::GetNativeViewAccessible() { 150 gfx::NativeViewAccessible RenderWidgetHostViewMus::GetNativeViewAccessible() {
122 return gfx::NativeViewAccessible(); 151 return gfx::NativeViewAccessible();
123 } 152 }
124 153
125 void RenderWidgetHostViewMus::MovePluginWindows( 154 void RenderWidgetHostViewMus::MovePluginWindows(
126 const std::vector<WebPluginGeometry>& moves) { 155 const std::vector<WebPluginGeometry>& moves) {
127 platform_view_->MovePluginWindows(moves); 156 platform_view_->MovePluginWindows(moves);
128 } 157 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // TODO(fsamuel): Populate screen info from Mus. 234 // TODO(fsamuel): Populate screen info from Mus.
206 } 235 }
207 236
208 bool RenderWidgetHostViewMus::GetScreenColorProfile( 237 bool RenderWidgetHostViewMus::GetScreenColorProfile(
209 std::vector<char>* color_profile) { 238 std::vector<char>* color_profile) {
210 // TODO(fsamuel): Implement color profile in Mus. 239 // TODO(fsamuel): Implement color profile in Mus.
211 return false; 240 return false;
212 } 241 }
213 242
214 gfx::Rect RenderWidgetHostViewMus::GetBoundsInRootWindow() { 243 gfx::Rect RenderWidgetHostViewMus::GetBoundsInRootWindow() {
215 return GetViewBounds(); 244 return platform_view_->GetBoundsInRootWindow();
216 } 245 }
217 246
218 #if defined(OS_MACOSX) 247 #if defined(OS_MACOSX)
219 void RenderWidgetHostViewMus::SetActive(bool active) { 248 void RenderWidgetHostViewMus::SetActive(bool active) {
220 platform_view_->SetActive(active); 249 platform_view_->SetActive(active);
221 } 250 }
222 251
223 void RenderWidgetHostViewMus::SetWindowVisibility(bool visible) { 252 void RenderWidgetHostViewMus::SetWindowVisibility(bool visible) {
224 // TODO(fsamuel): Propagate visibility to Mus? 253 // TODO(fsamuel): Propagate visibility to Mus?
225 platform_view_->SetWindowVisibility(visible); 254 platform_view_->SetWindowVisibility(visible);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 void RenderWidgetHostViewMus::SetParentNativeViewAccessible( 299 void RenderWidgetHostViewMus::SetParentNativeViewAccessible(
271 gfx::NativeViewAccessible accessible_parent) {} 300 gfx::NativeViewAccessible accessible_parent) {}
272 301
273 gfx::NativeViewId RenderWidgetHostViewMus::GetParentForWindowlessPlugin() 302 gfx::NativeViewId RenderWidgetHostViewMus::GetParentForWindowlessPlugin()
274 const { 303 const {
275 return gfx::NativeViewId(); 304 return gfx::NativeViewId();
276 } 305 }
277 #endif 306 #endif
278 307
279 } // namespace content 308 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698