| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 class DOMActivityLoggerContainer : public V8DOMActivityLogger { | 45 class DOMActivityLoggerContainer : public V8DOMActivityLogger { |
| 46 public: | 46 public: |
| 47 explicit DOMActivityLoggerContainer(PassOwnPtr<WebDOMActivityLogger> logger) | 47 explicit DOMActivityLoggerContainer(PassOwnPtr<WebDOMActivityLogger> logger) |
| 48 : m_domActivityLogger(logger) | 48 : m_domActivityLogger(logger) |
| 49 { | 49 { |
| 50 } | 50 } |
| 51 | 51 |
| 52 virtual void log(const String& apiName, int argc, const v8::Handle<v8::Value
>* argv, const String& extraInfo) OVERRIDE | 52 virtual void logGetter(const String& apiName) OVERRIDE |
| 53 { | 53 { |
| 54 KURL url; | 54 m_domActivityLogger->logGetter(WebString(apiName), getURL(), getTitle())
; |
| 55 String title; | 55 } |
| 56 if (Document* document = currentDOMWindow(v8::Isolate::GetCurrent())->do
cument()) { | 56 |
| 57 url = document->url(); | 57 virtual void logSetter(const String& apiName, const v8::Handle<v8::Value>& n
ewValue) OVERRIDE |
| 58 title = document->title(); | 58 { |
| 59 } | 59 m_domActivityLogger->logSetter(WebString(apiName), newValue, getURL(), g
etTitle()); |
| 60 m_domActivityLogger->log(WebString(apiName), argc, argv, WebString(extra
Info), WebURL(url), WebString(title)); | 60 } |
| 61 |
| 62 virtual void logSetter(const String& apiName, const v8::Handle<v8::Value>& n
ewValue, const v8::Handle<v8::Value>& oldValue) OVERRIDE |
| 63 { |
| 64 m_domActivityLogger->logSetter(WebString(apiName), newValue, oldValue, g
etURL(), getTitle()); |
| 65 } |
| 66 |
| 67 virtual void logMethod(const String& apiName, int argc, const v8::Handle<v8:
:Value>* argv) OVERRIDE |
| 68 { |
| 69 m_domActivityLogger->logMethod(WebString(apiName), argc, argv, getURL(),
getTitle()); |
| 61 } | 70 } |
| 62 | 71 |
| 63 private: | 72 private: |
| 73 WebURL getURL() |
| 74 { |
| 75 if (Document* document = currentDOMWindow(v8::Isolate::GetCurrent())->do
cument()) |
| 76 return WebURL(document->url()); |
| 77 return WebURL(); |
| 78 } |
| 79 |
| 80 WebString getTitle() |
| 81 { |
| 82 if (Document* document = currentDOMWindow(v8::Isolate::GetCurrent())->do
cument()) |
| 83 return WebString(document->title()); |
| 84 return WebString(); |
| 85 } |
| 86 |
| 64 OwnPtr<WebDOMActivityLogger> m_domActivityLogger; | 87 OwnPtr<WebDOMActivityLogger> m_domActivityLogger; |
| 65 }; | 88 }; |
| 66 | 89 |
| 67 bool hasDOMActivityLogger(int worldId) | 90 bool hasDOMActivityLogger(int worldId) |
| 68 { | 91 { |
| 69 return V8DOMActivityLogger::activityLogger(worldId); | 92 return V8DOMActivityLogger::activityLogger(worldId); |
| 70 } | 93 } |
| 71 | 94 |
| 72 void setDOMActivityLogger(int worldId, WebDOMActivityLogger* logger) | 95 void setDOMActivityLogger(int worldId, WebDOMActivityLogger* logger) |
| 73 { | 96 { |
| 74 ASSERT(logger); | 97 ASSERT(logger); |
| 75 V8DOMActivityLogger::setActivityLogger(worldId, adoptPtr(new DOMActivityLogg
erContainer(adoptPtr(logger)))); | 98 V8DOMActivityLogger::setActivityLogger(worldId, adoptPtr(new DOMActivityLogg
erContainer(adoptPtr(logger)))); |
| 76 } | 99 } |
| 77 | 100 |
| 78 } // namespace blink | 101 } // namespace blink |
| OLD | NEW |