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

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

Issue 1371793004: Provide the DeviceManager service to the renderer directly, no app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_permission
Patch Set: Fix header inclusion in chrome_content_browser_client.cc. 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
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
19 namespace mojo { 15 namespace mojo {
20 class ApplicationImpl; 16 class ApplicationImpl;
21 } 17 }
22 18
23 namespace device { 19 namespace device {
24 20
25 namespace usb { 21 namespace usb {
26 class DeviceManager; 22 class DeviceManager;
27 } 23 }
28 24
29 class DevicesApp : public mojo::ApplicationDelegate, 25 class DevicesApp : public mojo::ApplicationDelegate,
30 public mojo::InterfaceFactory<usb::DeviceManager> { 26 public mojo::InterfaceFactory<usb::DeviceManager> {
31 public: 27 public:
32 explicit DevicesApp( 28 explicit DevicesApp();
Ken Rockot(use gerrit already) 2015/09/28 22:23:14 nit: -explicit
Reilly Grant (use Gerrit) 2015/09/28 23:32:00 Done.
33 scoped_refptr<base::SequencedTaskRunner> service_task_runner);
34 ~DevicesApp() override; 29 ~DevicesApp() override;
35 30
36 private: 31 private:
37 class USBServiceInitializer; 32 class USBServiceInitializer;
38 33
39 // mojo::ApplicationDelegate: 34 // mojo::ApplicationDelegate:
40 void Initialize(mojo::ApplicationImpl* app) override; 35 void Initialize(mojo::ApplicationImpl* app) override;
41 bool ConfigureIncomingConnection( 36 bool ConfigureIncomingConnection(
42 mojo::ApplicationConnection* connection) override; 37 mojo::ApplicationConnection* connection) override;
43 void Quit() override; 38 void Quit() override;
44 39
45 // mojo::InterfaceFactory<usb::DeviceManager>: 40 // mojo::InterfaceFactory<usb::DeviceManager>:
46 void Create(mojo::ApplicationConnection* connection, 41 void Create(mojo::ApplicationConnection* connection,
47 mojo::InterfaceRequest<usb::DeviceManager> request) override; 42 mojo::InterfaceRequest<usb::DeviceManager> request) override;
48 43
49 // Mojo error handler to track device manager count. 44 // Mojo error handler to track device manager count.
50 void OnConnectionError(); 45 void OnConnectionError();
51 46
52 // Sets the app for destruction after a period of idle time. If any top-level 47 // Sets the app for destruction after a period of idle time. If any top-level
53 // services (e.g. usb::DeviceManager) are bound before the timeout elapses, 48 // services (e.g. usb::DeviceManager) are bound before the timeout elapses,
54 // it's canceled. 49 // it's canceled.
55 void StartIdleTimer(); 50 void StartIdleTimer();
56 51
57 mojo::ApplicationImpl* app_impl_; 52 mojo::ApplicationImpl* app_impl_;
58 scoped_ptr<USBServiceInitializer> service_initializer_; 53 scoped_ptr<USBServiceInitializer> service_initializer_;
59 scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
60 size_t active_device_manager_count_; 54 size_t active_device_manager_count_;
61 55
62 // Callback used to shut down the app after a period of inactivity. 56 // Callback used to shut down the app after a period of inactivity.
63 base::CancelableClosure idle_timeout_callback_; 57 base::CancelableClosure idle_timeout_callback_;
64 58
65 DISALLOW_COPY_AND_ASSIGN(DevicesApp); 59 DISALLOW_COPY_AND_ASSIGN(DevicesApp);
66 }; 60 };
67 61
68 } // naespace device 62 } // naespace device
69 63
70 #endif // DEVICE_DEVICES_DEVICES_APP_H_ 64 #endif // DEVICE_DEVICES_DEVICES_APP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698