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

Side by Side Diff: chrome/browser/extensions/system_info_event_router.h

Issue 10905171: Add systemInfo.cpu.onUpdated event implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 (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_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 namespace api {
17
18 namespace experimental_system_info_cpu {
19
20 struct CpuUpdateInfo;
21
22 } // namespace experimental_system_info_cpu
23
24 } // namespace api
25
16 // Event router for systemInfo API. It is a singleton instance shared by 26 // Event router for systemInfo API. It is a singleton instance shared by
17 // multiple profiles. 27 // multiple profiles.
18 // TODO(hongbo): It should derive from SystemMonitor::DevicesChangedObserver. 28 // TODO(hongbo): It should derive from SystemMonitor::DevicesChangedObserver.
19 // Since the system_monitor will be refactored along with media_gallery, once 29 // Since the system_monitor will be refactored along with media_gallery, once
20 // http://crbug.com/145400 is fixed, we need to update SystemInfoEventRouter 30 // http://crbug.com/145400 is fixed, we need to update SystemInfoEventRouter
21 // accordingly. 31 // accordingly.
22 class SystemInfoEventRouter { 32 class SystemInfoEventRouter {
23 public: 33 public:
24 static SystemInfoEventRouter* GetInstance(); 34 static SystemInfoEventRouter* GetInstance();
25 35
(...skipping 13 matching lines...) Expand all
39 const string16& name, 49 const string16& name,
40 const FilePath::StringType& location); 50 const FilePath::StringType& location);
41 void OnRemovableStorageDetached(const std::string& id); 51 void OnRemovableStorageDetached(const std::string& id);
42 52
43 private: 53 private:
44 friend struct DefaultSingletonTraits<SystemInfoEventRouter>; 54 friend struct DefaultSingletonTraits<SystemInfoEventRouter>;
45 55
46 SystemInfoEventRouter(); 56 SystemInfoEventRouter();
47 virtual ~SystemInfoEventRouter(); 57 virtual ~SystemInfoEventRouter();
48 58
49 // Called on the UI thread to dispatch the systemInfo event to all extension 59 // Called from any thread to dispatch the systemInfo event to all extension
50 // processes cross multiple profiles. 60 // processes cross multiple profiles.
51 void DispatchEvent(const std::string& event_name, 61 void DispatchEvent(const std::string& event_name,
52 scoped_ptr<base::ListValue> args); 62 scoped_ptr<base::ListValue> args);
53 63
64 // The callback for CPU sampling cycle. Called from FILE thread.
65 void OnNextCpuSampling(
66 scoped_ptr<api::experimental_system_info_cpu::CpuUpdateInfo> info);
67
54 // Used to record the event names being watched. 68 // Used to record the event names being watched.
55 std::multiset<std::string> watching_event_set_; 69 std::multiset<std::string> watching_event_set_;
56 70
57 DISALLOW_COPY_AND_ASSIGN(SystemInfoEventRouter); 71 DISALLOW_COPY_AND_ASSIGN(SystemInfoEventRouter);
58 }; 72 };
59 73
60 } // namespace extensions 74 } // namespace extensions
61 75
62 #endif // CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_ 76 #endif // CHROME_BROWSER_EXTENSIONS_SYSTEM_INFO_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/event_names.cc ('k') | chrome/browser/extensions/system_info_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698