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, const v8::Handle<v8::Value>& oldValue) OVERRIDE |
58 title = document->title(); | 58 { |
59 } | 59 m_domActivityLogger->logSetter(WebString(apiName), newValue, oldValue, g
etURL(), getTitle()); |
60 m_domActivityLogger->log(WebString(apiName), argc, argv, WebString(extra
Info), WebURL(url), WebString(title)); | 60 } |
| 61 |
| 62 virtual void logMethod(const String& apiName, int argc, const v8::Handle<v8:
:Value>* argv) OVERRIDE |
| 63 { |
| 64 m_domActivityLogger->logMethod(WebString(apiName), argc, argv, getURL(),
getTitle()); |
61 } | 65 } |
62 | 66 |
63 private: | 67 private: |
| 68 WebURL getURL() |
| 69 { |
| 70 if (Document* document = currentDOMWindow(v8::Isolate::GetCurrent())->do
cument()) |
| 71 return WebURL(document->url()); |
| 72 return WebURL(); |
| 73 } |
| 74 |
| 75 WebString getTitle() |
| 76 { |
| 77 if (Document* document = currentDOMWindow(v8::Isolate::GetCurrent())->do
cument()) |
| 78 return WebString(document->title()); |
| 79 return WebString(); |
| 80 } |
| 81 |
64 OwnPtr<WebDOMActivityLogger> m_domActivityLogger; | 82 OwnPtr<WebDOMActivityLogger> m_domActivityLogger; |
65 }; | 83 }; |
66 | 84 |
67 bool hasDOMActivityLogger(int worldId) | 85 bool hasDOMActivityLogger(int worldId) |
68 { | 86 { |
69 return V8DOMActivityLogger::activityLogger(worldId); | 87 return V8DOMActivityLogger::activityLogger(worldId); |
70 } | 88 } |
71 | 89 |
72 void setDOMActivityLogger(int worldId, WebDOMActivityLogger* logger) | 90 void setDOMActivityLogger(int worldId, WebDOMActivityLogger* logger) |
73 { | 91 { |
74 ASSERT(logger); | 92 ASSERT(logger); |
75 V8DOMActivityLogger::setActivityLogger(worldId, adoptPtr(new DOMActivityLogg
erContainer(adoptPtr(logger)))); | 93 V8DOMActivityLogger::setActivityLogger(worldId, adoptPtr(new DOMActivityLogg
erContainer(adoptPtr(logger)))); |
76 } | 94 } |
77 | 95 |
78 } // namespace blink | 96 } // namespace blink |
OLD | NEW |