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_CHROME_FRAME_DELEGATE_H_ | 5 #ifndef CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ |
6 #define CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ | 6 #define CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <atlbase.h> | 9 #include <atlbase.h> |
10 #include <atlwin.h> | 10 #include <atlwin.h> |
11 #include <queue> | 11 #include <queue> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/location.h" |
16 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
17 #include "base/task.h" | 18 #include "base/task.h" |
18 #include "chrome/common/automation_constants.h" | 19 #include "chrome/common/automation_constants.h" |
19 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
20 | 21 |
21 class GURL; | 22 class GURL; |
22 struct AttachExternalTabParams; | 23 struct AttachExternalTabParams; |
23 struct AutomationURLRequest; | 24 struct AutomationURLRequest; |
24 struct ContextMenuModel; | 25 struct ContextMenuModel; |
25 struct MiniContextMenuParams; | 26 struct MiniContextMenuParams; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 }; | 133 }; |
133 | 134 |
134 // T is expected to be something CWindowImpl derived, or at least to have | 135 // T is expected to be something CWindowImpl derived, or at least to have |
135 // PostMessage(UINT, WPARAM) method. Do not forget to CHAIN_MSG_MAP | 136 // PostMessage(UINT, WPARAM) method. Do not forget to CHAIN_MSG_MAP |
136 template <class T> class TaskMarshallerThroughWindowsMessages | 137 template <class T> class TaskMarshallerThroughWindowsMessages |
137 : public TaskMarshaller { | 138 : public TaskMarshaller { |
138 public: | 139 public: |
139 TaskMarshallerThroughWindowsMessages() {} | 140 TaskMarshallerThroughWindowsMessages() {} |
140 virtual void PostTask(const tracked_objects::Location& from_here, | 141 virtual void PostTask(const tracked_objects::Location& from_here, |
141 Task* task) { | 142 Task* task) { |
142 task->SetBirthPlace(from_here); | |
143 T* this_ptr = static_cast<T*>(this); | 143 T* this_ptr = static_cast<T*>(this); |
144 if (this_ptr->IsWindow()) { | 144 if (this_ptr->IsWindow()) { |
145 this_ptr->AddRef(); | 145 this_ptr->AddRef(); |
146 PushTask(task); | 146 PushTask(task); |
147 this_ptr->PostMessage(MSG_EXECUTE_TASK, reinterpret_cast<WPARAM>(task)); | 147 this_ptr->PostMessage(MSG_EXECUTE_TASK, reinterpret_cast<WPARAM>(task)); |
148 } else { | 148 } else { |
149 DVLOG(1) << "Dropping MSG_EXECUTE_TASK message for destroyed window."; | 149 DVLOG(1) << "Dropping MSG_EXECUTE_TASK message for destroyed window."; |
150 delete task; | 150 delete task; |
151 } | 151 } |
152 } | 152 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 } | 203 } |
204 | 204 |
205 return false; | 205 return false; |
206 } | 206 } |
207 | 207 |
208 base::Lock lock_; | 208 base::Lock lock_; |
209 std::queue<Task*> pending_tasks_; | 209 std::queue<Task*> pending_tasks_; |
210 }; | 210 }; |
211 | 211 |
212 #endif // CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ | 212 #endif // CHROME_FRAME_CHROME_FRAME_DELEGATE_H_ |
OLD | NEW |