OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/renderer/extensions/dom_activity_logger.h" | 5 #include "chrome/renderer/extensions/dom_activity_logger.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/common/extensions/dom_action_types.h" | 8 #include "chrome/common/extensions/dom_action_types.h" |
9 #include "chrome/common/extensions/extension_messages.h" | 9 #include "chrome/common/extensions/extension_messages.h" |
10 #include "chrome/renderer/chrome_render_process_observer.h" | 10 #include "chrome/renderer/chrome_render_process_observer.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 params.call_type = DomActionType::METHOD; | 53 params.call_type = DomActionType::METHOD; |
54 | 54 |
55 content::RenderThread::Get()->Send( | 55 content::RenderThread::Get()->Send( |
56 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); | 56 new ExtensionHostMsg_AddDOMActionToActivityLog(extension_id_, params)); |
57 } | 57 } |
58 | 58 |
59 void DOMActivityLogger::AttachToWorld(int world_id, | 59 void DOMActivityLogger::AttachToWorld(int world_id, |
60 const std::string& extension_id, | 60 const std::string& extension_id, |
61 const GURL& url, | 61 const GURL& url, |
62 const string16& title) { | 62 const string16& title) { |
63 // Check if extension activity logging is enabled. | |
64 if (!ChromeRenderProcessObserver::extension_activity_log_enabled()) | |
65 return; | |
66 // If there is no logger registered for world_id, construct a new logger | 63 // If there is no logger registered for world_id, construct a new logger |
67 // and register it with world_id. | 64 // and register it with world_id. |
68 if (!WebKit::hasDOMActivityLogger(world_id)) { | 65 if (!WebKit::hasDOMActivityLogger(world_id)) { |
69 DOMActivityLogger* logger = new DOMActivityLogger(extension_id, url, title); | 66 DOMActivityLogger* logger = new DOMActivityLogger(extension_id, url, title); |
70 WebKit::setDOMActivityLogger(world_id, logger); | 67 WebKit::setDOMActivityLogger(world_id, logger); |
71 } | 68 } |
72 } | 69 } |
73 | 70 |
74 } // namespace extensions | 71 } // namespace extensions |
75 | 72 |
OLD | NEW |