OneRing @ OSCamp 2010

9,572 views

Published on

在 OpenSourceCamp + CommunityOne Beijing 2010 (http://beijing2010.opensourcecamp.org/) 上的演讲

Published in: Technology
2 Comments
30 Likes
Statistics
Notes
No Downloads
Views
Total views
9,572
On SlideShare
0
From Embeds
0
Number of Embeds
2,650
Actions
Shares
0
Downloads
150
Comments
2
Likes
30
Embeds 0
No embeds

No notes for slide

OneRing @ OSCamp 2010

  1. 1. Web OneRing One ring to rule them all, one ring to find them, One ring to bring them all and in the darkness bind them.
  2. 2. OneRing OneRing HTML5+CSS3 Javascript web http://code.google.com/p/onering-desktop/ License: LGPL
  3. 3. AIR / Silverlight / XUL Runner?
  4. 4. Yes ( ) HTML+CSS+JS
  5. 5. No sandbox
  6. 6. MFC / GTK+ / Qt / wxWidgets?
  7. 7. Yes Javascript API
  8. 8. No Control Event HTML+CSS+JS
  9. 9. webOS / Chrome OS?
  10. 10. No
  11. 11. demo
  12. 12. OneRing? web
  13. 13. Web HT CSS JS ML HTTP
  14. 14. :1 HT CSS JS ML HTTP App Launcher
  15. 15. :2 HT CSS JS ML HTTP (IE) App Launcher
  16. 16. IE6 must DIE!
  17. 17. :3 HT CSS JS Web ML Kit HTTP WebKit App Launcher
  18. 18. API
  19. 19. :4 HT CSS JS Web ML Kit HTTP onering.js WebKit App Launcher
  20. 20. annoying
  21. 21. :5 HT CSS JS Web ML Kit call function call back onering.js WebKit callback App Launcher
  22. 22. class init: def GET(self): web.header('Content-Type', 'application/json') return json.dumps({'width': 400, 'height': 300, 'url': '/'}) class index: def GET(self): web.header('Content-Type', 'text/html') return """<html> <head><script type="text/javascript" src="onering://onering/onering.js"></ script></head> <body> <p>Hello, world!</p> <button onclick="javascript:ONERING.exit()">Exit</button> </body></html>""" app = web.application(urls, globals()) if __name__ == '__main__': onering.register_wsgi_app("demo", app.wsgifunc()) onering.loop("demo")
  23. 23. JavaScript onering.js ajax/pubsub App OS Backend
  24. 24. C API DLL
  25. 25. C API typedef void (*onering_app_func_t) ( const char* method, const char* path, const char* body,    /*OUT*/ const char** response, int* response_len); int onering_register_app(const char* appname, onering_app_func_t app_func); int onering_loop(const char* appname);
  26. 26. Python Binding register_wsgi_app(appname, wsgiapp) loop(appname)
  27. 27. QtWebKit
  28. 28. Dispatch Url To App Backend GET onering://myapp/test ↓ (via NetworkAccessManager) app_func = registered_app_funcs.lookup("myapp"); app_func("GET", "/test", NULL, &response, &response_len);
  29. 29. onering.js frame->addToJavaScriptWindowObject("_OneRing", jsapi) ONERING.Window.prototype.hide = function() {     return _OneRing.Window_hide(); }
  30. 30. onering.js Is Served By An OneRing App onering://onering/onering.js
  31. 31. onering.js Is Served By An OneRing App onering://onering/onering.js void onering_app(const char* method, const char* path, const char* body, const char **response, int *response_len) {         if (strcmp(method, "GET") == 0 && strcmp(path, "/onering.js") == 0) {                 *response = onering_js.constData();                 *response_len = onering_js.size();         } else {                 // TODO: 404                 *response = "";                 *response_len = 0;         } }
  32. 32. Native GUI HTML5 Web OS RIA
  33. 33. Native GUI HTML5 Web OS RIA OneRing
  34. 34. Join US C++ / Qt / WebKit / Javascript / Python / Documenter / User / Tester / Code Reviewer http://code.google.com/p/onering-desktop/
  35. 35. Thanks & Q & A http://www.douban.com/people/hongqn/ hongqn@douban.com twitter: @hongqn

×