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

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

Issue 1675083002: Rename ApplicationDelegate to ShellClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@delegate
Patch Set: . Created 4 years, 10 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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/cancelable_callback.h" 10 #include "base/cancelable_callback.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "mojo/shell/public/cpp/application_delegate.h"
15 #include "mojo/shell/public/cpp/interface_factory.h" 14 #include "mojo/shell/public/cpp/interface_factory.h"
15 #include "mojo/shell/public/cpp/shell_client.h"
16 16
17 namespace mojo { 17 namespace mojo {
18 class Shell; 18 class Shell;
19 } 19 }
20 20
21 namespace device { 21 namespace device {
22 22
23 namespace usb { 23 namespace usb {
24 class DeviceManager; 24 class DeviceManager;
25 } 25 }
26 26
27 class DevicesApp : public mojo::ApplicationDelegate, 27 class DevicesApp : public mojo::ShellClient,
28 public mojo::InterfaceFactory<usb::DeviceManager> { 28 public mojo::InterfaceFactory<usb::DeviceManager> {
29 public: 29 public:
30 DevicesApp(); 30 DevicesApp();
31 ~DevicesApp() override; 31 ~DevicesApp() override;
32 32
33 private: 33 private:
34 class USBServiceInitializer; 34 class USBServiceInitializer;
35 35
36 // mojo::ApplicationDelegate: 36 // mojo::ShellClient:
37 void Initialize(mojo::Shell* shell, 37 void Initialize(mojo::Shell* shell,
38 const std::string& url, 38 const std::string& url,
39 uint32_t id) override; 39 uint32_t id) override;
40 bool AcceptConnection(mojo::ApplicationConnection* connection) override; 40 bool AcceptConnection(mojo::Connection* connection) override;
41 void Quit() override; 41 void Quit() override;
42 42
43 // mojo::InterfaceFactory<usb::DeviceManager>: 43 // mojo::InterfaceFactory<usb::DeviceManager>:
44 void Create(mojo::ApplicationConnection* connection, 44 void Create(mojo::Connection* connection,
45 mojo::InterfaceRequest<usb::DeviceManager> request) override; 45 mojo::InterfaceRequest<usb::DeviceManager> request) override;
46 46
47 // Mojo error handler to track device manager count. 47 // Mojo error handler to track device manager count.
48 void OnConnectionError(); 48 void OnConnectionError();
49 49
50 // Sets the app for destruction after a period of idle time. If any top-level 50 // Sets the app for destruction after a period of idle time. If any top-level
51 // services (e.g. usb::DeviceManager) are bound before the timeout elapses, 51 // services (e.g. usb::DeviceManager) are bound before the timeout elapses,
52 // it's canceled. 52 // it's canceled.
53 void StartIdleTimer(); 53 void StartIdleTimer();
54 54
55 mojo::Shell* shell_; 55 mojo::Shell* shell_;
56 scoped_ptr<USBServiceInitializer> service_initializer_; 56 scoped_ptr<USBServiceInitializer> service_initializer_;
57 size_t active_device_manager_count_; 57 size_t active_device_manager_count_;
58 58
59 // Callback used to shut down the app after a period of inactivity. 59 // Callback used to shut down the app after a period of inactivity.
60 base::CancelableClosure idle_timeout_callback_; 60 base::CancelableClosure idle_timeout_callback_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(DevicesApp); 62 DISALLOW_COPY_AND_ASSIGN(DevicesApp);
63 }; 63 };
64 64
65 } // naespace device 65 } // naespace device
66 66
67 #endif // DEVICE_DEVICES_DEVICES_APP_H_ 67 #endif // DEVICE_DEVICES_DEVICES_APP_H_
OLDNEW
« no previous file with comments | « content/shell/utility/shell_content_utility_client.cc ('k') | device/devices_app/devices_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698