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

Side by Side Diff: ppapi/native_client/src/trusted/plugin/plugin.cc

Issue 8488002: Make PPAPI use 'new ProgressEvent' instead of initProgressEvent. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 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 | « no previous file | no next file » | 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) 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 #ifdef _MSC_VER 5 #ifdef _MSC_VER
6 // Do not warn about use of std::copy with raw pointers. 6 // Do not warn about use of std::copy with raw pointers.
7 #pragma warning(disable : 4996) 7 #pragma warning(disable : 4996)
8 #endif 8 #endif
9 9
10 #include "native_client/src/trusted/plugin/plugin.h" 10 #include "native_client/src/trusted/plugin/plugin.h"
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 "loaded=%"NACL_PRIu64", total=%"NACL_PRIu64")\n", 1968 "loaded=%"NACL_PRIu64", total=%"NACL_PRIu64")\n",
1969 event->event_type(), 1969 event->event_type(),
1970 event->url(), 1970 event->url(),
1971 static_cast<int>(event->length_computable()), 1971 static_cast<int>(event->length_computable()),
1972 event->loaded_bytes(), 1972 event->loaded_bytes(),
1973 event->total_bytes())); 1973 event->total_bytes()));
1974 1974
1975 static const char* kEventClosureJS = 1975 static const char* kEventClosureJS =
1976 "(function(target, type, url," 1976 "(function(target, type, url,"
1977 " lengthComputable, loadedBytes, totalBytes) {" 1977 " lengthComputable, loadedBytes, totalBytes) {"
1978 " var progress_event = document.createEvent('ProgressEvent');" 1978 " var progress_event = new ProgressEvent(type, {"
1979 " progress_event.initProgressEvent(type, false, true," 1979 " bubbles: false,"
polina 2011/11/07 19:42:06 this is so much easier to read!
1980 " lengthComputable," 1980 " cancelable: true,"
1981 " loadedBytes," 1981 " lengthComputable: lengthComputable,"
1982 " totalBytes);" 1982 " loaded: loadedBytes,"
1983 " total: totalBytes"
1984 " });"
1983 " progress_event.url = url;" 1985 " progress_event.url = url;"
1984 " target.dispatchEvent(progress_event);" 1986 " target.dispatchEvent(progress_event);"
1985 "})"; 1987 "})";
1986 1988
1987 // Create a function object by evaluating the JavaScript text. 1989 // Create a function object by evaluating the JavaScript text.
1988 // TODO(sehr, polina): We should probably cache the created function object to 1990 // TODO(sehr, polina): We should probably cache the created function object to
1989 // avoid JavaScript reparsing. 1991 // avoid JavaScript reparsing.
1990 pp::VarPrivate exception; 1992 pp::VarPrivate exception;
1991 pp::VarPrivate function_object = ExecuteScript(kEventClosureJS, &exception); 1993 pp::VarPrivate function_object = ExecuteScript(kEventClosureJS, &exception);
1992 if (!exception.is_undefined() || !function_object.is_object()) { 1994 if (!exception.is_undefined() || !function_object.is_object()) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin, 2043 std::string scheme = canonicalized.AsString().substr(comps.scheme.begin,
2042 comps.scheme.len); 2044 comps.scheme.len);
2043 if (scheme == kChromeExtensionUriScheme) 2045 if (scheme == kChromeExtensionUriScheme)
2044 return SCHEME_CHROME_EXTENSION; 2046 return SCHEME_CHROME_EXTENSION;
2045 if (scheme == kDataUriScheme) 2047 if (scheme == kDataUriScheme)
2046 return SCHEME_DATA; 2048 return SCHEME_DATA;
2047 return SCHEME_OTHER; 2049 return SCHEME_OTHER;
2048 } 2050 }
2049 2051
2050 } // namespace plugin 2052 } // namespace plugin
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698