Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / pepper / ppb_flash_message_loop_impl.h
blob29c4e1b16651da01d41982748993aa5d958bc062
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_PEPPER_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
6 #define CONTENT_RENDERER_PEPPER_PPB_FLASH_MESSAGE_LOOP_IMPL_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "ppapi/shared_impl/resource.h"
12 #include "ppapi/thunk/ppb_flash_message_loop_api.h"
14 namespace content {
16 class PPB_Flash_MessageLoop_Impl
17 : public ppapi::Resource,
18 public ppapi::thunk::PPB_Flash_MessageLoop_API {
19 public:
20 static PP_Resource Create(PP_Instance instance);
22 // Resource.
23 ppapi::thunk::PPB_Flash_MessageLoop_API* AsPPB_Flash_MessageLoop_API()
24 override;
26 // PPB_Flash_MessageLoop_API implementation.
27 int32_t Run() override;
28 void Quit() override;
29 void RunFromHostProxy(const RunFromHostProxyCallback& callback) override;
31 private:
32 class State;
34 explicit PPB_Flash_MessageLoop_Impl(PP_Instance instance);
35 ~PPB_Flash_MessageLoop_Impl() override;
37 // If |callback| is valid, it will be called when the message loop is signaled
38 // to quit, and the result passed into it will be the same value as what this
39 // method returns.
40 // Please note that |callback| happens before this method returns.
41 int32_t InternalRun(const RunFromHostProxyCallback& callback);
42 void InternalQuit(int32_t result);
44 scoped_refptr<State> state_;
46 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_MessageLoop_Impl);
49 } // namespace content
51 #endif // CONTENT_RENDERER_PEPPER_PPB_FLASH_MESSAGE_LOOP_IMPL_H_