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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 | 13 |
14 #include "ppapi/c/private/ppb_nacl_private.h" | 14 #include "ppapi/c/private/ppb_nacl_private.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 class PepperPluginInstance; | 17 class PepperPluginInstance; |
18 } | 18 } |
19 | 19 |
20 namespace nacl { | 20 namespace nacl { |
21 | 21 |
| 22 class EmbedderServiceChannel; |
22 class TrustedPluginChannel; | 23 class TrustedPluginChannel; |
23 | 24 |
24 // NexeLoadManager provides methods for reporting the progress of loading a | 25 // NexeLoadManager provides methods for reporting the progress of loading a |
25 // nexe. | 26 // nexe. |
26 class NexeLoadManager { | 27 class NexeLoadManager { |
27 public: | 28 public: |
28 explicit NexeLoadManager(PP_Instance instance); | 29 explicit NexeLoadManager(PP_Instance instance); |
29 ~NexeLoadManager(); | 30 ~NexeLoadManager(); |
30 | 31 |
31 void ReportLoadSuccess(const std::string& url, | 32 void ReportLoadSuccess(const std::string& url, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 64 } |
64 PP_Instance instance; | 65 PP_Instance instance; |
65 PP_NaClEventType event_type; | 66 PP_NaClEventType event_type; |
66 std::string resource_url; | 67 std::string resource_url; |
67 bool length_is_computable; | 68 bool length_is_computable; |
68 uint64_t loaded_bytes; | 69 uint64_t loaded_bytes; |
69 uint64_t total_bytes; | 70 uint64_t total_bytes; |
70 }; | 71 }; |
71 void DispatchEvent(const ProgressEvent &event); | 72 void DispatchEvent(const ProgressEvent &event); |
72 void set_trusted_plugin_channel(scoped_ptr<TrustedPluginChannel> channel); | 73 void set_trusted_plugin_channel(scoped_ptr<TrustedPluginChannel> channel); |
| 74 void set_embedder_service_channel( |
| 75 scoped_ptr<EmbedderServiceChannel> channel); |
73 | 76 |
74 PP_NaClReadyState nacl_ready_state(); | 77 PP_NaClReadyState nacl_ready_state(); |
75 void set_nacl_ready_state(PP_NaClReadyState ready_state); | 78 void set_nacl_ready_state(PP_NaClReadyState ready_state); |
76 | 79 |
77 void SetReadOnlyProperty(PP_Var key, PP_Var value); | 80 void SetReadOnlyProperty(PP_Var key, PP_Var value); |
78 void SetLastError(const std::string& error); | 81 void SetLastError(const std::string& error); |
79 void LogToConsole(const std::string& message); | 82 void LogToConsole(const std::string& message); |
80 | 83 |
81 bool is_installed() const { return is_installed_; } | 84 bool is_installed() const { return is_installed_; } |
82 void set_is_installed(bool installed) { is_installed_ = installed; } | 85 void set_is_installed(bool installed) { is_installed_ = installed; } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // or -1 if set_exit_status() has never been called. | 130 // or -1 if set_exit_status() has never been called. |
128 int32_t exit_status_; | 131 int32_t exit_status_; |
129 | 132 |
130 // Size of the downloaded nexe, in bytes. | 133 // Size of the downloaded nexe, in bytes. |
131 int64_t nexe_size_; | 134 int64_t nexe_size_; |
132 | 135 |
133 // Non-owning. | 136 // Non-owning. |
134 content::PepperPluginInstance* plugin_instance_; | 137 content::PepperPluginInstance* plugin_instance_; |
135 | 138 |
136 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; | 139 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_; |
| 140 scoped_ptr<EmbedderServiceChannel> embedder_service_channel_; |
137 base::WeakPtrFactory<NexeLoadManager> weak_factory_; | 141 base::WeakPtrFactory<NexeLoadManager> weak_factory_; |
138 }; | 142 }; |
139 | 143 |
140 } // namespace nacl | 144 } // namespace nacl |
141 | 145 |
142 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ | 146 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_ |
OLD | NEW |