Impelent signature generation for supervised user passwords.
[chromium-blink-merge.git] / components / nacl / renderer / nexe_load_manager.h
blobe7b61946442e229b6df41be7d5fa28831c4151d9
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_
8 #include <string>
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"
16 namespace content {
17 class PepperPluginInstance;
20 namespace nacl {
22 class TrustedPluginChannel;
24 // NexeLoadManager provides methods for reporting the progress of loading a
25 // nexe.
26 class NexeLoadManager {
27 public:
28 explicit NexeLoadManager(PP_Instance instance);
29 ~NexeLoadManager();
31 void ReportLoadError(PP_NaClError error,
32 const std::string& error_message,
33 bool is_installed);
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),
44 loaded_bytes(0),
45 total_bytes(0) {
47 PP_Instance instance;
48 PP_NaClEventType event_type;
49 std::string resource_url;
50 bool length_is_computable;
51 uint64_t loaded_bytes;
52 uint64_t total_bytes;
54 void DispatchEvent(const ProgressEvent &event);
55 void set_trusted_plugin_channel(scoped_ptr<TrustedPluginChannel> channel);
57 private:
58 DISALLOW_COPY_AND_ASSIGN(NexeLoadManager);
60 PP_Instance pp_instance_;
62 // Non-owning.
63 content::PepperPluginInstance* plugin_instance_;
65 scoped_ptr<TrustedPluginChannel> trusted_plugin_channel_;
66 base::WeakPtrFactory<NexeLoadManager> weak_factory_;
69 } // namespace nacl
71 #endif // COMPONENTS_NACL_RENDERER_NEXE_LOAD_MANAGER_H_