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

Side by Side Diff: webkit/plugins/npapi/test/plugin_execute_stream_javascript.cc

Issue 10833017: Fix gcc 4.7 building problems - cont 2. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Modified per Adam's comments Created 8 years, 4 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
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/plugins/npapi/test/plugin_execute_stream_javascript.h" 5 #include "webkit/plugins/npapi/test/plugin_execute_stream_javascript.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "webkit/plugins/npapi/test/plugin_client.h" 8 #include "webkit/plugins/npapi/test/plugin_client.h"
9 9
10 namespace NPAPIClient { 10 namespace NPAPIClient {
(...skipping 20 matching lines...) Expand all
31 SetError("Write got null stream"); 31 SetError("Write got null stream");
32 return -1; 32 return -1;
33 } 33 }
34 if (len < 0 || len > kMaxLength) { 34 if (len < 0 || len > kMaxLength) {
35 SetError("Write got bogus stream chunk size"); 35 SetError("Write got bogus stream chunk size");
36 return -1; 36 return -1;
37 } 37 }
38 38
39 std::string javascript("javascript:"); 39 std::string javascript("javascript:");
40 javascript.append(static_cast<char*>(buffer), len); 40 javascript.append(static_cast<char*>(buffer), len);
41 size_t js_length = javascript.length();
42 if (js_length != static_cast<uint32_t>(js_length)) {
43 SetError("Javascript too long.");
44 return -1;
45 }
41 46
42 NPString script_string = { javascript.c_str(), javascript.length() }; 47 NPString script_string = { javascript.c_str(),
48 static_cast<uint32_t>(js_length) };
43 NPObject *window_obj = NULL; 49 NPObject *window_obj = NULL;
44 NPAPIClient::PluginClient::HostFunctions()->getvalue( 50 NPAPIClient::PluginClient::HostFunctions()->getvalue(
45 id(), NPNVWindowNPObject, &window_obj); 51 id(), NPNVWindowNPObject, &window_obj);
46 52
47 NPVariant unused_result; 53 NPVariant unused_result;
48 NPAPIClient::PluginClient::HostFunctions()->evaluate( 54 NPAPIClient::PluginClient::HostFunctions()->evaluate(
49 id(), window_obj, &script_string, &unused_result); 55 id(), window_obj, &script_string, &unused_result);
50 56
51 return len; 57 return len;
52 } 58 }
53 59
54 NPError ExecuteStreamJavaScript::DestroyStream(NPStream *stream, 60 NPError ExecuteStreamJavaScript::DestroyStream(NPStream *stream,
55 NPError reason) { 61 NPError reason) {
56 return NPERR_NO_ERROR; 62 return NPERR_NO_ERROR;
57 } 63 }
58 64
59 } // namespace NPAPIClient 65 } // namespace NPAPIClient
OLDNEW
« no previous file with comments | « sandbox/linux/suid/client/setuid_sandbox_client.cc ('k') | webkit/plugins/npapi/test/plugin_windowless_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698