| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_ | 5 #ifndef MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_ |
| 6 #define MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_ | 6 #define MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_ |
| 7 | 7 |
| 8 #include "gin/handle.h" | 8 #include "gin/handle.h" |
| 9 #include "gin/runner.h" | 9 #include "gin/runner.h" |
| 10 #include "gin/wrappable.h" | 10 #include "gin/wrappable.h" |
| 11 #include "mojo/public/bindings/lib/bindings_support.h" | 11 #include "mojo/public/bindings/lib/bindings_support.h" |
| 12 | 12 |
| 13 namespace mojo { | 13 namespace mojo { |
| 14 namespace js { | 14 namespace js { |
| 15 | 15 |
| 16 class WaitingCallback : public gin::Wrappable, | 16 class WaitingCallback : public gin::Wrappable<WaitingCallback>, |
| 17 public BindingsSupport::AsyncWaitCallback { | 17 public BindingsSupport::AsyncWaitCallback { |
| 18 public: | 18 public: |
| 19 static gin::Handle<WaitingCallback> Create( | 19 static gin::Handle<WaitingCallback> Create( |
| 20 v8::Isolate* isolate, v8::Handle<v8::Function> callback); | 20 v8::Isolate* isolate, v8::Handle<v8::Function> callback); |
| 21 | 21 |
| 22 static gin::WrapperInfo kWrapperInfo; | |
| 23 virtual gin::WrapperInfo* GetWrapperInfo() OVERRIDE; | |
| 24 static void EnsureRegistered(v8::Isolate* isolate); | 22 static void EnsureRegistered(v8::Isolate* isolate); |
| 25 | 23 |
| 26 BindingsSupport::AsyncWaitID wait_id() const { | 24 BindingsSupport::AsyncWaitID wait_id() const { |
| 27 return wait_id_; | 25 return wait_id_; |
| 28 } | 26 } |
| 29 | 27 |
| 30 void set_wait_id(BindingsSupport::AsyncWaitID wait_id) { | 28 void set_wait_id(BindingsSupport::AsyncWaitID wait_id) { |
| 31 wait_id_ = wait_id; | 29 wait_id_ = wait_id; |
| 32 } | 30 } |
| 33 | 31 |
| 34 private: | 32 private: |
| 35 WaitingCallback(v8::Isolate* isolate, v8::Handle<v8::Function> callback); | 33 WaitingCallback(v8::Isolate* isolate, v8::Handle<v8::Function> callback); |
| 36 virtual ~WaitingCallback(); | 34 virtual ~WaitingCallback(); |
| 37 | 35 |
| 38 virtual void OnHandleReady(MojoResult result) OVERRIDE; | 36 virtual void OnHandleReady(MojoResult result) OVERRIDE; |
| 39 | 37 |
| 40 base::WeakPtr<gin::Runner> runner_; | 38 base::WeakPtr<gin::Runner> runner_; |
| 41 BindingsSupport::AsyncWaitID wait_id_; | 39 BindingsSupport::AsyncWaitID wait_id_; |
| 42 | 40 |
| 43 DISALLOW_COPY_AND_ASSIGN(WaitingCallback); | 41 DISALLOW_COPY_AND_ASSIGN(WaitingCallback); |
| 44 }; | 42 }; |
| 45 | 43 |
| 46 } // namespace js | 44 } // namespace js |
| 47 } // namespace mojo | 45 } // namespace mojo |
| 48 | 46 |
| 49 #endif // MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_ | 47 #endif // MOJO_APPS_JS_BINDINGS_WAITING_CALLBACK_H_ |
| OLD | NEW |