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

Side by Side Diff: ppapi/cpp/url_request_info.cc

Issue 9700088: Check for specific PPB interface versions in C++ wrappers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix MouseInputEvent version check. Created 8 years, 9 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/cpp/url_loader.cc ('k') | ppapi/cpp/url_response_info.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/url_request_info.h" 5 #include "ppapi/cpp/url_request_info.h"
6 6
7 #include "ppapi/cpp/file_ref.h" 7 #include "ppapi/cpp/file_ref.h"
8 #include "ppapi/cpp/instance_handle.h" 8 #include "ppapi/cpp/instance_handle.h"
9 #include "ppapi/cpp/module.h" 9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/module_impl.h" 10 #include "ppapi/cpp/module_impl.h"
11 11
12 namespace pp { 12 namespace pp {
13 13
14 namespace { 14 namespace {
15 15
16 template <> const char* interface_name<PPB_URLRequestInfo>() { 16 template <> const char* interface_name<PPB_URLRequestInfo_1_0>() {
17 return PPB_URLREQUESTINFO_INTERFACE; 17 return PPB_URLREQUESTINFO_INTERFACE_1_0;
18 } 18 }
19 19
20 } // namespace 20 } // namespace
21 21
22 URLRequestInfo::URLRequestInfo(const InstanceHandle& instance) { 22 URLRequestInfo::URLRequestInfo(const InstanceHandle& instance) {
23 if (!has_interface<PPB_URLRequestInfo>()) 23 if (!has_interface<PPB_URLRequestInfo_1_0>())
24 return; 24 return;
25 PassRefFromConstructor( 25 PassRefFromConstructor(
26 get_interface<PPB_URLRequestInfo>()->Create(instance.pp_instance())); 26 get_interface<PPB_URLRequestInfo_1_0>()->Create(instance.pp_instance()));
27 } 27 }
28 28
29 URLRequestInfo::URLRequestInfo(const URLRequestInfo& other) 29 URLRequestInfo::URLRequestInfo(const URLRequestInfo& other)
30 : Resource(other) { 30 : Resource(other) {
31 } 31 }
32 32
33 bool URLRequestInfo::SetProperty(PP_URLRequestProperty property, 33 bool URLRequestInfo::SetProperty(PP_URLRequestProperty property,
34 const Var& value) { 34 const Var& value) {
35 if (!has_interface<PPB_URLRequestInfo>()) 35 if (!has_interface<PPB_URLRequestInfo_1_0>())
36 return false; 36 return false;
37 return PP_ToBool(get_interface<PPB_URLRequestInfo>()->SetProperty( 37 return PP_ToBool(get_interface<PPB_URLRequestInfo_1_0>()->SetProperty(
38 pp_resource(), property, value.pp_var())); 38 pp_resource(), property, value.pp_var()));
39 } 39 }
40 40
41 bool URLRequestInfo::AppendDataToBody(const void* data, uint32_t len) { 41 bool URLRequestInfo::AppendDataToBody(const void* data, uint32_t len) {
42 if (!has_interface<PPB_URLRequestInfo>()) 42 if (!has_interface<PPB_URLRequestInfo_1_0>())
43 return false; 43 return false;
44 return PP_ToBool(get_interface<PPB_URLRequestInfo>()->AppendDataToBody( 44 return PP_ToBool(get_interface<PPB_URLRequestInfo_1_0>()->AppendDataToBody(
45 pp_resource(), data, len)); 45 pp_resource(), data, len));
46 } 46 }
47 47
48 bool URLRequestInfo::AppendFileToBody(const FileRef& file_ref, 48 bool URLRequestInfo::AppendFileToBody(const FileRef& file_ref,
49 PP_Time expected_last_modified_time) { 49 PP_Time expected_last_modified_time) {
50 if (!has_interface<PPB_URLRequestInfo>()) 50 if (!has_interface<PPB_URLRequestInfo_1_0>())
51 return false; 51 return false;
52 return PP_ToBool( 52 return PP_ToBool(
53 get_interface<PPB_URLRequestInfo>()->AppendFileToBody( 53 get_interface<PPB_URLRequestInfo_1_0>()->AppendFileToBody(
54 pp_resource(), 54 pp_resource(),
55 file_ref.pp_resource(), 55 file_ref.pp_resource(),
56 0, 56 0,
57 -1, 57 -1,
58 expected_last_modified_time)); 58 expected_last_modified_time));
59 } 59 }
60 60
61 bool URLRequestInfo::AppendFileRangeToBody( 61 bool URLRequestInfo::AppendFileRangeToBody(
62 const FileRef& file_ref, 62 const FileRef& file_ref,
63 int64_t start_offset, 63 int64_t start_offset,
64 int64_t length, 64 int64_t length,
65 PP_Time expected_last_modified_time) { 65 PP_Time expected_last_modified_time) {
66 if (!has_interface<PPB_URLRequestInfo>()) 66 if (!has_interface<PPB_URLRequestInfo_1_0>())
67 return false; 67 return false;
68 return PP_ToBool(get_interface<PPB_URLRequestInfo>()->AppendFileToBody( 68 return PP_ToBool(get_interface<PPB_URLRequestInfo_1_0>()->AppendFileToBody(
69 pp_resource(), 69 pp_resource(),
70 file_ref.pp_resource(), 70 file_ref.pp_resource(),
71 start_offset, 71 start_offset,
72 length, 72 length,
73 expected_last_modified_time)); 73 expected_last_modified_time));
74 } 74 }
75 75
76 } // namespace pp 76 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/url_loader.cc ('k') | ppapi/cpp/url_response_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698