Chromium Code Reviews| 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1513 | 1513 |
| 1514 bool RenderWidgetHostViewAura::HasCompositionText() const { | 1514 bool RenderWidgetHostViewAura::HasCompositionText() const { |
| 1515 return has_composition_text_; | 1515 return has_composition_text_; |
| 1516 } | 1516 } |
| 1517 | 1517 |
| 1518 bool RenderWidgetHostViewAura::GetTextRange(gfx::Range* range) const { | 1518 bool RenderWidgetHostViewAura::GetTextRange(gfx::Range* range) const { |
| 1519 if (!text_input_manager_) | 1519 if (!text_input_manager_) |
| 1520 return false; | 1520 return false; |
| 1521 | 1521 |
| 1522 const TextInputManager::TextSelection* selection = | 1522 const TextInputManager::TextSelection* selection = |
| 1523 text_input_manager_->GetTextSelection(); | 1523 text_input_manager_->GetTextSelection(GetFocusedWidget()->GetView()); |
| 1524 if (!selection) | 1524 if (!selection) |
| 1525 return false; | 1525 return false; |
| 1526 | 1526 |
| 1527 range->set_start(selection->offset); | 1527 range->set_start(selection->offset); |
| 1528 range->set_end(selection->offset + selection->text.length()); | 1528 range->set_end(selection->offset + selection->text.length()); |
| 1529 return true; | 1529 return true; |
| 1530 } | 1530 } |
| 1531 | 1531 |
| 1532 bool RenderWidgetHostViewAura::GetCompositionTextRange( | 1532 bool RenderWidgetHostViewAura::GetCompositionTextRange( |
| 1533 gfx::Range* range) const { | 1533 gfx::Range* range) const { |
| 1534 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 1534 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 1535 NOTIMPLEMENTED(); | 1535 NOTIMPLEMENTED(); |
| 1536 return false; | 1536 return false; |
| 1537 } | 1537 } |
| 1538 | 1538 |
| 1539 bool RenderWidgetHostViewAura::GetSelectionRange(gfx::Range* range) const { | 1539 bool RenderWidgetHostViewAura::GetSelectionRange(gfx::Range* range) const { |
|
EhsanK
2016/08/20 02:41:30
This method was being used in TouchSelectionContro
| |
| 1540 if (!text_input_manager_) | 1540 if (!text_input_manager_) |
| 1541 return false; | 1541 return false; |
| 1542 | 1542 |
| 1543 const TextInputManager::TextSelection* selection = | 1543 const TextInputManager::TextSelection* selection = |
| 1544 text_input_manager_->GetTextSelection(); | 1544 text_input_manager_->GetTextSelection(GetFocusedWidget()->GetView()); |
| 1545 if (!selection) | 1545 if (!selection) |
| 1546 return false; | 1546 return false; |
| 1547 | 1547 |
| 1548 range->set_start(selection->range.start()); | 1548 range->set_start(selection->range.start()); |
| 1549 range->set_end(selection->range.end()); | 1549 range->set_end(selection->range.end()); |
| 1550 return true; | 1550 return true; |
| 1551 } | 1551 } |
| 1552 | 1552 |
| 1553 bool RenderWidgetHostViewAura::SetSelectionRange(const gfx::Range& range) { | 1553 bool RenderWidgetHostViewAura::SetSelectionRange(const gfx::Range& range) { |
| 1554 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 1554 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 1555 NOTIMPLEMENTED(); | 1555 NOTIMPLEMENTED(); |
| 1556 return false; | 1556 return false; |
| 1557 } | 1557 } |
| 1558 | 1558 |
| 1559 bool RenderWidgetHostViewAura::DeleteRange(const gfx::Range& range) { | 1559 bool RenderWidgetHostViewAura::DeleteRange(const gfx::Range& range) { |
| 1560 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | 1560 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 1561 NOTIMPLEMENTED(); | 1561 NOTIMPLEMENTED(); |
| 1562 return false; | 1562 return false; |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 bool RenderWidgetHostViewAura::GetTextFromRange( | 1565 bool RenderWidgetHostViewAura::GetTextFromRange( |
| 1566 const gfx::Range& range, | 1566 const gfx::Range& range, |
| 1567 base::string16* text) const { | 1567 base::string16* text) const { |
| 1568 if (!text_input_manager_) | 1568 if (!text_input_manager_) |
| 1569 return false; | 1569 return false; |
| 1570 | 1570 |
| 1571 const TextInputManager::TextSelection* selection = | 1571 const TextInputManager::TextSelection* selection = |
| 1572 text_input_manager_->GetTextSelection(); | 1572 text_input_manager_->GetTextSelection(GetFocusedWidget()->GetView()); |
| 1573 if (!selection) | 1573 if (!selection) |
| 1574 return false; | 1574 return false; |
| 1575 | 1575 |
| 1576 gfx::Range selection_text_range(selection->offset, | 1576 gfx::Range selection_text_range(selection->offset, |
| 1577 selection->offset + selection->text.length()); | 1577 selection->offset + selection->text.length()); |
| 1578 | 1578 |
| 1579 if (!selection_text_range.Contains(range)) { | 1579 if (!selection_text_range.Contains(range)) { |
| 1580 text->clear(); | 1580 text->clear(); |
| 1581 return false; | 1581 return false; |
| 1582 } | 1582 } |
| (...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3055 ->GetTextSelection(focused_view) | 3055 ->GetTextSelection(focused_view) |
| 3056 ->GetSelectedText(&selected_text)) { | 3056 ->GetSelectedText(&selected_text)) { |
| 3057 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3057 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
| 3058 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3058 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
| 3059 clipboard_writer.WriteText(selected_text); | 3059 clipboard_writer.WriteText(selected_text); |
| 3060 } | 3060 } |
| 3061 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3061 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 3062 } | 3062 } |
| 3063 | 3063 |
| 3064 } // namespace content | 3064 } // namespace content |
| OLD | NEW |