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

Side by Side Diff: chrome/browser/chromeos/system/pointer_device_observer.h

Issue 10311005: Fix for pointer settings when settings page is refreshed. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/system/pointer_device_observer.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SYSTEM_POINTER_DEVICE_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_
6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
11 #include "chrome/browser/chromeos/device_hierarchy_observer.h" 11 #include "chrome/browser/chromeos/device_hierarchy_observer.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 namespace system { 14 namespace system {
15 15
16 class PointerDeviceObserver : public DeviceHierarchyObserver { 16 class PointerDeviceObserver : public DeviceHierarchyObserver {
17 public: 17 public:
18 PointerDeviceObserver(); 18 PointerDeviceObserver();
19 virtual ~PointerDeviceObserver(); 19 virtual ~PointerDeviceObserver();
20 20
21 // Start observing device hierarchy.
21 void Init(); 22 void Init();
22 23
24 // Check for presence of devices.
25 void CheckDevices();
26
23 class Observer { 27 class Observer {
24 public: 28 public:
25 virtual void TouchpadExists(bool exists) = 0; 29 virtual void TouchpadExists(bool exists) = 0;
26 virtual void MouseExists(bool exists) = 0; 30 virtual void MouseExists(bool exists) = 0;
27 31
28 protected: 32 protected:
29 Observer() {} 33 Observer() {}
30 virtual ~Observer(); 34 virtual ~Observer();
31
32 private:
33 DISALLOW_COPY_AND_ASSIGN(Observer);
34 }; 35 };
35 void AddObserver(Observer* observer); 36 void AddObserver(Observer* observer);
36 void RemoveObserver(Observer* observer); 37 void RemoveObserver(Observer* observer);
37 38
38 private: 39 private:
39 // DeviceHierarchyObserver implementation. 40 // DeviceHierarchyObserver implementation.
40 virtual void DeviceHierarchyChanged() OVERRIDE; 41 virtual void DeviceHierarchyChanged() OVERRIDE;
41 virtual void DeviceAdded(int device_id) OVERRIDE {} 42 virtual void DeviceAdded(int device_id) OVERRIDE {}
42 virtual void DeviceRemoved(int device_id) OVERRIDE {} 43 virtual void DeviceRemoved(int device_id) OVERRIDE {}
43 virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE {} 44 virtual void DeviceKeyPressedOrReleased(int device_id) OVERRIDE {}
44 45
45 // Check for input devices. 46 // Check for pointer devices.
46 void CheckTouchpadExists(); 47 void CheckTouchpadExists();
47 void CheckMouseExists(); 48 void CheckMouseExists();
48 49
49 // Callback for input device checks. 50 // Callback for pointer device checks.
50 void TouchpadExists(bool* exists); 51 void OnTouchpadExists(bool* exists);
51 void MouseExists(bool* exists); 52 void OnMouseExists(bool* exists);
52 53
53 ObserverList<Observer> observers_; 54 ObserverList<Observer> observers_;
54 55
55 base::WeakPtrFactory<PointerDeviceObserver> weak_factory_; 56 base::WeakPtrFactory<PointerDeviceObserver> weak_factory_;
56 57
57 DISALLOW_COPY_AND_ASSIGN(PointerDeviceObserver); 58 DISALLOW_COPY_AND_ASSIGN(PointerDeviceObserver);
58 }; 59 };
59 60
60 } // namespace system 61 } // namespace system
61 } // namespace chromeos 62 } // namespace chromeos
62 63
63 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_ 64 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_POINTER_DEVICE_OBSERVER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/system/pointer_device_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698