| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 // static | 69 // static |
| 70 LogPrivateAPI* LogPrivateAPI::Get(content::BrowserContext* context) { | 70 LogPrivateAPI* LogPrivateAPI::Get(content::BrowserContext* context) { |
| 71 return GetFactoryInstance()->Get(context); | 71 return GetFactoryInstance()->Get(context); |
| 72 } | 72 } |
| 73 | 73 |
| 74 LogPrivateAPI::LogPrivateAPI(content::BrowserContext* context) | 74 LogPrivateAPI::LogPrivateAPI(content::BrowserContext* context) |
| 75 : profile_(Profile::FromBrowserContext(context)), | 75 : profile_(Profile::FromBrowserContext(context)), |
| 76 logging_net_internals_(false) { | 76 logging_net_internals_(false) { |
| 77 registrar_.Add(this, | 77 registrar_.Add(this, |
| 78 chrome::NOTIFICATION_EXTENSION_UNLOADED, | 78 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 79 content::Source<Profile>(profile_)); | 79 content::Source<Profile>(profile_)); |
| 80 } | 80 } |
| 81 | 81 |
| 82 LogPrivateAPI::~LogPrivateAPI() { | 82 LogPrivateAPI::~LogPrivateAPI() { |
| 83 } | 83 } |
| 84 | 84 |
| 85 void LogPrivateAPI::StartNetInternalsWatch(const std::string& extension_id) { | 85 void LogPrivateAPI::StartNetInternalsWatch(const std::string& extension_id) { |
| 86 net_internal_watches_.insert(extension_id); | 86 net_internal_watches_.insert(extension_id); |
| 87 BrowserThread::PostTask( | 87 BrowserThread::PostTask( |
| 88 BrowserThread::IO, FROM_HERE, | 88 BrowserThread::IO, FROM_HERE, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 162 if (net_log() && logging_net_internals_) { | 162 if (net_log() && logging_net_internals_) { |
| 163 net_log()->RemoveThreadSafeObserver(this); | 163 net_log()->RemoveThreadSafeObserver(this); |
| 164 logging_net_internals_ = false; | 164 logging_net_internals_ = false; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 void LogPrivateAPI::Observe(int type, | 168 void LogPrivateAPI::Observe(int type, |
| 169 const content::NotificationSource& source, | 169 const content::NotificationSource& source, |
| 170 const content::NotificationDetails& details) { | 170 const content::NotificationDetails& details) { |
| 171 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { | 171 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED) { |
| 172 const Extension* extension = | 172 const Extension* extension = |
| 173 content::Details<const UnloadedExtensionInfo>(details)->extension; | 173 content::Details<const UnloadedExtensionInfo>(details)->extension; |
| 174 StopNetInternalsWatch(extension->id()); | 174 StopNetInternalsWatch(extension->id()); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 | 177 |
| 178 LogPrivateGetHistoricalFunction::LogPrivateGetHistoricalFunction() { | 178 LogPrivateGetHistoricalFunction::LogPrivateGetHistoricalFunction() { |
| 179 } | 179 } |
| 180 | 180 |
| 181 LogPrivateGetHistoricalFunction::~LogPrivateGetHistoricalFunction() { | 181 LogPrivateGetHistoricalFunction::~LogPrivateGetHistoricalFunction() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 LogPrivateStopNetInternalsWatchFunction:: | 235 LogPrivateStopNetInternalsWatchFunction:: |
| 236 ~LogPrivateStopNetInternalsWatchFunction() { | 236 ~LogPrivateStopNetInternalsWatchFunction() { |
| 237 } | 237 } |
| 238 | 238 |
| 239 bool LogPrivateStopNetInternalsWatchFunction::RunImpl() { | 239 bool LogPrivateStopNetInternalsWatchFunction::RunImpl() { |
| 240 LogPrivateAPI::Get(GetProfile())->StopNetInternalsWatch(extension_id()); | 240 LogPrivateAPI::Get(GetProfile())->StopNetInternalsWatch(extension_id()); |
| 241 return true; | 241 return true; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace extensions | 244 } // namespace extensions |
| OLD | NEW |