Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 | 98 |
| 99 PlatformWindowMus::~PlatformWindowMus() { | 99 PlatformWindowMus::~PlatformWindowMus() { |
| 100 if (!mus_window_) | 100 if (!mus_window_) |
| 101 return; | 101 return; |
| 102 mus_window_->RemoveObserver(this); | 102 mus_window_->RemoveObserver(this); |
| 103 mus_window_->set_input_event_handler(nullptr); | 103 mus_window_->set_input_event_handler(nullptr); |
| 104 if (!mus_window_destroyed_) | 104 if (!mus_window_destroyed_) |
| 105 mus_window_->Destroy(); | 105 mus_window_->Destroy(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void PlatformWindowMus::Activate() { | |
| 109 mus_window_->SetFocus(); | |
| 110 } | |
| 111 | |
| 112 void PlatformWindowMus::SetCursorById(mus::mojom::Cursor cursor) { | 108 void PlatformWindowMus::SetCursorById(mus::mojom::Cursor cursor) { |
| 113 if (last_cursor_ != cursor) { | 109 if (last_cursor_ != cursor) { |
| 114 // The ui::PlatformWindow interface uses ui::PlatformCursor at this level, | 110 // The ui::PlatformWindow interface uses ui::PlatformCursor at this level, |
| 115 // instead of ui::Cursor. All of the cursor abstractions in ui right now are | 111 // instead of ui::Cursor. All of the cursor abstractions in ui right now are |
| 116 // sort of leaky; despite being nominally cross platform, they all drop down | 112 // sort of leaky; despite being nominally cross platform, they all drop down |
| 117 // to platform types almost immediately, which makes them unusable as | 113 // to platform types almost immediately, which makes them unusable as |
| 118 // transport types. | 114 // transport types. |
| 119 mus_window_->SetPredefinedCursor(cursor); | 115 mus_window_->SetPredefinedCursor(cursor); |
| 120 } | 116 } |
| 121 } | 117 } |
| 122 | 118 |
| 123 void PlatformWindowMus::Show() { | 119 void PlatformWindowMus::Show() { |
| 124 mus_window_->SetVisible(true); | 120 mus_window_->SetVisible(true); |
| 125 } | 121 } |
| 126 | 122 |
| 127 void PlatformWindowMus::Hide() { | 123 void PlatformWindowMus::Hide() { |
| 128 mus_window_->SetVisible(false); | 124 mus_window_->SetVisible(false); |
| 129 } | 125 } |
| 130 | 126 |
| 131 void PlatformWindowMus::Close() { | 127 void PlatformWindowMus::Close() { |
| 132 NOTIMPLEMENTED(); | 128 NOTIMPLEMENTED(); |
| 133 } | 129 } |
| 134 | 130 |
| 135 void PlatformWindowMus::SetBounds(const gfx::Rect& bounds) { | 131 void PlatformWindowMus::SetBounds(const gfx::Rect& bounds) { |
| 136 mus_window_->SetBounds(bounds); | 132 NOTIMPLEMENTED(); |
|
sadrul
2016/05/09 18:55:54
Remove the NOTIMEPLEMENTED()
Mark Dittmer
2016/05/09 19:17:04
Done.
| |
| 137 } | 133 } |
| 138 | 134 |
| 139 gfx::Rect PlatformWindowMus::GetBounds() { | 135 gfx::Rect PlatformWindowMus::GetBounds() { |
| 140 return mus_window_->bounds(); | 136 return mus_window_->bounds(); |
| 141 } | 137 } |
| 142 | 138 |
| 143 void PlatformWindowMus::SetTitle(const base::string16& title) { | 139 void PlatformWindowMus::SetTitle(const base::string16& title) { |
| 144 NOTIMPLEMENTED(); | 140 NOTIMPLEMENTED(); |
| 145 } | 141 } |
| 146 | 142 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 // |this| has been destroyed at this point. | 197 // |this| has been destroyed at this point. |
| 202 #ifndef NDEBUG | 198 #ifndef NDEBUG |
| 203 DCHECK(!weak_ptr); | 199 DCHECK(!weak_ptr); |
| 204 #endif | 200 #endif |
| 205 } | 201 } |
| 206 | 202 |
| 207 void PlatformWindowMus::OnWindowBoundsChanged(mus::Window* window, | 203 void PlatformWindowMus::OnWindowBoundsChanged(mus::Window* window, |
| 208 const gfx::Rect& old_bounds, | 204 const gfx::Rect& old_bounds, |
| 209 const gfx::Rect& new_bounds) { | 205 const gfx::Rect& new_bounds) { |
| 210 delegate_->OnBoundsChanged(new_bounds); | 206 delegate_->OnBoundsChanged(new_bounds); |
| 211 } | 207 } |
|
sadrul
2016/05/09 18:55:54
Move this over into NativeWidgetMus too. i.e. move
Mark Dittmer
2016/05/09 19:17:04
Done.
| |
| 212 | 208 |
| 213 void PlatformWindowMus::OnWindowFocusChanged(mus::Window* gained_focus, | 209 void PlatformWindowMus::OnWindowFocusChanged(mus::Window* gained_focus, |
| 214 mus::Window* lost_focus) { | 210 mus::Window* lost_focus) { |
| 215 if (gained_focus == mus_window_) | 211 if (gained_focus == mus_window_) |
| 216 delegate_->OnActivationChanged(true); | 212 delegate_->OnActivationChanged(true); |
| 217 else if (lost_focus == mus_window_) | 213 else if (lost_focus == mus_window_) |
| 218 delegate_->OnActivationChanged(false); | 214 delegate_->OnActivationChanged(false); |
| 219 } | 215 } |
| 220 | 216 |
| 221 void PlatformWindowMus::OnWindowPredefinedCursorChanged( | 217 void PlatformWindowMus::OnWindowPredefinedCursorChanged( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 | 269 |
| 274 std::unique_ptr<ui::Event> event = ui::Event::Clone(event_in); | 270 std::unique_ptr<ui::Event> event = ui::Event::Clone(event_in); |
| 275 delegate_->DispatchEvent(event.get()); | 271 delegate_->DispatchEvent(event.get()); |
| 276 // NOTE: |this| may be deleted. | 272 // NOTE: |this| may be deleted. |
| 277 | 273 |
| 278 ack_handler.set_handled(event->handled()); | 274 ack_handler.set_handled(event->handled()); |
| 279 // |ack_handler| acks the event on destruction if necessary. | 275 // |ack_handler| acks the event on destruction if necessary. |
| 280 } | 276 } |
| 281 | 277 |
| 282 } // namespace views | 278 } // namespace views |
| OLD | NEW |