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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2667283007: Refactor Samsung SmartClip implementation. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 OnCancelInitialHistoryLoad) 713 OnCancelInitialHistoryLoad)
714 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted, 714 IPC_MESSAGE_HANDLER(FrameHostMsg_DocumentOnLoadCompleted,
715 OnDocumentOnLoadCompleted) 715 OnDocumentOnLoadCompleted)
716 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK) 716 IPC_MESSAGE_HANDLER(FrameHostMsg_BeforeUnload_ACK, OnBeforeUnloadACK)
717 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK) 717 IPC_MESSAGE_HANDLER(FrameHostMsg_SwapOut_ACK, OnSwapOutACK)
718 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu) 718 IPC_MESSAGE_HANDLER(FrameHostMsg_ContextMenu, OnContextMenu)
719 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse, 719 IPC_MESSAGE_HANDLER(FrameHostMsg_JavaScriptExecuteResponse,
720 OnJavaScriptExecuteResponse) 720 OnJavaScriptExecuteResponse)
721 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse, 721 IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse,
722 OnVisualStateResponse) 722 OnVisualStateResponse)
723 IPC_MESSAGE_HANDLER(FrameHostMsg_SmartClipDataExtracted,
724 OnSmartClipDataExtracted)
723 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage, 725 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage,
724 OnRunJavaScriptMessage) 726 OnRunJavaScriptMessage)
725 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm, 727 IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm,
726 OnRunBeforeUnloadConfirm) 728 OnRunBeforeUnloadConfirm)
727 IPC_MESSAGE_HANDLER(FrameHostMsg_RunFileChooser, OnRunFileChooser) 729 IPC_MESSAGE_HANDLER(FrameHostMsg_RunFileChooser, OnRunFileChooser)
728 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument, 730 IPC_MESSAGE_HANDLER(FrameHostMsg_DidAccessInitialDocument,
729 OnDidAccessInitialDocument) 731 OnDidAccessInitialDocument)
730 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener) 732 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeOpener, OnDidChangeOpener)
731 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName) 733 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeName, OnDidChangeName)
732 IPC_MESSAGE_HANDLER(FrameHostMsg_DidSetFeaturePolicyHeader, 734 IPC_MESSAGE_HANDLER(FrameHostMsg_DidSetFeaturePolicyHeader,
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 // Reset state for the current RenderFrameHost once the FrameTreeNode has been 1545 // Reset state for the current RenderFrameHost once the FrameTreeNode has been
1544 // reset. 1546 // reset.
1545 SetRenderFrameCreated(false); 1547 SetRenderFrameCreated(false);
1546 InvalidateMojoConnection(); 1548 InvalidateMojoConnection();
1547 1549
1548 // Execute any pending AX tree snapshot callbacks with an empty response, 1550 // Execute any pending AX tree snapshot callbacks with an empty response,
1549 // since we're never going to get a response from this renderer. 1551 // since we're never going to get a response from this renderer.
1550 for (const auto& iter : ax_tree_snapshot_callbacks_) 1552 for (const auto& iter : ax_tree_snapshot_callbacks_)
1551 iter.second.Run(ui::AXTreeUpdate()); 1553 iter.second.Run(ui::AXTreeUpdate());
1552 1554
1555 for (const auto& iter : smart_clip_callbacks_)
1556 iter.second.Run(base::string16(), base::string16());
1557
1553 ax_tree_snapshot_callbacks_.clear(); 1558 ax_tree_snapshot_callbacks_.clear();
1559 smart_clip_callbacks_.clear();
1554 javascript_callbacks_.clear(); 1560 javascript_callbacks_.clear();
1555 visual_state_callbacks_.clear(); 1561 visual_state_callbacks_.clear();
1556 form_field_data_callbacks_.clear(); 1562 form_field_data_callbacks_.clear();
1557 1563
1558 // Ensure that future remote interface requests are associated with the new 1564 // Ensure that future remote interface requests are associated with the new
1559 // process's channel. 1565 // process's channel.
1560 remote_associated_interfaces_.reset(); 1566 remote_associated_interfaces_.reset();
1561 1567
1562 if (!is_active()) { 1568 if (!is_active()) {
1563 // If the process has died, we don't need to wait for the swap out ack from 1569 // If the process has died, we don't need to wait for the swap out ack from
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 std::map<int, JavaScriptResultCallback>::iterator it = 1650 std::map<int, JavaScriptResultCallback>::iterator it =
1645 javascript_callbacks_.find(id); 1651 javascript_callbacks_.find(id);
1646 if (it != javascript_callbacks_.end()) { 1652 if (it != javascript_callbacks_.end()) {
1647 it->second.Run(result_value); 1653 it->second.Run(result_value);
1648 javascript_callbacks_.erase(it); 1654 javascript_callbacks_.erase(it);
1649 } else { 1655 } else {
1650 NOTREACHED() << "Received script response for unknown request"; 1656 NOTREACHED() << "Received script response for unknown request";
1651 } 1657 }
1652 } 1658 }
1653 1659
1660 void RenderFrameHostImpl::RequestSmartClipExtract(SmartClipCallback callback,
1661 gfx::Rect rect) {
1662 static int next_id = 1;
1663 int key = next_id++;
1664 Send(new FrameMsg_ExtractSmartClipData(routing_id_, key, rect));
1665 smart_clip_callbacks_.insert(std::make_pair(key, callback));
1666 }
1667
1668 void RenderFrameHostImpl::OnSmartClipDataExtracted(int id,
1669 base::string16 text,
1670 base::string16 html) {
1671 std::map<int, SmartClipCallback>::iterator it =
1672 smart_clip_callbacks_.find(id);
1673 if (it != smart_clip_callbacks_.end()) {
1674 it->second.Run(text, html);
1675 smart_clip_callbacks_.erase(it);
1676 } else {
1677 NOTREACHED() << "Received smartclip data response for unknown request";
1678 }
1679 }
1680
1654 void RenderFrameHostImpl::OnVisualStateResponse(uint64_t id) { 1681 void RenderFrameHostImpl::OnVisualStateResponse(uint64_t id) {
1655 auto it = visual_state_callbacks_.find(id); 1682 auto it = visual_state_callbacks_.find(id);
1656 if (it != visual_state_callbacks_.end()) { 1683 if (it != visual_state_callbacks_.end()) {
1657 it->second.Run(true); 1684 it->second.Run(true);
1658 visual_state_callbacks_.erase(it); 1685 visual_state_callbacks_.erase(it);
1659 } else { 1686 } else {
1660 NOTREACHED() << "Received script response for unknown request"; 1687 NOTREACHED() << "Received script response for unknown request";
1661 } 1688 }
1662 } 1689 }
1663 1690
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
3455 // There is no pending NavigationEntry in these cases, so pass 0 as the 3482 // There is no pending NavigationEntry in these cases, so pass 0 as the
3456 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3483 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3457 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3484 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3458 return NavigationHandleImpl::Create( 3485 return NavigationHandleImpl::Create(
3459 params.url, frame_tree_node_, is_renderer_initiated, 3486 params.url, frame_tree_node_, is_renderer_initiated,
3460 params.was_within_same_page, base::TimeTicks::Now(), 3487 params.was_within_same_page, base::TimeTicks::Now(),
3461 entry_id_for_data_nav, false); // started_from_context_menu 3488 entry_id_for_data_nav, false); // started_from_context_menu
3462 } 3489 }
3463 3490
3464 } // namespace content 3491 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698