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

Side by Side Diff: ppapi/examples/file_chooser/file_chooser.cc

Issue 7466002: Reland http://codereview.chromium.org/7452002/, update chromoting (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 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 | « ppapi/examples/2d/paint_manager_example.cc ('k') | ppapi/proxy/dispatcher.cc » ('j') | 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) 2011 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 "ppapi/c/dev/ppb_file_chooser_dev.h" 5 #include "ppapi/c/dev/ppb_file_chooser_dev.h"
6 #include "ppapi/c/pp_input_event.h" 6 #include "ppapi/c/pp_input_event.h"
7 #include "ppapi/cpp/completion_callback.h" 7 #include "ppapi/cpp/completion_callback.h"
8 #include "ppapi/cpp/dev/file_chooser_dev.h" 8 #include "ppapi/cpp/dev/file_chooser_dev.h"
9 #include "ppapi/cpp/file_ref.h" 9 #include "ppapi/cpp/file_ref.h"
10 #include "ppapi/cpp/input_event.h"
10 #include "ppapi/cpp/module.h" 11 #include "ppapi/cpp/module.h"
11 #include "ppapi/cpp/private/instance_private.h" 12 #include "ppapi/cpp/private/instance_private.h"
12 #include "ppapi/cpp/private/var_private.h" 13 #include "ppapi/cpp/private/var_private.h"
13 14
14 class MyInstance : public pp::InstancePrivate { 15 class MyInstance : public pp::InstancePrivate {
15 public: 16 public:
16 MyInstance(PP_Instance instance) 17 MyInstance(PP_Instance instance)
17 : pp::InstancePrivate(instance) { 18 : pp::InstancePrivate(instance) {
18 callback_factory_.Initialize(this); 19 callback_factory_.Initialize(this);
20 RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE);
19 } 21 }
20 22
21 virtual bool HandleInputEvent(const PP_InputEvent& event) { 23 virtual bool HandleInputEvent(const pp::InputEvent& event) {
22 switch (event.type) { 24 switch (event.GetType()) {
23 case PP_INPUTEVENT_TYPE_MOUSEDOWN: { 25 case PP_INPUTEVENT_TYPE_MOUSEDOWN: {
24 const PP_InputEvent_Mouse& mouse_event = event.u.mouse; 26 pp::MouseInputEvent mouse_event(event);
25 if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_LEFT) 27 if (mouse_event.GetMouseButton() == PP_INPUTEVENT_MOUSEBUTTON_LEFT)
26 ShowFileChooser(false); 28 ShowFileChooser(false);
27 else if (mouse_event.button == PP_INPUTEVENT_MOUSEBUTTON_RIGHT) 29 else if (mouse_event.GetMouseButton()
30 == PP_INPUTEVENT_MOUSEBUTTON_RIGHT)
28 ShowFileChooser(true); 31 ShowFileChooser(true);
29 else 32 else
30 return false; 33 return false;
31 34
32 return true; 35 return true;
33 } 36 }
34 default: 37 default:
35 return false; 38 return false;
36 } 39 }
37 } 40 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 }; 101 };
99 102
100 namespace pp { 103 namespace pp {
101 104
102 // Factory function for your specialization of the Module object. 105 // Factory function for your specialization of the Module object.
103 Module* CreateModule() { 106 Module* CreateModule() {
104 return new MyModule(); 107 return new MyModule();
105 } 108 }
106 109
107 } // namespace pp 110 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/examples/2d/paint_manager_example.cc ('k') | ppapi/proxy/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698