Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: xfa/fwl/core/fwl_noteimp.cpp

Issue 2510823003: Move the message definitions to their own files. (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/core/fwl_noteimp.h" 7 #include "xfa/fwl/core/fwl_noteimp.h"
8 8
9 #include "core/fxcrt/fx_ext.h" 9 #include "core/fxcrt/fx_ext.h"
10 #include "third_party/base/ptr_util.h" 10 #include "third_party/base/ptr_util.h"
11 #include "third_party/base/stl_util.h" 11 #include "third_party/base/stl_util.h"
12 #include "xfa/fwl/core/cfwl_message.h" 12 #include "xfa/fwl/core/cfwl_msgkey.h"
13 #include "xfa/fwl/core/cfwl_msgkillfocus.h"
14 #include "xfa/fwl/core/cfwl_msgmouse.h"
15 #include "xfa/fwl/core/cfwl_msgmousewheel.h"
16 #include "xfa/fwl/core/cfwl_msgsetfocus.h"
13 #include "xfa/fwl/core/cfwl_widgetmgr.h" 17 #include "xfa/fwl/core/cfwl_widgetmgr.h"
14 #include "xfa/fwl/core/ifwl_app.h" 18 #include "xfa/fwl/core/ifwl_app.h"
15 #include "xfa/fwl/core/ifwl_tooltip.h" 19 #include "xfa/fwl/core/ifwl_tooltip.h"
16 20
17 CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {} 21 CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {}
18 22
19 CFWL_NoteDriver::CFWL_NoteDriver() 23 CFWL_NoteDriver::CFWL_NoteDriver()
20 : m_pHover(nullptr), 24 : m_pHover(nullptr),
21 m_pFocus(nullptr), 25 m_pFocus(nullptr),
22 m_pGrab(nullptr), 26 m_pGrab(nullptr),
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (!pForm) 179 if (!pForm)
176 return; 180 return;
177 181
178 int32_t nIndex = m_forms.Find(pForm); 182 int32_t nIndex = m_forms.Find(pForm);
179 if (nIndex < 0) 183 if (nIndex < 0)
180 return; 184 return;
181 185
182 m_forms.RemoveAt(nIndex); 186 m_forms.RemoveAt(nIndex);
183 } 187 }
184 188
185 void CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { 189 void CFWL_NoteDriver::QueueMessage(std::unique_ptr<CFWL_Message> pMessage) {
186 pMessage->Retain(); 190 m_noteQueue.push_back(std::move(pMessage));
187 m_noteQueue.Add(pMessage);
188 } 191 }
189 192
190 void CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { 193 void CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) {
191 if (m_noteQueue.GetSize() < 1) 194 if (m_noteQueue.empty())
192 return; 195 return;
193 196
194 CFWL_Message* pMessage = m_noteQueue[0]; 197 std::unique_ptr<CFWL_Message> pMessage(m_noteQueue[0].release());
Tom Sepez 2016/11/16 21:34:02 nit: just ... = std::move(m_noteQueue.front());
dsinclair 2016/11/16 21:41:07 Done.
195 m_noteQueue.RemoveAt(0); 198 m_noteQueue.pop_front();
196 if (!IsValidMessage(pMessage)) { 199
197 pMessage->Release(); 200 if (!IsValidMessage(pMessage.get()))
198 return; 201 return;
199 } 202
200 ProcessMessage(pMessage); 203 ProcessMessage(pMessage.get());
201 pMessage->Release();
202 } 204 }
203 205
204 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() const { 206 CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() const {
205 int32_t size = m_noteLoopQueue.GetSize(); 207 int32_t size = m_noteLoopQueue.GetSize();
206 if (size <= 0) 208 if (size <= 0)
207 return nullptr; 209 return nullptr;
208 return m_noteLoopQueue[size - 1]; 210 return m_noteLoopQueue[size - 1];
209 } 211 }
210 212
211 void CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { 213 void CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 case CFWL_EventType::KillFocus: 542 case CFWL_EventType::KillFocus:
541 return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK); 543 return !!(dwFilter & FWL_EVENT_FOCUSCHANGED_MASK);
542 case CFWL_EventType::Close: 544 case CFWL_EventType::Close:
543 return !!(dwFilter & FWL_EVENT_CLOSE_MASK); 545 return !!(dwFilter & FWL_EVENT_CLOSE_MASK);
544 case CFWL_EventType::SizeChanged: 546 case CFWL_EventType::SizeChanged:
545 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK); 547 return !!(dwFilter & FWL_EVENT_SIZECHANGED_MASK);
546 default: 548 default:
547 return !!(dwFilter & FWL_EVENT_CONTROL_MASK); 549 return !!(dwFilter & FWL_EVENT_CONTROL_MASK);
548 } 550 }
549 } 551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698