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

Side by Side Diff: webkit/glue/plugins/pepper_plugin_instance.cc

Issue 2948009: Fix pepper v2 find implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/pepper_plugin_instance.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/glue/plugins/pepper_plugin_instance.h" 5 #include "webkit/glue/plugins/pepper_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "gfx/rect.h" 10 #include "gfx/rect.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } // namespace 192 } // namespace
193 193
194 PluginInstance::PluginInstance(PluginDelegate* delegate, 194 PluginInstance::PluginInstance(PluginDelegate* delegate,
195 PluginModule* module, 195 PluginModule* module,
196 const PPP_Instance* instance_interface) 196 const PPP_Instance* instance_interface)
197 : delegate_(delegate), 197 : delegate_(delegate),
198 module_(module), 198 module_(module),
199 instance_interface_(instance_interface), 199 instance_interface_(instance_interface),
200 container_(NULL), 200 container_(NULL),
201 full_frame_(false), 201 full_frame_(false),
202 find_identifier_(-1) { 202 find_identifier_(-1),
203 plugin_find_interface_(NULL) {
203 DCHECK(delegate); 204 DCHECK(delegate);
204 module_->InstanceCreated(this); 205 module_->InstanceCreated(this);
205 delegate_->InstanceCreated(this); 206 delegate_->InstanceCreated(this);
206 } 207 }
207 208
208 PluginInstance::~PluginInstance() { 209 PluginInstance::~PluginInstance() {
209 delegate_->InstanceDeleted(this); 210 delegate_->InstanceDeleted(this);
210 module_->InstanceDeleted(this); 211 module_->InstanceDeleted(this);
211 } 212 }
212 213
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 return UTF8ToUTF16(string->value()); 380 return UTF8ToUTF16(string->value());
380 } 381 }
381 382
382 void PluginInstance::Zoom(float factor, bool text_only) { 383 void PluginInstance::Zoom(float factor, bool text_only) {
383 // TODO: implement me 384 // TODO: implement me
384 } 385 }
385 386
386 bool PluginInstance::StartFind(const string16& search_text, 387 bool PluginInstance::StartFind(const string16& search_text,
387 bool case_sensitive, 388 bool case_sensitive,
388 int identifier) { 389 int identifier) {
390 if (!LoadFindInterface())
391 return false;
392 find_identifier_ = identifier;
393 return plugin_find_interface_->StartFind(
394 GetPPInstance(),
395 UTF16ToUTF8(search_text.c_str()).c_str(),
396 case_sensitive);
397 }
398
399 void PluginInstance::SelectFindResult(bool forward) {
400 if (LoadFindInterface())
401 plugin_find_interface_->SelectFindResult(GetPPInstance(), forward);
402 }
403
404 void PluginInstance::StopFind() {
405 if (!LoadFindInterface())
406 return;
407 find_identifier_ = -1;
408 plugin_find_interface_->StopFind(GetPPInstance());
409 }
410
411 bool PluginInstance::LoadFindInterface() {
389 if (!plugin_find_interface_) { 412 if (!plugin_find_interface_) {
390 plugin_find_interface_ = 413 plugin_find_interface_ =
391 reinterpret_cast<const PPP_Find*>(module_->GetPluginInterface( 414 reinterpret_cast<const PPP_Find*>(module_->GetPluginInterface(
392 PPP_FIND_INTERFACE)); 415 PPP_FIND_INTERFACE));
393 } 416 }
394 417
395 if (plugin_find_interface_) 418 return !!plugin_find_interface_;
396 return false;
397
398 find_identifier_ = identifier;
399 return plugin_find_interface_->StartFind(
400 GetPPInstance(),
401 reinterpret_cast<const char*>(search_text.c_str()),
402 case_sensitive);
403 }
404
405 void PluginInstance::SelectFindResult(bool forward) {
406 DCHECK(plugin_find_interface_);
407
408 plugin_find_interface_->SelectFindResult(GetPPInstance(), forward);
409 }
410
411 void PluginInstance::StopFind() {
412 DCHECK(plugin_find_interface_);
413
414 find_identifier_ = -1;
415 plugin_find_interface_->StopFind(GetPPInstance());
416 } 419 }
417 420
418 } // namespace pepper 421 } // namespace pepper
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698