OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/extensions/api/log_private/log_private_api.h" | 5 #include "chrome/browser/extensions/api/log_private/log_private_api.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.h" |
28 #include "chrome/common/extensions/api/log_private.h" | 28 #include "chrome/common/extensions/api/log_private.h" |
29 #include "chrome/common/logging_chrome.h" | 29 #include "chrome/common/logging_chrome.h" |
30 #include "components/net_log/chrome_net_log.h" | 30 #include "components/net_log/chrome_net_log.h" |
31 #include "content/public/browser/render_frame_host.h" | 31 #include "content/public/browser/render_frame_host.h" |
32 #include "content/public/browser/render_process_host.h" | 32 #include "content/public/browser/render_process_host.h" |
33 #include "extensions/browser/event_router.h" | 33 #include "extensions/browser/event_router.h" |
34 #include "extensions/browser/extension_function.h" | 34 #include "extensions/browser/extension_function.h" |
35 #include "extensions/browser/extension_registry.h" | 35 #include "extensions/browser/extension_registry.h" |
36 #include "extensions/browser/granted_file_entry.h" | 36 #include "extensions/browser/granted_file_entry.h" |
| 37 #include "net/log/net_log_entry.h" |
37 | 38 |
38 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
39 #include "chrome/browser/chromeos/system_logs/debug_log_writer.h" | 40 #include "chrome/browser/chromeos/system_logs/debug_log_writer.h" |
40 #endif | 41 #endif |
41 | 42 |
42 using content::BrowserThread; | 43 using content::BrowserThread; |
43 | 44 |
44 namespace events { | 45 namespace events { |
45 const char kOnCapturedEvents[] = "logPrivate.onCapturedEvents"; | 46 const char kOnCapturedEvents[] = "logPrivate.onCapturedEvents"; |
46 } // namespace events | 47 } // namespace events |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 207 |
207 static base::LazyInstance<BrowserContextKeyedAPIFactory<LogPrivateAPI> > | 208 static base::LazyInstance<BrowserContextKeyedAPIFactory<LogPrivateAPI> > |
208 g_factory = LAZY_INSTANCE_INITIALIZER; | 209 g_factory = LAZY_INSTANCE_INITIALIZER; |
209 | 210 |
210 // static | 211 // static |
211 BrowserContextKeyedAPIFactory<LogPrivateAPI>* | 212 BrowserContextKeyedAPIFactory<LogPrivateAPI>* |
212 LogPrivateAPI::GetFactoryInstance() { | 213 LogPrivateAPI::GetFactoryInstance() { |
213 return g_factory.Pointer(); | 214 return g_factory.Pointer(); |
214 } | 215 } |
215 | 216 |
216 void LogPrivateAPI::OnAddEntry(const net::NetLog::Entry& entry) { | 217 void LogPrivateAPI::OnAddEntry(const net::NetLogEntry& entry) { |
217 // We could receive events on whatever thread they happen to be generated, | 218 // We could receive events on whatever thread they happen to be generated, |
218 // since we are only interested in network events, we should ignore any | 219 // since we are only interested in network events, we should ignore any |
219 // other thread than BrowserThread::IO. | 220 // other thread than BrowserThread::IO. |
220 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 221 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
221 return; | 222 return; |
222 } | 223 } |
223 | 224 |
224 if (!pending_entries_.get()) { | 225 if (!pending_entries_.get()) { |
225 pending_entries_.reset(new base::ListValue()); | 226 pending_entries_.reset(new base::ListValue()); |
226 BrowserThread::PostDelayedTask( | 227 BrowserThread::PostDelayedTask( |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 entry->SetBoolean("isDirectory", false); | 544 entry->SetBoolean("isDirectory", false); |
544 base::ListValue* entry_list = new base::ListValue(); | 545 base::ListValue* entry_list = new base::ListValue(); |
545 entry_list->Append(entry); | 546 entry_list->Append(entry); |
546 response->Set("entries", entry_list); | 547 response->Set("entries", entry_list); |
547 response->SetBoolean("multiple", false); | 548 response->SetBoolean("multiple", false); |
548 SetResult(std::move(response)); | 549 SetResult(std::move(response)); |
549 SendResponse(succeeded); | 550 SendResponse(succeeded); |
550 } | 551 } |
551 | 552 |
552 } // namespace extensions | 553 } // namespace extensions |
OLD | NEW |