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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_
6 #define COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h"
14 #include "ppapi/c/private/ppb_nacl_private.h"
17 class PepperPluginInstance
;
22 class TrustedPluginChannel
;
24 // NexeLoadManager provides methods for reporting the progress of loading a
26 class NexeLoadManager
{
28 explicit NexeLoadManager(PP_Instance instance
);
31 void ReportLoadError(PP_NaClError error
,
32 const std::string
& error_message
,
35 // TODO(dmichael): Everything below this comment should eventually be made
36 // private, when ppb_nacl_private_impl.cc is no longer using them directly.
37 // The intent is for this class to only expose functions for reporting a
38 // load state transition (e.g., ReportLoadError, ReportProgress,
39 // ReportLoadAbort, etc.)
40 struct ProgressEvent
{
41 explicit ProgressEvent(PP_NaClEventType event_type_param
)
42 : event_type(event_type_param
),
43 length_is_computable(false),
48 PP_NaClEventType event_type
;
49 std::string resource_url
;
50 bool length_is_computable
;
51 uint64_t loaded_bytes
;
54 void DispatchEvent(const ProgressEvent
&event
);
55 void set_trusted_plugin_channel(scoped_ptr
<TrustedPluginChannel
> channel
);
58 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager
);
60 PP_Instance pp_instance_
;
63 content::PepperPluginInstance
* plugin_instance_
;
65 scoped_ptr
<TrustedPluginChannel
> trusted_plugin_channel_
;
66 base::WeakPtrFactory
<NexeLoadManager
> weak_factory_
;
71 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_