Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2009, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2012, Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "config.h" | 22 #include "config.h" |
| 23 #include "core/page/Chrome.h" | 23 #include "core/page/Chrome.h" |
| 24 | 24 |
| 25 #include "public/platform/WebScreenInfo.h" | 25 #include "public/platform/WebScreenInfo.h" |
| 26 #include "HTMLNames.h" | 26 #include "HTMLNames.h" |
| 27 #include "core/dom/Document.h" | 27 #include "core/dom/Document.h" |
| 28 #include "core/html/HTMLInputElement.h" | 28 #include "core/html/HTMLInputElement.h" |
| 29 #include "core/inspector/InspectorInstrumentation.h" | 29 #include "core/inspector/InspectorInstrumentation.h" |
| 30 #include "core/inspector/ScriptCallFrame.h" | |
| 31 #include "core/inspector/ScriptCallStack.h" | |
| 30 #include "core/page/ChromeClient.h" | 32 #include "core/page/ChromeClient.h" |
| 31 #include "core/page/Frame.h" | 33 #include "core/page/Frame.h" |
| 32 #include "core/page/FrameTree.h" | 34 #include "core/page/FrameTree.h" |
| 33 #include "core/page/Page.h" | 35 #include "core/page/Page.h" |
| 34 #include "core/page/PageGroupLoadDeferrer.h" | 36 #include "core/page/PageGroupLoadDeferrer.h" |
| 35 #include "core/page/PopupOpeningObserver.h" | 37 #include "core/page/PopupOpeningObserver.h" |
| 36 #include "core/platform/ColorChooser.h" | 38 #include "core/platform/ColorChooser.h" |
| 37 #include "core/platform/DateTimeChooser.h" | 39 #include "core/platform/DateTimeChooser.h" |
| 38 #include "core/platform/FileChooser.h" | 40 #include "core/platform/FileChooser.h" |
| 41 #include "core/platform/JSONValues.h" | |
| 39 #include "core/platform/graphics/FloatRect.h" | 42 #include "core/platform/graphics/FloatRect.h" |
| 40 #include "core/platform/network/DNS.h" | 43 #include "core/platform/network/DNS.h" |
| 41 #include "core/rendering/HitTestResult.h" | 44 #include "core/rendering/HitTestResult.h" |
| 42 #include "wtf/PassRefPtr.h" | 45 #include "wtf/PassRefPtr.h" |
| 43 #include "wtf/Vector.h" | 46 #include "wtf/Vector.h" |
| 44 | 47 |
| 45 namespace WebCore { | 48 namespace WebCore { |
| 46 | 49 |
| 47 using namespace HTMLNames; | 50 using namespace HTMLNames; |
| 48 using namespace std; | 51 using namespace std; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 m_popupOpeningObservers.remove(index); | 436 m_popupOpeningObservers.remove(index); |
| 434 } | 437 } |
| 435 | 438 |
| 436 void Chrome::notifyPopupOpeningObservers() const | 439 void Chrome::notifyPopupOpeningObservers() const |
| 437 { | 440 { |
| 438 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers); | 441 const Vector<PopupOpeningObserver*> observers(m_popupOpeningObservers); |
| 439 for (size_t i = 0; i < observers.size(); ++i) | 442 for (size_t i = 0; i < observers.size(); ++i) |
| 440 observers[i]->willOpenPopup(); | 443 observers[i]->willOpenPopup(); |
| 441 } | 444 } |
| 442 | 445 |
| 446 static const char kLineNumberKey[] = "lineNumber"; | |
|
Devlin
2013/07/17 22:14:13
I apologize in advance if the style is bad - I tri
| |
| 447 static const char kColumnNumberKey[] = "columnNumber"; | |
| 448 static const char kURLKey[] = "url"; | |
| 449 static const char kFunctionNameKey[] = "functionName"; | |
| 450 static const char kStackTraceKey[] = "stackTrace"; | |
| 451 static const char kExecutionContextURLKey[] = "executionContextURL"; | |
| 452 | |
| 453 static String generateConsoleMessageDetailsImpl(PassRefPtr<JSONArray> stackTrace | |
| 454 , const String& executionContextURL) | |
| 455 { | |
| 456 RefPtr<JSONObject> details = JSONObject::create(); | |
| 457 details->setArray(kStackTraceKey, stackTrace); | |
| 458 details->setString(kExecutionContextURLKey, executionContextURL); | |
| 459 return details->toJSONString(); | |
| 460 } | |
| 461 | |
| 462 String Chrome::generateConsoleMessageDetails(size_t lineNumber, size_t columnNum ber, const String& sourceURL, const String& functionName, const String& executio nContextURL) | |
| 463 { | |
| 464 RefPtr<JSONObject> stackFrame = JSONObject::create(); | |
| 465 stackFrame->setNumber(kLineNumberKey, lineNumber); | |
| 466 stackFrame->setNumber(kColumnNumberKey, columnNumber); | |
| 467 stackFrame->setString(kURLKey, sourceURL); | |
| 468 stackFrame->setString(kFunctionNameKey, functionName); | |
| 469 | |
| 470 RefPtr<JSONArray> simpleStackTrace = JSONArray::create(); | |
| 471 simpleStackTrace->pushObject(stackFrame); | |
| 472 | |
| 473 return generateConsoleMessageDetailsImpl(simpleStackTrace, executionContextU RL); | |
| 474 } | |
| 475 | |
| 476 String Chrome::generateConsoleMessageDetails(PassRefPtr<ScriptCallStack> callSta ck, const String& executionContextURL) | |
| 477 { | |
| 478 RefPtr<JSONArray> stackTrace = JSONArray::create(); | |
| 479 for (size_t i = 0; i < callStack->size(); ++i) { | |
| 480 const ScriptCallFrame& frame = callStack->at(i); | |
| 481 RefPtr<JSONObject> stackFrame = JSONObject::create(); | |
| 482 | |
| 483 stackFrame->setNumber(kLineNumberKey, frame.lineNumber()); | |
| 484 stackFrame->setNumber(kColumnNumberKey, frame.columnNumber()); | |
| 485 stackFrame->setString(kURLKey, frame.sourceURL()); | |
| 486 stackFrame->setString(kFunctionNameKey, frame.functionName()); | |
| 487 | |
| 488 stackTrace->pushObject(stackFrame); | |
| 489 } | |
| 490 | |
| 491 return generateConsoleMessageDetailsImpl(stackTrace, executionContextURL); | |
| 492 } | |
| 493 | |
| 443 } // namespace WebCore | 494 } // namespace WebCore |
| OLD | NEW |