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/views/controls/textfield/native_textfield_win.h" | 5 #include "ui/views/controls/textfield/native_textfield_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 GetCaretPos(&p); | 617 GetCaretPos(&p); |
618 MapWindowPoints(HWND_DESKTOP, &p, 1); | 618 MapWindowPoints(HWND_DESKTOP, &p, 1); |
619 } | 619 } |
620 BuildContextMenu(); | 620 BuildContextMenu(); |
621 | 621 |
622 MenuModelAdapter adapter(context_menu_contents_.get()); | 622 MenuModelAdapter adapter(context_menu_contents_.get()); |
623 context_menu_runner_.reset(new MenuRunner(adapter.CreateMenu())); | 623 context_menu_runner_.reset(new MenuRunner(adapter.CreateMenu())); |
624 | 624 |
625 ignore_result(context_menu_runner_->RunMenuAt(textfield_->GetWidget(), NULL, | 625 ignore_result(context_menu_runner_->RunMenuAt(textfield_->GetWidget(), NULL, |
626 gfx::Rect(gfx::Point(p), gfx::Size()), MenuItemView::TOPLEFT, | 626 gfx::Rect(gfx::Point(p), gfx::Size()), MenuItemView::TOPLEFT, |
627 MenuRunner::HAS_MNEMONICS)); | 627 ui::MENU_SOURCE_NONE, MenuRunner::HAS_MNEMONICS)); |
628 } | 628 } |
629 | 629 |
630 void NativeTextfieldWin::OnCopy() { | 630 void NativeTextfieldWin::OnCopy() { |
631 if (textfield_->IsObscured()) | 631 if (textfield_->IsObscured()) |
632 return; | 632 return; |
633 | 633 |
634 const string16 text(GetSelectedText()); | 634 const string16 text(GetSelectedText()); |
635 if (!text.empty()) { | 635 if (!text.empty()) { |
636 ui::ScopedClipboardWriter( | 636 ui::ScopedClipboardWriter( |
637 ui::Clipboard::GetForCurrentThread(), | 637 ui::Clipboard::GetForCurrentThread(), |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 return true; | 1311 return true; |
1312 MSG msg(*GetCurrentMessage()); | 1312 MSG msg(*GetCurrentMessage()); |
1313 // ATL doesn't set the |time| field. | 1313 // ATL doesn't set the |time| field. |
1314 if (!msg.time) | 1314 if (!msg.time) |
1315 msg.time = GetMessageTime(); | 1315 msg.time = GetMessageTime(); |
1316 ui::MouseEvent mouse_event(msg); | 1316 ui::MouseEvent mouse_event(msg); |
1317 return !controller->HandleMouseEvent(textfield_, mouse_event); | 1317 return !controller->HandleMouseEvent(textfield_, mouse_event); |
1318 } | 1318 } |
1319 | 1319 |
1320 } // namespace views | 1320 } // namespace views |
OLD | NEW |