OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gcd_private/gcd_private_api.h" | 5 #include "chrome/browser/extensions/api/gcd_private/gcd_private_api.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/linked_ptr.h" | 8 #include "base/memory/linked_ptr.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "base/profiler/scoped_profile.h" | |
12 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
13 #include "chrome/browser/local_discovery/cloud_device_list.h" | 12 #include "chrome/browser/local_discovery/cloud_device_list.h" |
14 #include "chrome/browser/local_discovery/cloud_print_printer_list.h" | 13 #include "chrome/browser/local_discovery/cloud_print_printer_list.h" |
15 #include "chrome/browser/local_discovery/gcd_api_flow.h" | 14 #include "chrome/browser/local_discovery/gcd_api_flow.h" |
16 #include "chrome/browser/local_discovery/gcd_constants.h" | 15 #include "chrome/browser/local_discovery/gcd_constants.h" |
17 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" | 16 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" |
18 #include "chrome/browser/local_discovery/privet_http_impl.h" | 17 #include "chrome/browser/local_discovery/privet_http_impl.h" |
19 #include "chrome/browser/local_discovery/privetv3_session.h" | 18 #include "chrome/browser/local_discovery/privetv3_session.h" |
20 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" | 19 #include "chrome/browser/local_discovery/service_discovery_shared_client.h" |
21 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 267 } |
269 } | 268 } |
270 | 269 |
271 GcdPrivateAPIImpl::~GcdPrivateAPIImpl() { | 270 GcdPrivateAPIImpl::~GcdPrivateAPIImpl() { |
272 if (EventRouter::Get(browser_context_)) { | 271 if (EventRouter::Get(browser_context_)) { |
273 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 272 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
274 } | 273 } |
275 } | 274 } |
276 | 275 |
277 void GcdPrivateAPIImpl::OnListenerAdded(const EventListenerInfo& details) { | 276 void GcdPrivateAPIImpl::OnListenerAdded(const EventListenerInfo& details) { |
278 // TODO(vadimt): Remove ScopedProfile below once crbug.com/417106 is fixed. | |
279 tracked_objects::ScopedProfile tracking_profile( | |
280 FROM_HERE_WITH_EXPLICIT_FUNCTION("GcdPrivateAPIImpl::OnListenerAdded")); | |
281 | |
282 if (details.event_name == gcd_private::OnDeviceStateChanged::kEventName || | 277 if (details.event_name == gcd_private::OnDeviceStateChanged::kEventName || |
283 details.event_name == gcd_private::OnDeviceRemoved::kEventName) { | 278 details.event_name == gcd_private::OnDeviceRemoved::kEventName) { |
284 num_device_listeners_++; | 279 num_device_listeners_++; |
285 | 280 |
286 if (num_device_listeners_ == 1) { | 281 if (num_device_listeners_ == 1) { |
287 service_discovery_client_ = | 282 service_discovery_client_ = |
288 local_discovery::ServiceDiscoverySharedClient::GetInstance(); | 283 local_discovery::ServiceDiscoverySharedClient::GetInstance(); |
289 privet_device_lister_.reset(new local_discovery::PrivetDeviceListerImpl( | 284 privet_device_lister_.reset(new local_discovery::PrivetDeviceListerImpl( |
290 service_discovery_client_.get(), this)); | 285 service_discovery_client_.get(), this)); |
291 privet_device_lister_->Start(); | 286 privet_device_lister_->Start(); |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 } | 947 } |
953 | 948 |
954 GcdPrivateGetCommandsListFunction::~GcdPrivateGetCommandsListFunction() { | 949 GcdPrivateGetCommandsListFunction::~GcdPrivateGetCommandsListFunction() { |
955 } | 950 } |
956 | 951 |
957 bool GcdPrivateGetCommandsListFunction::RunAsync() { | 952 bool GcdPrivateGetCommandsListFunction::RunAsync() { |
958 return false; | 953 return false; |
959 } | 954 } |
960 | 955 |
961 } // namespace extensions | 956 } // namespace extensions |
OLD | NEW |