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

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

Issue 1226163009: Convert usages of mojo::ErrorHandler in //device to callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comment. Created 5 years, 5 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 | « no previous file | 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 #include "third_party/mojo/src/mojo/public/cpp/bindings/error_handler.h"
15 14
16 namespace base { 15 namespace base {
17 class SequencedTaskRunner; 16 class SequencedTaskRunner;
18 } 17 }
19 18
20 namespace mojo { 19 namespace mojo {
21 class ApplicationImpl; 20 class ApplicationImpl;
22 } 21 }
23 22
24 namespace device { 23 namespace device {
25 24
26 namespace usb { 25 namespace usb {
27 class DeviceManager; 26 class DeviceManager;
28 } 27 }
29 28
30 class DevicesApp : public mojo::ApplicationDelegate, 29 class DevicesApp : public mojo::ApplicationDelegate,
31 public mojo::InterfaceFactory<usb::DeviceManager>, 30 public mojo::InterfaceFactory<usb::DeviceManager> {
32 public mojo::ErrorHandler {
33 public: 31 public:
34 explicit DevicesApp( 32 explicit DevicesApp(
35 scoped_refptr<base::SequencedTaskRunner> service_task_runner); 33 scoped_refptr<base::SequencedTaskRunner> service_task_runner);
36 ~DevicesApp() override; 34 ~DevicesApp() override;
37 35
38 private: 36 private:
39 class USBServiceInitializer; 37 class USBServiceInitializer;
40 38
41 // mojo::ApplicationDelegate: 39 // mojo::ApplicationDelegate:
42 void Initialize(mojo::ApplicationImpl* app) override; 40 void Initialize(mojo::ApplicationImpl* app) override;
43 bool ConfigureIncomingConnection( 41 bool ConfigureIncomingConnection(
44 mojo::ApplicationConnection* connection) override; 42 mojo::ApplicationConnection* connection) override;
45 void Quit() override; 43 void Quit() override;
46 44
47 // mojo::InterfaceFactory<usb::DeviceManager>: 45 // mojo::InterfaceFactory<usb::DeviceManager>:
48 void Create(mojo::ApplicationConnection* connection, 46 void Create(mojo::ApplicationConnection* connection,
49 mojo::InterfaceRequest<usb::DeviceManager> request) override; 47 mojo::InterfaceRequest<usb::DeviceManager> request) override;
50 48
51 // mojo::ErrorHandler: 49 // Mojo error handler to track device manager count.
52 void OnConnectionError() override; 50 void OnConnectionError();
53 51
54 // 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
55 // services (e.g. usb::DeviceManager) are bound before the timeout elapses, 53 // services (e.g. usb::DeviceManager) are bound before the timeout elapses,
56 // it's canceled. 54 // it's canceled.
57 void StartIdleTimer(); 55 void StartIdleTimer();
58 56
59 mojo::ApplicationImpl* app_impl_; 57 mojo::ApplicationImpl* app_impl_;
60 scoped_ptr<USBServiceInitializer> service_initializer_; 58 scoped_ptr<USBServiceInitializer> service_initializer_;
61 scoped_refptr<base::SequencedTaskRunner> service_task_runner_; 59 scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
62 size_t active_device_manager_count_; 60 size_t active_device_manager_count_;
63 61
64 // 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.
65 base::CancelableClosure idle_timeout_callback_; 63 base::CancelableClosure idle_timeout_callback_;
66 64
67 DISALLOW_COPY_AND_ASSIGN(DevicesApp); 65 DISALLOW_COPY_AND_ASSIGN(DevicesApp);
68 }; 66 };
69 67
70 } // naespace device 68 } // naespace device
71 69
72 #endif // DEVICE_DEVICES_DEVICES_APP_H_ 70 #endif // DEVICE_DEVICES_DEVICES_APP_H_
OLDNEW
« no previous file with comments | « no previous file | device/devices_app/devices_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698