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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 base::TimeTicks start = base::TimeTicks::Now(); | 506 base::TimeTicks start = base::TimeTicks::Now(); |
507 selection_requestor_.PerformBlockingConvertSelectionWithParameter( | 507 selection_requestor_.PerformBlockingConvertSelectionWithParameter( |
508 atom_cache_.GetAtom(kClipboardManager), | 508 atom_cache_.GetAtom(kClipboardManager), |
509 atom_cache_.GetAtom(kSaveTargets), | 509 atom_cache_.GetAtom(kSaveTargets), |
510 targets); | 510 targets); |
511 UMA_HISTOGRAM_TIMES("Clipboard.X11StoreCopyPasteDuration", | 511 UMA_HISTOGRAM_TIMES("Clipboard.X11StoreCopyPasteDuration", |
512 base::TimeTicks::Now() - start); | 512 base::TimeTicks::Now() - start); |
513 } | 513 } |
514 | 514 |
515 bool Clipboard::AuraX11Details::CanDispatchEvent(const PlatformEvent& event) { | 515 bool Clipboard::AuraX11Details::CanDispatchEvent(const PlatformEvent& event) { |
516 return event->xany.window == x_window_; | 516 if (event->xany.window == x_window_) |
517 return true; | |
Elliot Glaysher
2014/07/17 22:32:46
I don't like that we're moving away from a mapping
| |
518 | |
519 if (event->type == PropertyNotify) { | |
520 return primary_owner_.CanDispatchPropertyEvent(*event) || | |
521 clipboard_owner_.CanDispatchPropertyEvent(*event) || | |
522 selection_requestor_.CanDispatchPropertyEvent(*event); | |
523 } | |
524 return false; | |
517 } | 525 } |
518 | 526 |
519 uint32_t Clipboard::AuraX11Details::DispatchEvent(const PlatformEvent& xev) { | 527 uint32_t Clipboard::AuraX11Details::DispatchEvent(const PlatformEvent& xev) { |
520 switch (xev->type) { | 528 switch (xev->type) { |
521 case SelectionRequest: { | 529 case SelectionRequest: { |
522 if (xev->xselectionrequest.selection == XA_PRIMARY) { | 530 if (xev->xselectionrequest.selection == XA_PRIMARY) { |
523 primary_owner_.OnSelectionRequest(*xev); | 531 primary_owner_.OnSelectionRequest(*xev); |
524 } else { | 532 } else { |
525 // We should not get requests for the CLIPBOARD_MANAGER selection | 533 // We should not get requests for the CLIPBOARD_MANAGER selection |
526 // because we never take ownership of it. | 534 // because we never take ownership of it. |
527 DCHECK_EQ(GetCopyPasteSelection(), xev->xselectionrequest.selection); | 535 DCHECK_EQ(GetCopyPasteSelection(), xev->xselectionrequest.selection); |
528 clipboard_owner_.OnSelectionRequest(*xev); | 536 clipboard_owner_.OnSelectionRequest(*xev); |
529 } | 537 } |
530 break; | 538 break; |
531 } | 539 } |
532 case SelectionNotify: | 540 case SelectionNotify: |
533 selection_requestor_.OnSelectionNotify(*xev); | 541 selection_requestor_.OnSelectionNotify(*xev); |
534 break; | 542 break; |
535 case SelectionClear: { | 543 case SelectionClear: { |
536 if (xev->xselectionclear.selection == XA_PRIMARY) { | 544 if (xev->xselectionclear.selection == XA_PRIMARY) { |
537 primary_owner_.OnSelectionClear(*xev); | 545 primary_owner_.OnSelectionClear(*xev); |
538 } else { | 546 } else { |
539 // We should not get requests for the CLIPBOARD_MANAGER selection | 547 // We should not get requests for the CLIPBOARD_MANAGER selection |
540 // because we never take ownership of it. | 548 // because we never take ownership of it. |
541 DCHECK_EQ(GetCopyPasteSelection(), xev->xselection.selection); | 549 DCHECK_EQ(GetCopyPasteSelection(), xev->xselection.selection); |
542 clipboard_owner_.OnSelectionClear(*xev); | 550 clipboard_owner_.OnSelectionClear(*xev); |
543 } | 551 } |
544 break; | 552 break; |
545 } | 553 } |
554 case PropertyNotify: | |
dcheng
2014/07/25 23:48:30
{}s to be consistent =)
| |
555 if (primary_owner_.CanDispatchPropertyEvent(*xev)) | |
556 primary_owner_.OnPropertyEvent(*xev); | |
557 if (clipboard_owner_.CanDispatchPropertyEvent(*xev)) | |
558 clipboard_owner_.OnPropertyEvent(*xev); | |
559 if (selection_requestor_.CanDispatchPropertyEvent(*xev)) | |
560 selection_requestor_.OnPropertyEvent(*xev); | |
561 break; | |
546 default: | 562 default: |
547 break; | 563 break; |
548 } | 564 } |
549 | 565 |
550 return POST_DISPATCH_NONE; | 566 return POST_DISPATCH_NONE; |
551 } | 567 } |
552 | 568 |
553 /////////////////////////////////////////////////////////////////////////////// | 569 /////////////////////////////////////////////////////////////////////////////// |
554 // Clipboard | 570 // Clipboard |
555 | 571 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
893 return type; | 909 return type; |
894 } | 910 } |
895 | 911 |
896 // static | 912 // static |
897 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { | 913 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { |
898 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); | 914 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); |
899 return type; | 915 return type; |
900 } | 916 } |
901 | 917 |
902 } // namespace ui | 918 } // namespace ui |
OLD | NEW |