| 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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 // path. | 1555 // path. |
| 1556 if (params.default_file_name != params.default_file_name.BaseName()) { | 1556 if (params.default_file_name != params.default_file_name.BaseName()) { |
| 1557 bad_message::ReceivedBadMessage(GetProcess(), | 1557 bad_message::ReceivedBadMessage(GetProcess(), |
| 1558 bad_message::RFH_FILE_CHOOSER_PATH); | 1558 bad_message::RFH_FILE_CHOOSER_PATH); |
| 1559 return; | 1559 return; |
| 1560 } | 1560 } |
| 1561 | 1561 |
| 1562 delegate_->RunFileChooser(this, params); | 1562 delegate_->RunFileChooser(this, params); |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 bool RenderFrameHostImpl::HasTextSurroundingSelectionCallback() { |
| 1566 return !text_surrounding_selection_callback_.is_null(); |
| 1567 } |
| 1568 |
| 1569 void RenderFrameHostImpl::SendTextSurroundingSelectionRequest( |
| 1570 const TextSurroundingSelectionCallback& callback, |
| 1571 int max_length) { |
| 1572 // Only one outstanding request is allowed at any given time. |
| 1573 DCHECK(!callback.is_null()); |
| 1574 text_surrounding_selection_callback_ = callback; |
| 1575 Send( |
| 1576 new FrameMsg_TextSurroundingSelectionRequest(GetRoutingID(), max_length)); |
| 1577 } |
| 1578 |
| 1565 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( | 1579 void RenderFrameHostImpl::OnTextSurroundingSelectionResponse( |
| 1566 const base::string16& content, | 1580 const base::string16& content, |
| 1567 uint32_t start_offset, | 1581 uint32_t start_offset, |
| 1568 uint32_t end_offset) { | 1582 uint32_t end_offset) { |
| 1569 render_view_host_->OnTextSurroundingSelectionResponse( | 1583 // Just Run the callback instead of propagating further. |
| 1570 content, start_offset, end_offset); | 1584 |
| 1585 text_surrounding_selection_callback_.Run(content, start_offset, end_offset); |
| 1586 // Reset the callback for enabling early exit from the caller itself using |
| 1587 // hasTextSurroundingSelectionCallback() |
| 1588 text_surrounding_selection_callback_.Reset(); |
| 1571 } | 1589 } |
| 1572 | 1590 |
| 1573 void RenderFrameHostImpl::OnDidAccessInitialDocument() { | 1591 void RenderFrameHostImpl::OnDidAccessInitialDocument() { |
| 1574 delegate_->DidAccessInitialDocument(); | 1592 delegate_->DidAccessInitialDocument(); |
| 1575 } | 1593 } |
| 1576 | 1594 |
| 1577 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { | 1595 void RenderFrameHostImpl::OnDidChangeOpener(int32_t opener_routing_id) { |
| 1578 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, | 1596 frame_tree_node_->render_manager()->DidChangeOpener(opener_routing_id, |
| 1579 GetSiteInstance()); | 1597 GetSiteInstance()); |
| 1580 } | 1598 } |
| (...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2958 // handler after it's destroyed so it can't run after the RFHI is destroyed. | 2976 // handler after it's destroyed so it can't run after the RFHI is destroyed. |
| 2959 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( | 2977 web_bluetooth_service_->SetClientConnectionErrorHandler(base::Bind( |
| 2960 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); | 2978 &RenderFrameHostImpl::DeleteWebBluetoothService, base::Unretained(this))); |
| 2961 } | 2979 } |
| 2962 | 2980 |
| 2963 void RenderFrameHostImpl::DeleteWebBluetoothService() { | 2981 void RenderFrameHostImpl::DeleteWebBluetoothService() { |
| 2964 web_bluetooth_service_.reset(); | 2982 web_bluetooth_service_.reset(); |
| 2965 } | 2983 } |
| 2966 | 2984 |
| 2967 } // namespace content | 2985 } // namespace content |
| OLD | NEW |