| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_FRAME_CUSTOM_SYNC_CALL_CONTEXT_H_ | 5 #ifndef CHROME_FRAME_CUSTOM_SYNC_CALL_CONTEXT_H_ |
| 6 #define CHROME_FRAME_CUSTOM_SYNC_CALL_CONTEXT_H_ | 6 #define CHROME_FRAME_CUSTOM_SYNC_CALL_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 private: | 58 private: |
| 59 scoped_refptr<ChromeFrameAutomationClient> client_; | 59 scoped_refptr<ChromeFrameAutomationClient> client_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 // Class that maintains contextual information for the unload operation, i.e. | 62 // Class that maintains contextual information for the unload operation, i.e. |
| 63 // when the user attempts to navigate away from a page rendered in ChromeFrame. | 63 // when the user attempts to navigate away from a page rendered in ChromeFrame. |
| 64 class UnloadContext | 64 class UnloadContext |
| 65 : public SyncMessageReplyDispatcher::SyncMessageCallContext { | 65 : public SyncMessageReplyDispatcher::SyncMessageCallContext { |
| 66 public: | 66 public: |
| 67 typedef Tuple1<bool> output_type; | 67 typedef Tuple1<bool> output_type; |
| 68 explicit UnloadContext(base::WaitableEvent* unload_done, bool* should_unload) | 68 UnloadContext(base::WaitableEvent* unload_done, bool* should_unload) |
| 69 : should_unload_(should_unload), | 69 : should_unload_(should_unload), |
| 70 unload_done_(unload_done) { | 70 unload_done_(unload_done) { |
| 71 } | 71 } |
| 72 | 72 |
| 73 void Completed(bool should_unload) { | 73 void Completed(bool should_unload) { |
| 74 *should_unload_ = should_unload; | 74 *should_unload_ = should_unload; |
| 75 unload_done_->Signal(); | 75 unload_done_->Signal(); |
| 76 should_unload_ = NULL; | 76 should_unload_ = NULL; |
| 77 unload_done_ = NULL; | 77 unload_done_ = NULL; |
| 78 // This object will be destroyed after this. Cannot access any members | 78 // This object will be destroyed after this. Cannot access any members |
| 79 // on returning from this function. | 79 // on returning from this function. |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 base::WaitableEvent* unload_done_; | 83 base::WaitableEvent* unload_done_; |
| 84 bool* should_unload_; | 84 bool* should_unload_; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 #endif // CHROME_FRAME_CUSTOM_SYNC_CALL_CONTEXT_H_ | 87 #endif // CHROME_FRAME_CUSTOM_SYNC_CALL_CONTEXT_H_ |
| OLD | NEW |