OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/instant/instant_client.h" | 5 #include "chrome/browser/instant/instant_client.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 #include "content/public/browser/web_contents.h" | 8 #include "content/public/browser/web_contents.h" |
9 | 9 |
10 InstantClient::Delegate::~Delegate() { | 10 InstantClient::Delegate::~Delegate() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 bool InstantClient::OnMessageReceived(const IPC::Message& message) { | 83 bool InstantClient::OnMessageReceived(const IPC::Message& message) { |
84 bool handled = true; | 84 bool handled = true; |
85 IPC_BEGIN_MESSAGE_MAP(InstantClient, message) | 85 IPC_BEGIN_MESSAGE_MAP(InstantClient, message) |
86 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, SetSuggestions) | 86 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, SetSuggestions) |
87 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined, | 87 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined, |
88 InstantSupportDetermined) | 88 InstantSupportDetermined) |
89 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantPreview, | 89 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantPreview, |
90 ShowInstantPreview) | 90 ShowInstantPreview) |
| 91 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_StartCapturingKeyStrokes, |
| 92 StartCapturingKeyStrokes); |
| 93 IPC_MESSAGE_HANDLER(ChromeViewHostMsg_StopCapturingKeyStrokes, |
| 94 StopCapturingKeyStrokes); |
91 IPC_MESSAGE_UNHANDLED(handled = false) | 95 IPC_MESSAGE_UNHANDLED(handled = false) |
92 IPC_END_MESSAGE_MAP() | 96 IPC_END_MESSAGE_MAP() |
93 return handled; | 97 return handled; |
94 } | 98 } |
95 | 99 |
96 void InstantClient::SetSuggestions( | 100 void InstantClient::SetSuggestions( |
97 int page_id, | 101 int page_id, |
98 const std::vector<InstantSuggestion>& suggestions) { | 102 const std::vector<InstantSuggestion>& suggestions) { |
99 if (web_contents()->IsActiveEntry(page_id)) | 103 if (web_contents()->IsActiveEntry(page_id)) |
100 delegate_->SetSuggestions(suggestions); | 104 delegate_->SetSuggestions(suggestions); |
101 } | 105 } |
102 | 106 |
103 void InstantClient::InstantSupportDetermined(int page_id, bool result) { | 107 void InstantClient::InstantSupportDetermined(int page_id, bool result) { |
104 if (web_contents()->IsActiveEntry(page_id)) | 108 if (web_contents()->IsActiveEntry(page_id)) |
105 delegate_->InstantSupportDetermined(result); | 109 delegate_->InstantSupportDetermined(result); |
106 } | 110 } |
107 | 111 |
108 void InstantClient::ShowInstantPreview(int page_id, | 112 void InstantClient::ShowInstantPreview(int page_id, |
109 InstantShownReason reason, | 113 InstantShownReason reason, |
110 int height, | 114 int height, |
111 InstantSizeUnits units) { | 115 InstantSizeUnits units) { |
112 if (web_contents()->IsActiveEntry(page_id)) | 116 if (web_contents()->IsActiveEntry(page_id)) |
113 delegate_->ShowInstantPreview(reason, height, units); | 117 delegate_->ShowInstantPreview(reason, height, units); |
114 } | 118 } |
| 119 |
| 120 void InstantClient::StartCapturingKeyStrokes(int page_id) { |
| 121 if (web_contents()->IsActiveEntry(page_id)) |
| 122 delegate_->StartCapturingKeyStrokes(); |
| 123 } |
| 124 |
| 125 void InstantClient::StopCapturingKeyStrokes(int page_id) { |
| 126 if (web_contents()->IsActiveEntry(page_id)) |
| 127 delegate_->StopCapturingKeyStrokes(); |
| 128 } |
OLD | NEW |