| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "device/devices_app/devices_app.h" | 5 #include "device/devices_app/devices_app.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "device/core/device_client.h" | 14 #include "device/core/device_client.h" |
| 15 #include "device/devices_app/usb/device_manager_impl.h" | 15 #include "device/devices_app/usb/device_manager_impl.h" |
| 16 #include "device/usb/usb_service.h" | 16 #include "device/usb/usb_service.h" |
| 17 #include "mojo/application/public/cpp/application_connection.h" | 17 #include "mojo/application/public/cpp/application_connection.h" |
| 18 #include "mojo/application/public/cpp/application_impl.h" | 18 #include "mojo/application/public/cpp/application_impl.h" |
| 19 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h" | 19 #include "mojo/public/cpp/bindings/interface_request.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| 22 namespace device { | 22 namespace device { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 // The number of seconds to wait without any bound DeviceManagers before | 26 // The number of seconds to wait without any bound DeviceManagers before |
| 27 // exiting the app. | 27 // exiting the app. |
| 28 const int64 kIdleTimeoutInSeconds = 10; | 28 const int64 kIdleTimeoutInSeconds = 10; |
| 29 | 29 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // guaranteed to outlive |this|, and the callback is canceled if |this| is | 127 // guaranteed to outlive |this|, and the callback is canceled if |this| is |
| 128 // destroyed. | 128 // destroyed. |
| 129 idle_timeout_callback_.Reset(base::Bind(&mojo::ApplicationImpl::Quit, | 129 idle_timeout_callback_.Reset(base::Bind(&mojo::ApplicationImpl::Quit, |
| 130 base::Unretained(app_impl_))); | 130 base::Unretained(app_impl_))); |
| 131 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 131 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 132 FROM_HERE, idle_timeout_callback_.callback(), | 132 FROM_HERE, idle_timeout_callback_.callback(), |
| 133 base::TimeDelta::FromSeconds(kIdleTimeoutInSeconds)); | 133 base::TimeDelta::FromSeconds(kIdleTimeoutInSeconds)); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace device | 136 } // namespace device |
| OLD | NEW |