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

Side by Side Diff: ui/base/clipboard/clipboard_aurax11.cc

Issue 397223002: Enable copying long text to Chrome and pasting long text from Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/ui_base.gyp » ('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 (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
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;
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.
(...skipping 10 matching lines...) Expand all
537 if (xev->xselectionclear.selection == XA_PRIMARY) { 545 if (xev->xselectionclear.selection == XA_PRIMARY) {
538 primary_owner_.OnSelectionClear(*xev); 546 primary_owner_.OnSelectionClear(*xev);
539 } else { 547 } else {
540 // We should not get requests for the CLIPBOARD_MANAGER selection 548 // We should not get requests for the CLIPBOARD_MANAGER selection
541 // because we never take ownership of it. 549 // because we never take ownership of it.
542 DCHECK_EQ(GetCopyPasteSelection(), xev->xselection.selection); 550 DCHECK_EQ(GetCopyPasteSelection(), xev->xselection.selection);
543 clipboard_owner_.OnSelectionClear(*xev); 551 clipboard_owner_.OnSelectionClear(*xev);
544 } 552 }
545 break; 553 break;
546 } 554 }
555 case PropertyNotify: {
556 if (primary_owner_.CanDispatchPropertyEvent(*xev))
557 primary_owner_.OnPropertyEvent(*xev);
558 if (clipboard_owner_.CanDispatchPropertyEvent(*xev))
559 clipboard_owner_.OnPropertyEvent(*xev);
560 if (selection_requestor_.CanDispatchPropertyEvent(*xev))
561 selection_requestor_.OnPropertyEvent(*xev);
562 break;
563 }
547 default: 564 default:
548 break; 565 break;
549 } 566 }
550 567
551 return POST_DISPATCH_NONE; 568 return POST_DISPATCH_NONE;
552 } 569 }
553 570
554 /////////////////////////////////////////////////////////////////////////////// 571 ///////////////////////////////////////////////////////////////////////////////
555 // Clipboard 572 // Clipboard
556 573
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 return type; 911 return type;
895 } 912 }
896 913
897 // static 914 // static
898 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { 915 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() {
899 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); 916 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData));
900 return type; 917 return type;
901 } 918 }
902 919
903 } // namespace ui 920 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/BUILD.gn ('k') | ui/base/ui_base.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698