OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 5 #ifndef COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
6 #define COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 6 #define COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 const std::string& error_message, | 45 const std::string& error_message, |
46 const std::string& console_message); | 46 const std::string& console_message); |
47 void ReportLoadAbort(); | 47 void ReportLoadAbort(); |
48 void NexeDidCrash(const char* crash_log); | 48 void NexeDidCrash(const char* crash_log); |
49 | 49 |
50 // TODO(dmichael): Everything below this comment should eventually be made | 50 // TODO(dmichael): Everything below this comment should eventually be made |
51 // private, when ppb_nacl_private_impl.cc is no longer using them directly. | 51 // private, when ppb_nacl_private_impl.cc is no longer using them directly. |
52 // The intent is for this class to only expose functions for reporting a | 52 // The intent is for this class to only expose functions for reporting a |
53 // load state transition (e.g., ReportLoadError, ReportProgress, | 53 // load state transition (e.g., ReportLoadError, ReportProgress, |
54 // ReportLoadAbort, etc.) | 54 // ReportLoadAbort, etc.) |
55 struct ProgressEvent { | |
56 explicit ProgressEvent(PP_NaClEventType event_type_param) | |
57 : event_type(event_type_param), | |
58 length_is_computable(false), | |
59 loaded_bytes(0), | |
60 total_bytes(0) { | |
61 } | |
62 ProgressEvent(PP_Instance instance, PP_NaClEventType event_type, | |
63 const std::string& resource_url, bool length_is_computable, | |
64 uint64_t loaded_bytes, uint64_t total_bytes) | |
65 : instance(instance), | |
66 event_type(event_type), | |
67 resource_url(resource_url), | |
68 length_is_computable(length_is_computable), | |
69 loaded_bytes(loaded_bytes), | |
70 total_bytes(total_bytes) { | |
71 } | |
72 PP_Instance instance; | |
73 PP_NaClEventType event_type; | |
74 std::string resource_url; | |
75 bool length_is_computable; | |
76 uint64_t loaded_bytes; | |
77 uint64_t total_bytes; | |
78 }; | |
79 void DispatchEvent(const ProgressEvent &event); | |
80 void set_trusted_plugin_channel(scoped_ptr<TrustedPluginChannel> channel); | 55 void set_trusted_plugin_channel(scoped_ptr<TrustedPluginChannel> channel); |
81 void set_manifest_service_channel( | 56 void set_manifest_service_channel( |
82 scoped_ptr<ManifestServiceChannel> channel); | 57 scoped_ptr<ManifestServiceChannel> channel); |
83 | 58 |
84 PP_NaClReadyState nacl_ready_state(); | 59 PP_NaClReadyState nacl_ready_state(); |
85 void set_nacl_ready_state(PP_NaClReadyState ready_state); | 60 void set_nacl_ready_state(PP_NaClReadyState ready_state); |
86 | 61 |
87 void SetReadOnlyProperty(PP_Var key, PP_Var value); | 62 void SetReadOnlyProperty(PP_Var key, PP_Var value); |
88 void SetLastError(const std::string& error); | 63 void SetLastError(const std::string& error); |
89 void LogToConsole(const std::string& message); | 64 void LogToConsole(const std::string& message); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 std::string mime_type_; | 152 std::string mime_type_; |
178 | 153 |
179 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; | 154 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; |
180 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; | 155 scoped_ptr<ManifestServiceChannel> manifest_service_channel_; |
181 base::WeakPtrFactory<NexeLoadManager> weak_factory_; | 156 base::WeakPtrFactory<NexeLoadManager> weak_factory_; |
182 }; | 157 }; |
183 | 158 |
184 } // namespace nacl | 159 } // namespace nacl |
185 | 160 |
186 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 161 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
OLD | NEW |