summaryrefslogtreecommitdiffstats
path: root/ppapi/examples
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 13:30:44 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-12 13:30:44 +0000
commitdeb449a3a45ef91bfcb92b6da331037c87f32096 (patch)
tree852287d5788e133982df1b1f2eec91e0a7e879e2 /ppapi/examples
parent51844a35bc6850d6a1fff94d247e65b12f5bf78a (diff)
downloadchromium_src-deb449a3a45ef91bfcb92b6da331037c87f32096.zip
chromium_src-deb449a3a45ef91bfcb92b6da331037c87f32096.tar.gz
chromium_src-deb449a3a45ef91bfcb92b6da331037c87f32096.tar.bz2
Fix for checkdeps.
TBR=brettw@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/8244005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/examples')
-rw-r--r--ppapi/examples/ime/ime.cc36
1 files changed, 25 insertions, 11 deletions
diff --git a/ppapi/examples/ime/ime.cc b/ppapi/examples/ime/ime.cc
index b17c9a6..c464aa4 100644
--- a/ppapi/examples/ime/ime.cc
+++ b/ppapi/examples/ime/ime.cc
@@ -6,7 +6,6 @@
#include <utility>
#include <vector>
-#include "base/memory/scoped_ptr.h"
#include "ppapi/c/dev/ppb_console_dev.h"
#include "ppapi/c/dev/ppb_cursor_control_dev.h"
#include "ppapi/cpp/completion_callback.h"
@@ -20,10 +19,19 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/cpp/size.h"
-#include "ui/base/keycodes/keyboard_codes.h"
namespace {
+// Extracted from: ui/base/keycode/keyboard_codes.h
+enum {
+ VKEY_BACK = 0x08,
+ VKEY_DELETE = 0x2E,
+ VKEY_LEFT = 0x25,
+ VKEY_UP = 0x26,
+ VKEY_RIGHT = 0x27,
+ VKEY_DOWN = 0x28,
+};
+
const uint32_t kTextfieldBgColor = 0xffffffff;
const uint32_t kTextfieldTextColor = 0xff000000;
const uint32_t kTextfieldCaretColor = 0xff000000;
@@ -315,6 +323,10 @@ class MyInstance : public pp::Instance {
status_handler_(new TextFieldStatusHandler) {
}
+ ~MyInstance() {
+ delete status_handler_;
+ }
+
virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
@@ -344,23 +356,25 @@ class MyInstance : public pp::Instance {
// compositions. By using the notified information. the browser can,
// say, show virtual keyboards or IMEs only at appropriate timing
// that the plugin does need to accept text input.
- status_handler_.reset(new TextFieldStatusNotifyingHanlder(this));
+ delete status_handler_;
+ status_handler_ = new TextFieldStatusNotifyingHanlder(this);
} else if (argv[i] == std::string("full")) {
// Demonstrating the behavior of plugins fully supporting IME.
//
// It notifies updates of caret positions to the browser,
// and handles all text input events by itself.
- status_handler_.reset(new TextFieldStatusNotifyingHanlder(this));
+ delete status_handler_;
+ status_handler_ = new TextFieldStatusNotifyingHanlder(this);
RequestInputEvents(PP_INPUTEVENT_CLASS_IME);
}
break;
}
}
- textfield_.push_back(MyTextField(this, status_handler_.get(),
+ textfield_.push_back(MyTextField(this, status_handler_,
10, 10, 300, 20));
textfield_.back().SetText("Hello");
- textfield_.push_back(MyTextField(this, status_handler_.get(),
+ textfield_.push_back(MyTextField(this, status_handler_,
30, 100, 300, 20));
textfield_.back().SetText("World");
return true;
@@ -508,16 +522,16 @@ class MyInstance : public pp::Instance {
++it) {
if (it->Focused()) {
switch (ev.GetKeyCode()) {
- case ui::VKEY_LEFT:
+ case VKEY_LEFT:
it->KeyLeft();
break;
- case ui::VKEY_RIGHT:
+ case VKEY_RIGHT:
it->KeyRight();
break;
- case ui::VKEY_DELETE:
+ case VKEY_DELETE:
it->KeyDelete();
break;
- case ui::VKEY_BACK:
+ case VKEY_BACK:
it->KeyBackspace();
break;
}
@@ -585,7 +599,7 @@ class MyInstance : public pp::Instance {
}
// IME Control interface.
- scoped_ptr<TextFieldStatusHandler> status_handler_;
+ TextFieldStatusHandler* status_handler_;
// Remembers the size of this instance.
pp::Size last_size_;