Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: device/devices_app/devices_app.h

Issue 1382383002: Revert of Provide the DeviceManager service to the renderer directly, no app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_permission
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/usb/web_usb_client_impl.cc ('k') | device/devices_app/devices_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef DEVICE_DEVICES_DEVICES_APP_H_ 5 #ifndef DEVICE_DEVICES_DEVICES_APP_H_
6 #define DEVICE_DEVICES_DEVICES_APP_H_ 6 #define DEVICE_DEVICES_DEVICES_APP_H_
7 7
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "mojo/application/public/cpp/application_delegate.h" 12 #include "mojo/application/public/cpp/application_delegate.h"
13 #include "mojo/application/public/cpp/interface_factory.h" 13 #include "mojo/application/public/cpp/interface_factory.h"
14 14
15 namespace base {
16 class SequencedTaskRunner;
17 }
18
15 namespace mojo { 19 namespace mojo {
16 class ApplicationImpl; 20 class ApplicationImpl;
17 } 21 }
18 22
19 namespace device { 23 namespace device {
20 24
21 namespace usb { 25 namespace usb {
22 class DeviceManager; 26 class DeviceManager;
23 } 27 }
24 28
25 class DevicesApp : public mojo::ApplicationDelegate, 29 class DevicesApp : public mojo::ApplicationDelegate,
26 public mojo::InterfaceFactory<usb::DeviceManager> { 30 public mojo::InterfaceFactory<usb::DeviceManager> {
27 public: 31 public:
28 DevicesApp(); 32 explicit DevicesApp(
33 scoped_refptr<base::SequencedTaskRunner> service_task_runner);
29 ~DevicesApp() override; 34 ~DevicesApp() override;
30 35
31 private: 36 private:
32 class USBServiceInitializer; 37 class USBServiceInitializer;
33 38
34 // mojo::ApplicationDelegate: 39 // mojo::ApplicationDelegate:
35 void Initialize(mojo::ApplicationImpl* app) override; 40 void Initialize(mojo::ApplicationImpl* app) override;
36 bool ConfigureIncomingConnection( 41 bool ConfigureIncomingConnection(
37 mojo::ApplicationConnection* connection) override; 42 mojo::ApplicationConnection* connection) override;
38 void Quit() override; 43 void Quit() override;
39 44
40 // mojo::InterfaceFactory<usb::DeviceManager>: 45 // mojo::InterfaceFactory<usb::DeviceManager>:
41 void Create(mojo::ApplicationConnection* connection, 46 void Create(mojo::ApplicationConnection* connection,
42 mojo::InterfaceRequest<usb::DeviceManager> request) override; 47 mojo::InterfaceRequest<usb::DeviceManager> request) override;
43 48
44 // Mojo error handler to track device manager count. 49 // Mojo error handler to track device manager count.
45 void OnConnectionError(); 50 void OnConnectionError();
46 51
47 // Sets the app for destruction after a period of idle time. If any top-level 52 // Sets the app for destruction after a period of idle time. If any top-level
48 // services (e.g. usb::DeviceManager) are bound before the timeout elapses, 53 // services (e.g. usb::DeviceManager) are bound before the timeout elapses,
49 // it's canceled. 54 // it's canceled.
50 void StartIdleTimer(); 55 void StartIdleTimer();
51 56
52 mojo::ApplicationImpl* app_impl_; 57 mojo::ApplicationImpl* app_impl_;
53 scoped_ptr<USBServiceInitializer> service_initializer_; 58 scoped_ptr<USBServiceInitializer> service_initializer_;
59 scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
54 size_t active_device_manager_count_; 60 size_t active_device_manager_count_;
55 61
56 // Callback used to shut down the app after a period of inactivity. 62 // Callback used to shut down the app after a period of inactivity.
57 base::CancelableClosure idle_timeout_callback_; 63 base::CancelableClosure idle_timeout_callback_;
58 64
59 DISALLOW_COPY_AND_ASSIGN(DevicesApp); 65 DISALLOW_COPY_AND_ASSIGN(DevicesApp);
60 }; 66 };
61 67
62 } // naespace device 68 } // naespace device
63 69
64 #endif // DEVICE_DEVICES_DEVICES_APP_H_ 70 #endif // DEVICE_DEVICES_DEVICES_APP_H_
OLDNEW
« no previous file with comments | « content/renderer/usb/web_usb_client_impl.cc ('k') | device/devices_app/devices_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698