OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
6 | 6 |
7 #include <X11/extensions/Xfixes.h> | 7 #include <X11/extensions/Xfixes.h> |
8 #include <X11/Xatom.h> | 8 #include <X11/Xatom.h> |
9 #include <list> | 9 #include <list> |
10 #include <set> | 10 #include <set> |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } | 527 } |
528 | 528 |
529 bool Clipboard::AuraX11Details::CanDispatchEvent(const PlatformEvent& event) { | 529 bool Clipboard::AuraX11Details::CanDispatchEvent(const PlatformEvent& event) { |
530 return event->xany.window == x_window_; | 530 return event->xany.window == x_window_; |
531 } | 531 } |
532 | 532 |
533 uint32_t Clipboard::AuraX11Details::DispatchEvent(const PlatformEvent& xev) { | 533 uint32_t Clipboard::AuraX11Details::DispatchEvent(const PlatformEvent& xev) { |
534 switch (xev->type) { | 534 switch (xev->type) { |
535 case SelectionRequest: { | 535 case SelectionRequest: { |
536 if (xev->xselectionrequest.selection == XA_PRIMARY) { | 536 if (xev->xselectionrequest.selection == XA_PRIMARY) { |
537 primary_owner_.OnSelectionRequest(xev->xselectionrequest); | 537 primary_owner_.OnSelectionRequest(*xev); |
538 } else { | 538 } else { |
539 // We should not get requests for the CLIPBOARD_MANAGER selection | 539 // We should not get requests for the CLIPBOARD_MANAGER selection |
540 // because we never take ownership of it. | 540 // because we never take ownership of it. |
541 DCHECK_EQ(GetCopyPasteSelection(), xev->xselectionrequest.selection); | 541 DCHECK_EQ(GetCopyPasteSelection(), xev->xselectionrequest.selection); |
542 clipboard_owner_.OnSelectionRequest(xev->xselectionrequest); | 542 clipboard_owner_.OnSelectionRequest(*xev); |
543 } | 543 } |
544 break; | 544 break; |
545 } | 545 } |
546 case SelectionNotify: { | 546 case SelectionNotify: { |
547 ::Atom selection = xev->xselection.selection; | 547 ::Atom selection = xev->xselection.selection; |
548 if (selection == XA_PRIMARY) | 548 if (selection == XA_PRIMARY) |
549 primary_requestor_.OnSelectionNotify(*xev); | 549 primary_requestor_.OnSelectionNotify(*xev); |
550 else if (selection == GetCopyPasteSelection()) | 550 else if (selection == GetCopyPasteSelection()) |
551 clipboard_requestor_.OnSelectionNotify(*xev); | 551 clipboard_requestor_.OnSelectionNotify(*xev); |
552 else if (selection == atom_cache_.GetAtom(kClipboardManager)) | 552 else if (selection == atom_cache_.GetAtom(kClipboardManager)) |
553 clipboard_manager_requestor_.OnSelectionNotify(*xev); | 553 clipboard_manager_requestor_.OnSelectionNotify(*xev); |
554 break; | 554 break; |
555 } | 555 } |
556 case SelectionClear: { | 556 case SelectionClear: { |
557 if (xev->xselectionclear.selection == XA_PRIMARY) { | 557 if (xev->xselectionclear.selection == XA_PRIMARY) { |
558 primary_owner_.OnSelectionClear(xev->xselectionclear); | 558 primary_owner_.OnSelectionClear(*xev); |
559 } else { | 559 } else { |
560 // We should not get requests for the CLIPBOARD_MANAGER selection | 560 // We should not get requests for the CLIPBOARD_MANAGER selection |
561 // because we never take ownership of it. | 561 // because we never take ownership of it. |
562 DCHECK_EQ(GetCopyPasteSelection(), xev->xselection.selection); | 562 DCHECK_EQ(GetCopyPasteSelection(), xev->xselection.selection); |
563 clipboard_owner_.OnSelectionClear(xev->xselectionclear); | 563 clipboard_owner_.OnSelectionClear(*xev); |
564 } | 564 } |
565 break; | 565 break; |
566 } | 566 } |
567 default: | 567 default: |
568 break; | 568 break; |
569 } | 569 } |
570 | 570 |
571 return POST_DISPATCH_NONE; | 571 return POST_DISPATCH_NONE; |
572 } | 572 } |
573 | 573 |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 return type; | 914 return type; |
915 } | 915 } |
916 | 916 |
917 // static | 917 // static |
918 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { | 918 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { |
919 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); | 919 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); |
920 return type; | 920 return type; |
921 } | 921 } |
922 | 922 |
923 } // namespace ui | 923 } // namespace ui |
OLD | NEW |