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

Side by Side Diff: services/ui/public/cpp/window.cc

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear the implicit pointer drags before start. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/ui/public/cpp/window.h" 5 #include "services/ui/public/cpp/window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 440
441 bool Window::HasFocus() const { 441 bool Window::HasFocus() const {
442 return client_ && client_->GetFocusedWindow() == this; 442 return client_ && client_->GetFocusedWindow() == this;
443 } 443 }
444 444
445 void Window::SetCanFocus(bool can_focus) { 445 void Window::SetCanFocus(bool can_focus) {
446 if (client_) 446 if (client_)
447 client_->SetCanFocus(server_id_, can_focus); 447 client_->SetCanFocus(server_id_, can_focus);
448 } 448 }
449 449
450 void Window::SetCanAcceptDrops(WindowDropTarget* drop_target) {
451 if (drop_target_ == drop_target)
452 return;
453 drop_target_ = drop_target;
454 if (client_)
455 client_->SetCanAcceptDrops(server_id_, !!drop_target_);
456 }
457
450 void Window::SetCanAcceptEvents(bool can_accept_events) { 458 void Window::SetCanAcceptEvents(bool can_accept_events) {
451 if (can_accept_events_ == can_accept_events) 459 if (can_accept_events_ == can_accept_events)
452 return; 460 return;
453 can_accept_events_ = can_accept_events; 461 can_accept_events_ = can_accept_events;
454 if (client_) 462 if (client_)
455 client_->SetCanAcceptEvents(server_id_, can_accept_events_); 463 client_->SetCanAcceptEvents(server_id_, can_accept_events_);
456 } 464 }
457 465
458 void Window::Embed(ui::mojom::WindowTreeClientPtr client, uint32_t flags) { 466 void Window::Embed(ui::mojom::WindowTreeClientPtr client, uint32_t flags) {
459 Embed(std::move(client), base::Bind(&EmptyEmbedCallback), flags); 467 Embed(std::move(client), base::Bind(&EmptyEmbedCallback), flags);
460 } 468 }
461 469
462 void Window::Embed(ui::mojom::WindowTreeClientPtr client, 470 void Window::Embed(ui::mojom::WindowTreeClientPtr client,
463 const EmbedCallback& callback, 471 const EmbedCallback& callback,
464 uint32_t flags) { 472 uint32_t flags) {
465 if (PrepareForEmbed()) 473 if (PrepareForEmbed())
466 client_->Embed(server_id_, std::move(client), flags, callback); 474 client_->Embed(server_id_, std::move(client), flags, callback);
467 else 475 else
468 callback.Run(false); 476 callback.Run(false);
469 } 477 }
470 478
471 void Window::RequestClose() { 479 void Window::RequestClose() {
472 if (client_) 480 if (client_)
473 client_->RequestClose(this); 481 client_->RequestClose(this);
474 } 482 }
475 483
484 void Window::PerformDragDrop(
485 int drag_pointer,
486 const std::map<std::string, std::vector<uint8_t>>& drag_data,
487 int drag_operation,
488 const gfx::Point& cursor_location,
489 const SkBitmap& bitmap,
490 const base::Callback<void(bool)>& callback) {
491 client_->PerformDragDrop(this, drag_pointer, drag_data, drag_operation,
492 cursor_location, bitmap, callback);
493 }
494
476 void Window::PerformWindowMove(mojom::MoveLoopSource source, 495 void Window::PerformWindowMove(mojom::MoveLoopSource source,
477 const gfx::Point& cursor_location, 496 const gfx::Point& cursor_location,
478 const base::Callback<void(bool)>& callback) { 497 const base::Callback<void(bool)>& callback) {
479 client_->PerformWindowMove(this, source, cursor_location, callback); 498 client_->PerformWindowMove(this, source, cursor_location, callback);
480 } 499 }
481 500
482 void Window::CancelWindowMove() { 501 void Window::CancelWindowMove() {
483 client_->CancelWindowMove(this); 502 client_->CancelWindowMove(this);
484 } 503 }
485 504
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 notifier->NotifyWindowReordered(); 921 notifier->NotifyWindowReordered();
903 922
904 return true; 923 return true;
905 } 924 }
906 925
907 // static 926 // static
908 Window** Window::GetStackingTarget(Window* window) { 927 Window** Window::GetStackingTarget(Window* window) {
909 return &window->stacking_target_; 928 return &window->stacking_target_;
910 } 929 }
911 } // namespace ui 930 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698