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

Side by Side Diff: ui/views/mus/platform_window_mus.cc

Issue 1982663003: [TEST ONLY] Run tests for 1981803003 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « ui/views/mus/platform_window_mus.h ('k') | ui/views/mus/platform_window_mus_unittest.cc » ('j') | 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 "ui/views/mus/platform_window_mus.h" 5 #include "ui/views/mus/platform_window_mus.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "components/bitmap_uploader/bitmap_uploader.h" 9 #include "components/bitmap_uploader/bitmap_uploader.h"
10 #include "components/mus/public/cpp/property_type_converters.h" 10 #include "components/mus/public/cpp/property_type_converters.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } // namespace 64 } // namespace
65 65
66 PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate, 66 PlatformWindowMus::PlatformWindowMus(ui::PlatformWindowDelegate* delegate,
67 shell::Connector* connector, 67 shell::Connector* connector,
68 mus::Window* mus_window) 68 mus::Window* mus_window)
69 : delegate_(delegate), 69 : delegate_(delegate),
70 mus_window_(mus_window), 70 mus_window_(mus_window),
71 mus_window_destroyed_(false) { 71 mus_window_destroyed_(false) {
72 DCHECK(delegate_); 72 DCHECK(delegate_);
73 DCHECK(mus_window_); 73 DCHECK(mus_window_);
74 mus_window_->set_input_event_handler(this);
75 74
76 // We need accelerated widget numbers to be different for each 75 // We need accelerated widget numbers to be different for each
77 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t 76 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t
78 // has this property. 77 // has this property.
79 #if defined(OS_WIN) || defined(OS_ANDROID) 78 #if defined(OS_WIN) || defined(OS_ANDROID)
80 gfx::AcceleratedWidget accelerated_widget = 79 gfx::AcceleratedWidget accelerated_widget =
81 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); 80 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
82 #else 81 #else
83 gfx::AcceleratedWidget accelerated_widget = 82 gfx::AcceleratedWidget accelerated_widget =
84 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); 83 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
85 #endif 84 #endif
86 delegate_->OnAcceleratedWidgetAvailable( 85 delegate_->OnAcceleratedWidgetAvailable(
87 accelerated_widget, mus_window_->viewport_metrics().device_pixel_ratio); 86 accelerated_widget, mus_window_->viewport_metrics().device_pixel_ratio);
88 87
89 bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(mus_window_)); 88 bitmap_uploader_.reset(new bitmap_uploader::BitmapUploader(mus_window_));
90 bitmap_uploader_->Init(connector); 89 bitmap_uploader_->Init(connector);
91 prop_.reset(new ui::ViewProp( 90 prop_.reset(new ui::ViewProp(
92 accelerated_widget, bitmap_uploader::kBitmapUploaderForAcceleratedWidget, 91 accelerated_widget, bitmap_uploader::kBitmapUploaderForAcceleratedWidget,
93 bitmap_uploader_.get())); 92 bitmap_uploader_.get()));
94 } 93 }
95 94
96 PlatformWindowMus::~PlatformWindowMus() { 95 PlatformWindowMus::~PlatformWindowMus() {}
97 if (!mus_window_)
98 return;
99 mus_window_->set_input_event_handler(nullptr);
100 }
101 96
102 void PlatformWindowMus::Show() {} 97 void PlatformWindowMus::Show() {}
103 98
104 void PlatformWindowMus::Hide() {} 99 void PlatformWindowMus::Hide() {}
105 100
106 void PlatformWindowMus::Close() { 101 void PlatformWindowMus::Close() {
107 NOTIMPLEMENTED(); 102 NOTIMPLEMENTED();
108 } 103 }
109 104
110 void PlatformWindowMus::SetBounds(const gfx::Rect& bounds) {} 105 void PlatformWindowMus::SetBounds(const gfx::Rect& bounds) {}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 139 }
145 140
146 void PlatformWindowMus::ConfineCursorToBounds(const gfx::Rect& bounds) { 141 void PlatformWindowMus::ConfineCursorToBounds(const gfx::Rect& bounds) {
147 NOTIMPLEMENTED(); 142 NOTIMPLEMENTED();
148 } 143 }
149 144
150 ui::PlatformImeController* PlatformWindowMus::GetPlatformImeController() { 145 ui::PlatformImeController* PlatformWindowMus::GetPlatformImeController() {
151 return nullptr; 146 return nullptr;
152 } 147 }
153 148
154 void PlatformWindowMus::OnWindowInputEvent(
155 mus::Window* view,
156 const ui::Event& event_in,
157 std::unique_ptr<base::Callback<void(EventResult)>>* ack_callback) {
158 // Take ownership of the callback, indicating that we will handle it.
159 EventAckHandler ack_handler(std::move(*ack_callback));
160
161 std::unique_ptr<ui::Event> event = ui::Event::Clone(event_in);
162 delegate_->DispatchEvent(event.get());
163 // NOTE: |this| may be deleted.
164
165 ack_handler.set_handled(event->handled());
166 // |ack_handler| acks the event on destruction if necessary.
167 }
168
169 } // namespace views 149 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/platform_window_mus.h ('k') | ui/views/mus/platform_window_mus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698