| OLD | NEW |
| 1 // Copyright (c) 2012 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 /// @file file_io.cc | 5 /// @file file_io.cc |
| 6 /// This example demonstrates the use of persistent file I/O | 6 /// This example demonstrates the use of persistent file I/O |
| 7 | 7 |
| 8 #define __STDC_LIMIT_MACROS | 8 #define __STDC_LIMIT_MACROS |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 namespace { | 37 namespace { |
| 38 /// Used for our simple protocol to communicate with Javascript | 38 /// Used for our simple protocol to communicate with Javascript |
| 39 const char* const kLoadPrefix = "ld"; | 39 const char* const kLoadPrefix = "ld"; |
| 40 const char* const kSavePrefix = "sv"; | 40 const char* const kSavePrefix = "sv"; |
| 41 const char* const kDeletePrefix = "de"; | 41 const char* const kDeletePrefix = "de"; |
| 42 } | 42 } |
| 43 | 43 |
| 44 /// The Instance class. One of these exists for each instance of your NaCl | 44 /// The Instance class. One of these exists for each instance of your NaCl |
| 45 /// module on the web page. The browser will ask the Module object to create | 45 /// module on the web page. The browser will ask the Module object to create |
| 46 /// a new Instance for each occurence of the <embed> tag that has these | 46 /// a new Instance for each occurrence of the <embed> tag that has these |
| 47 /// attributes: | 47 /// attributes: |
| 48 /// type="application/x-nacl" | 48 /// type="application/x-nacl" |
| 49 /// src="file_io.nmf" | 49 /// src="file_io.nmf" |
| 50 class FileIoInstance : public pp::Instance { | 50 class FileIoInstance : public pp::Instance { |
| 51 public: | 51 public: |
| 52 /// The constructor creates the plugin-side instance. | 52 /// The constructor creates the plugin-side instance. |
| 53 /// @param[in] instance the handle to the browser-side plugin instance. | 53 /// @param[in] instance the handle to the browser-side plugin instance. |
| 54 explicit FileIoInstance(PP_Instance instance) | 54 explicit FileIoInstance(PP_Instance instance) |
| 55 : pp::Instance(instance), | 55 : pp::Instance(instance), |
| 56 callback_factory_(this), | 56 callback_factory_(this), |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 /// Factory function called by the browser when the module is first loaded. | 302 /// Factory function called by the browser when the module is first loaded. |
| 303 /// The browser keeps a singleton of this module. It calls the | 303 /// The browser keeps a singleton of this module. It calls the |
| 304 /// CreateInstance() method on the object you return to make instances. There | 304 /// CreateInstance() method on the object you return to make instances. There |
| 305 /// is one instance per <embed> tag on the page. This is the main binding | 305 /// is one instance per <embed> tag on the page. This is the main binding |
| 306 /// point for your NaCl module with the browser. | 306 /// point for your NaCl module with the browser. |
| 307 Module* CreateModule() { | 307 Module* CreateModule() { |
| 308 return new FileIoModule(); | 308 return new FileIoModule(); |
| 309 } | 309 } |
| 310 } // namespace pp | 310 } // namespace pp |
| 311 | 311 |
| OLD | NEW |