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

Side by Side Diff: ppapi/cpp/dev/selection_dev.cc

Issue 4310002: Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on W... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/cpp/dev/scrollbar_dev.cc ('k') | ppapi/cpp/dev/url_loader_dev.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) 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 "ppapi/cpp/dev/selection_dev.h" 5 #include "ppapi/cpp/dev/selection_dev.h"
6 6
7 #include "ppapi/cpp/common.h"
7 #include "ppapi/cpp/instance.h" 8 #include "ppapi/cpp/instance.h"
8 #include "ppapi/cpp/module.h" 9 #include "ppapi/cpp/module.h"
9 #include "ppapi/cpp/var.h" 10 #include "ppapi/cpp/var.h"
10 11
11 namespace pp { 12 namespace pp {
12 13
13 namespace { 14 namespace {
14 15
15 static const char kPPPSelectionInterface[] = PPP_SELECTION_DEV_INTERFACE; 16 static const char kPPPSelectionInterface[] = PPP_SELECTION_DEV_INTERFACE;
16 17
17 PP_Var GetSelectedText(PP_Instance instance, bool html) { 18 PP_Var GetSelectedText(PP_Instance instance, PP_Bool html) {
18 void* object = 19 void* object =
19 pp::Instance::GetPerInstanceObject(instance, kPPPSelectionInterface); 20 pp::Instance::GetPerInstanceObject(instance, kPPPSelectionInterface);
20 if (!object) 21 if (!object)
21 return Var().Detach(); 22 return Var().Detach();
22 return static_cast<Selection_Dev*>(object)->GetSelectedText(html).Detach(); 23 return static_cast<Selection_Dev*>(object)->
24 GetSelectedText(PPBoolToBool(html)).Detach();
23 } 25 }
24 26
25 const PPP_Selection_Dev ppp_selection = { 27 const PPP_Selection_Dev ppp_selection = {
26 &GetSelectedText 28 &GetSelectedText
27 }; 29 };
28 30
29 } // namespace 31 } // namespace
30 32
31 Selection_Dev::Selection_Dev(Instance* instance) 33 Selection_Dev::Selection_Dev(Instance* instance)
32 : associated_instance_(instance) { 34 : associated_instance_(instance) {
33 pp::Module::Get()->AddPluginInterface(kPPPSelectionInterface, &ppp_selection); 35 pp::Module::Get()->AddPluginInterface(kPPPSelectionInterface, &ppp_selection);
34 associated_instance_->AddPerInstanceObject(kPPPSelectionInterface, this); 36 associated_instance_->AddPerInstanceObject(kPPPSelectionInterface, this);
35 } 37 }
36 38
37 Selection_Dev::~Selection_Dev() { 39 Selection_Dev::~Selection_Dev() {
38 associated_instance_->RemovePerInstanceObject(kPPPSelectionInterface, this); 40 associated_instance_->RemovePerInstanceObject(kPPPSelectionInterface, this);
39 } 41 }
40 42
41 } // namespace pp 43 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/scrollbar_dev.cc ('k') | ppapi/cpp/dev/url_loader_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698