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

Side by Side Diff: extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc

Issue 597753003: Implement find in page support for top level BrowserPlugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h" 5 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "content/public/browser/browser_thread.h" 8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/render_process_host.h" 9 #include "content/public/browser/render_process_host.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 std::string()); 124 std::string());
125 } 125 }
126 126
127 void MimeHandlerViewGuest::DidInitialize() { 127 void MimeHandlerViewGuest::DidInitialize() {
128 extension_function_dispatcher_.reset( 128 extension_function_dispatcher_.reset(
129 new ExtensionFunctionDispatcher(browser_context(), this)); 129 new ExtensionFunctionDispatcher(browser_context(), this));
130 if (delegate_) 130 if (delegate_)
131 delegate_->AttachHelpers(); 131 delegate_->AttachHelpers();
132 } 132 }
133 133
134 bool MimeHandlerViewGuest::Find(int request_id,
135 const base::string16& search_text,
136 const blink::WebFindOptions& options,
137 bool is_full_page_plugin) {
138 if (is_full_page_plugin) {
139 web_contents()->Find(request_id, search_text, options);
140 return true;
141 }
142 return false;
143 }
144
134 void MimeHandlerViewGuest::ContentsZoomChange(bool zoom_in) { 145 void MimeHandlerViewGuest::ContentsZoomChange(bool zoom_in) {
135 if (delegate_) 146 if (delegate_)
136 delegate_->ChangeZoom(zoom_in); 147 delegate_->ChangeZoom(zoom_in);
137 } 148 }
138 149
139 void MimeHandlerViewGuest::HandleKeyboardEvent( 150 void MimeHandlerViewGuest::HandleKeyboardEvent(
140 WebContents* source, 151 WebContents* source,
141 const content::NativeWebKeyboardEvent& event) { 152 const content::NativeWebKeyboardEvent& event) {
142 if (!attached()) 153 if (!attached())
143 return; 154 return;
144 155
145 // Send the keyboard events back to the embedder to reprocess them. 156 // Send the keyboard events back to the embedder to reprocess them.
146 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard 157 // TODO(fsamuel): This introduces the possibility of out-of-order keyboard
147 // events because the guest may be arbitrarily delayed when responding to 158 // events because the guest may be arbitrarily delayed when responding to
148 // keyboard events. In that time, the embedder may have received and processed 159 // keyboard events. In that time, the embedder may have received and processed
149 // additional key events. This needs to be fixed as soon as possible. 160 // additional key events. This needs to be fixed as soon as possible.
150 // See http://crbug.com/229882. 161 // See http://crbug.com/229882.
151 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(), 162 embedder_web_contents()->GetDelegate()->HandleKeyboardEvent(web_contents(),
152 event); 163 event);
153 } 164 }
154 165
166 void MimeHandlerViewGuest::FindReply(content::WebContents* web_contents,
167 int request_id,
168 int number_of_matches,
169 const gfx::Rect& selection_rect,
170 int active_match_ordinal,
171 bool final_update) {
172 if (!attached())
173 return;
174
175 embedder_web_contents()->GetDelegate()->FindReply(embedder_web_contents(),
Fady Samuel 2014/10/06 20:03:54 It might be the case that the embedder doesn't hav
raymes 2014/10/06 20:39:41 Done.
176 request_id,
177 number_of_matches,
178 selection_rect,
179 active_match_ordinal,
180 final_update);
181 }
182
155 bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) { 183 bool MimeHandlerViewGuest::OnMessageReceived(const IPC::Message& message) {
156 bool handled = true; 184 bool handled = true;
157 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message) 185 IPC_BEGIN_MESSAGE_MAP(MimeHandlerViewGuest, message)
158 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest) 186 IPC_MESSAGE_HANDLER(ExtensionHostMsg_Request, OnRequest)
159 IPC_MESSAGE_UNHANDLED(handled = false) 187 IPC_MESSAGE_UNHANDLED(handled = false)
160 IPC_END_MESSAGE_MAP() 188 IPC_END_MESSAGE_MAP()
161 return handled; 189 return handled;
162 } 190 }
163 191
164 void MimeHandlerViewGuest::OnRequest( 192 void MimeHandlerViewGuest::OnRequest(
165 const ExtensionHostMsg_Request_Params& params) { 193 const ExtensionHostMsg_Request_Params& params) {
166 if (extension_function_dispatcher_) { 194 if (extension_function_dispatcher_) {
167 extension_function_dispatcher_->Dispatch( 195 extension_function_dispatcher_->Dispatch(
168 params, web_contents()->GetRenderViewHost()); 196 params, web_contents()->GetRenderViewHost());
169 } 197 }
170 } 198 }
171 199
172 } // namespace extensions 200 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698