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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2667283007: Refactor Samsung SmartClip implementation. (Closed)
Patch Set: Move FrameMsg 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 0f36645dfa22baa231d1f6c6bb9fbf0edc5d186e..bb6aa94853ee297505d46dfad51aa7f05e3c30d0 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -720,6 +720,8 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
OnJavaScriptExecuteResponse)
IPC_MESSAGE_HANDLER(FrameHostMsg_VisualStateResponse,
OnVisualStateResponse)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_SmartClipDataExtracted,
+ OnSmartClipDataExtracted)
IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunJavaScriptMessage,
OnRunJavaScriptMessage)
IPC_MESSAGE_HANDLER_DELAY_REPLY(FrameHostMsg_RunBeforeUnloadConfirm,
@@ -1550,7 +1552,11 @@ void RenderFrameHostImpl::OnRenderProcessGone(int status, int exit_code) {
for (const auto& iter : ax_tree_snapshot_callbacks_)
iter.second.Run(ui::AXTreeUpdate());
+ for (const auto& iter : smart_clip_callbacks_)
+ iter.second.Run(base::string16(), base::string16());
+
ax_tree_snapshot_callbacks_.clear();
+ smart_clip_callbacks_.clear();
javascript_callbacks_.clear();
visual_state_callbacks_.clear();
form_field_data_callbacks_.clear();
@@ -1651,6 +1657,27 @@ void RenderFrameHostImpl::OnJavaScriptExecuteResponse(
}
}
+void RenderFrameHostImpl::RequestSmartClipExtract(SmartClipCallback callback,
+ gfx::Rect rect) {
+ static int next_id = 1;
boliu 2017/02/06 13:08:09 unsigned int, signed overflow is undefined behavio
aelias_OOO_until_Jul13 2017/02/07 20:48:12 Done.
+ int key = next_id++;
+ Send(new FrameMsg_ExtractSmartClipData(routing_id_, key, rect));
+ smart_clip_callbacks_.insert(std::make_pair(key, callback));
+}
+
+void RenderFrameHostImpl::OnSmartClipDataExtracted(int id,
+ base::string16 text,
+ base::string16 html) {
+ std::map<int, SmartClipCallback>::iterator it =
boliu 2017/02/06 13:08:09 nit: auto
aelias_OOO_until_Jul13 2017/02/07 20:48:13 Done.
+ smart_clip_callbacks_.find(id);
+ if (it != smart_clip_callbacks_.end()) {
+ it->second.Run(text, html);
+ smart_clip_callbacks_.erase(it);
+ } else {
+ NOTREACHED() << "Received smartclip data response for unknown request";
+ }
+}
+
void RenderFrameHostImpl::OnVisualStateResponse(uint64_t id) {
auto it = visual_state_callbacks_.find(id);
if (it != visual_state_callbacks_.end()) {

Powered by Google App Engine
This is Rietveld 408576698