| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 // path. | 1557 // path. |
| 1558 if (params.default_file_name != params.default_file_name.BaseName()) { | 1558 if (params.default_file_name != params.default_file_name.BaseName()) { |
| 1559 bad_message::ReceivedBadMessage(GetProcess(), | 1559 bad_message::ReceivedBadMessage(GetProcess(), |
| 1560 bad_message::RFH_FILE_CHOOSER_PATH); | 1560 bad_message::RFH_FILE_CHOOSER_PATH); |
| 1561 return; | 1561 return; |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 delegate_->RunFileChooser(this, params); | 1564 delegate_->RunFileChooser(this, params); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 void RenderFrameHostImpl::RequestTextSurroundingSelection( |
| 1568 const TextSurroundingSelectionCallback& callback, |
| 1569 int max_length) { |
| 1570 DCHECK(!callback.is_null()); |
| 1571 // Only one outstanding request is allowed at any given time. |
| 1572 // If already one request is in progress, then immediately release callback |
| 1573 // with empty result. |
| 1574 if (!text_surrounding_selection_callback_.is_null()) { |
| 1575 callback.Run(base::string16(), 0, 0); |
| 1576 return; |
| 1577 } |
| 1578 text_surrounding_selection_callback_ = callback; |
| 1579 Send( |
| 1580 new FrameMsg_TextSurroundingSelectionRequest(GetRoutingID(), max_length)); |
| 1581 } |
| 1582 |
| 1567 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( | 1583 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( |
| 1568 const base::string16& content, | 1584 const base::string16& content, |
| 1569 uint32_t start_offset, | 1585 uint32_t start_offset, |
| 1570 uint32_t end_offset) { | 1586 uint32_t end_offset) { |
| 1571 render_view_host_->OnTextSurroundingSelectionResponse( | 1587 // Just Run the callback instead of propagating further. |
| 1572 content, start_offset, end_offset); | 1588 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); |
| 1589 // Reset the callback for enabling early exit from future request. |
| 1590 text_surrounding_selection_callback_.Reset(); |
| 1573 } | 1591 } |
| 1574 | 1592 |
| 1575 void RenderFrameHostImpl::OnDidAccessInitialDocument() { | 1593 void RenderFrameHostImpl::OnDidAccessInitialDocument() { |
| 1576 delegate_->DidAccessInitialDocument(); | 1594 delegate_->DidAccessInitialDocument(); |
| 1577 } | 1595 } |
| 1578 | 1596 |
| 1579 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { | 1597 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { |
| 1580 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 1598 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
| 1581 GetSiteInstance()); | 1599 GetSiteInstance()); |
| 1582 } | 1600 } |
| (...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2988 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
| 2971 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2989 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 2972 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2990 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 2973 } | 2991 } |
| 2974 | 2992 |
| 2975 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2993 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 2976 web_bluetooth_service_.reset(); | 2994 web_bluetooth_service_.reset(); |
| 2977 } | 2995 } |
| 2978 | 2996 |
| 2979 } // namespace content | 2997 } // namespace content |
| OLD | NEW |