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

Side by Side Diff: chrome/browser/chromeos/device/input_service_proxy.h

Issue 913773002: Created fakes for HID-detection screen testing. Initial browsertest added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: TaskRunner used for InputServiceProxy. Created 5 years, 9 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 | chrome/browser/chromeos/device/input_service_proxy.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_
6 #define CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ 6 #define CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/task_runner.h"
14 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "content/public/browser/browser_thread.h"
15 #include "device/hid/input_service_linux.h" 17 #include "device/hid/input_service_linux.h"
16 18
17 namespace chromeos { 19 namespace chromeos {
18 20
19 // Proxy to device::InputServiceLinux. Should be created and used on the UI 21 // Proxy to device::InputServiceLinux. Should be created and used on the UI
20 // thread. 22 // thread.
21 class InputServiceProxy { 23 class InputServiceProxy {
22 public: 24 public:
23 typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo; 25 typedef device::InputServiceLinux::InputDeviceInfo InputDeviceInfo;
24 26
(...skipping 15 matching lines...) Expand all
40 // Used for early init for cashing info about available HID. 42 // Used for early init for cashing info about available HID.
41 static void WarmUp(); 43 static void WarmUp();
42 44
43 void AddObserver(Observer* observer); 45 void AddObserver(Observer* observer);
44 void RemoveObserver(Observer* observer); 46 void RemoveObserver(Observer* observer);
45 47
46 void GetDevices(const GetDevicesCallback& callback); 48 void GetDevices(const GetDevicesCallback& callback);
47 void GetDeviceInfo(const std::string& id, 49 void GetDeviceInfo(const std::string& id,
48 const GetDeviceInfoCallback& callback); 50 const GetDeviceInfoCallback& callback);
49 51
52 // Should be called once before any InputServiceProxy instance is created.
53 static void SetThreadIdForTesting(content::BrowserThread::ID thread_id);
54
50 private: 55 private:
56 static content::BrowserThread::ID thread_identifier_;
57
51 class ServiceObserver; 58 class ServiceObserver;
52 59
53 void OnDeviceAdded(const device::InputServiceLinux::InputDeviceInfo& info); 60 void OnDeviceAdded(const device::InputServiceLinux::InputDeviceInfo& info);
54 void OnDeviceRemoved(const std::string& id); 61 void OnDeviceRemoved(const std::string& id);
55 62
56 ObserverList<Observer> observers_; 63 ObserverList<Observer> observers_;
57 scoped_ptr<ServiceObserver> service_observer_; 64 scoped_ptr<ServiceObserver> service_observer_;
58 65
59 base::ThreadChecker thread_checker_; 66 base::ThreadChecker thread_checker_;
60 67
68 scoped_refptr<base::TaskRunner> task_runner_;
69
61 base::WeakPtrFactory<InputServiceProxy> weak_factory_; 70 base::WeakPtrFactory<InputServiceProxy> weak_factory_;
62 71
63 DISALLOW_COPY_AND_ASSIGN(InputServiceProxy); 72 DISALLOW_COPY_AND_ASSIGN(InputServiceProxy);
64 }; 73 };
65 74
66 } // namespace chromeos 75 } // namespace chromeos
67 76
68 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_ 77 #endif // CHROME_BROWSER_CHROMEOS_DEVICE_INPUT_SERVICE_PROXY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/device/input_service_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698