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

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

Issue 2068093002: mus: Allow embedder to intercept events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot-merge Created 4 years, 5 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mus.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <utility> 7 #include <utility>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "components/mus/public/cpp/property_type_converters.h"
10 #include "components/mus/public/cpp/window.h" 11 #include "components/mus/public/cpp/window.h"
12 #include "components/mus/public/cpp/window_property.h"
11 #include "components/mus/public/cpp/window_tree_client.h" 13 #include "components/mus/public/cpp/window_tree_client.h"
14 #include "components/mus/public/interfaces/window_manager_constants.mojom.h"
12 #include "content/browser/renderer_host/render_process_host_impl.h" 15 #include "content/browser/renderer_host/render_process_host_impl.h"
13 #include "content/browser/renderer_host/render_widget_host_impl.h" 16 #include "content/browser/renderer_host/render_widget_host_impl.h"
14 #include "content/common/render_widget_window_tree_client_factory.mojom.h" 17 #include "content/common/render_widget_window_tree_client_factory.mojom.h"
15 #include "content/common/text_input_state.h" 18 #include "content/common/text_input_state.h"
16 #include "content/public/common/mojo_shell_connection.h" 19 #include "content/public/common/mojo_shell_connection.h"
17 #include "services/shell/public/cpp/connector.h" 20 #include "services/shell/public/cpp/connector.h"
18 #include "ui/aura/client/screen_position_client.h" 21 #include "ui/aura/client/screen_position_client.h"
19 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
20 #include "ui/base/hit_test.h" 23 #include "ui/base/hit_test.h"
21 24
22 namespace blink { 25 namespace blink {
23 struct WebScreenInfo; 26 struct WebScreenInfo;
24 } 27 }
25 28
26 namespace content { 29 namespace content {
27 30
28 RenderWidgetHostViewMus::RenderWidgetHostViewMus(mus::Window* parent_window, 31 RenderWidgetHostViewMus::RenderWidgetHostViewMus(mus::Window* parent_window,
29 RenderWidgetHostImpl* host) 32 RenderWidgetHostImpl* host)
30 : host_(host), aura_window_(nullptr) { 33 : host_(host), aura_window_(nullptr) {
31 DCHECK(parent_window); 34 DCHECK(parent_window);
32 mus::Window* window = parent_window->window_tree()->NewWindow(); 35 mus::Window* window = parent_window->window_tree()->NewWindow();
33 window->SetVisible(true); 36 window->SetVisible(true);
34 window->SetBounds(gfx::Rect(300, 300)); 37 window->SetBounds(gfx::Rect(300, 300));
38 window->set_input_event_handler(this);
35 parent_window->AddChild(window); 39 parent_window->AddChild(window);
36 mus_window_.reset(new mus::ScopedWindowPtr(window)); 40 mus_window_.reset(new mus::ScopedWindowPtr(window));
37 host_->SetView(this); 41 host_->SetView(this);
38 42
39 // Connect to the renderer, pass it a WindowTreeClient interface request 43 // Connect to the renderer, pass it a WindowTreeClient interface request
40 // and embed that client inside our mus window. 44 // and embed that client inside our mus window.
41 mojom::RenderWidgetWindowTreeClientFactoryPtr factory; 45 mojom::RenderWidgetWindowTreeClientFactoryPtr factory;
42 host_->GetProcess()->GetChildConnection()->GetInterface(&factory); 46 host_->GetProcess()->GetChildConnection()->GetInterface(&factory);
43 47
44 mus::mojom::WindowTreeClientPtr window_tree_client; 48 mus::mojom::WindowTreeClientPtr window_tree_client;
45 factory->CreateWindowTreeClientForRenderWidget( 49 factory->CreateWindowTreeClientForRenderWidget(
46 host_->GetRoutingID(), mojo::GetProxy(&window_tree_client)); 50 host_->GetRoutingID(), mojo::GetProxy(&window_tree_client));
47 mus_window_->window()->Embed(std::move(window_tree_client)); 51 mus_window_->window()->Embed(std::move(window_tree_client),
52 mus::mojom::kEmbedFlagEmbedderInterceptsEvents);
48 } 53 }
49 54
50 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} 55 RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {}
51 56
52 void RenderWidgetHostViewMus::InternalSetBounds(const gfx::Rect& rect) { 57 void RenderWidgetHostViewMus::InternalSetBounds(const gfx::Rect& rect) {
53 aura_window_->SetBounds(rect); 58 aura_window_->SetBounds(rect);
54 gfx::Rect bounds = aura_window_->GetBoundsInRootWindow(); 59 gfx::Rect bounds = aura_window_->GetBoundsInRootWindow();
55 mus_window_->window()->SetBounds(bounds); 60 mus_window_->window()->SetBounds(bounds);
56 host_->WasResized(); 61 host_->WasResized();
57 } 62 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 #endif // defined(OS_MACOSX) 296 #endif // defined(OS_MACOSX)
292 297
293 void RenderWidgetHostViewMus::LockCompositingSurface() { 298 void RenderWidgetHostViewMus::LockCompositingSurface() {
294 NOTIMPLEMENTED(); 299 NOTIMPLEMENTED();
295 } 300 }
296 301
297 void RenderWidgetHostViewMus::UnlockCompositingSurface() { 302 void RenderWidgetHostViewMus::UnlockCompositingSurface() {
298 NOTIMPLEMENTED(); 303 NOTIMPLEMENTED();
299 } 304 }
300 305
306 void RenderWidgetHostViewMus::OnWindowInputEvent(
307 mus::Window* window,
308 const ui::Event& event,
309 std::unique_ptr<base::Callback<void(mus::mojom::EventResult)>>*
310 ack_callback) {
311 // TODO(sad): Dispatch |event| to the RenderWidgetHost.
312 }
313
301 } // namespace content 314 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698