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

Side by Side Diff: chrome/browser/extensions/api/system_info/system_info_api.cc

Issue 15817008: Move systemInfo.cpu API out out experimental namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/extensions/api/system_info/system_info_api.h" 5 #include "chrome/browser/extensions/api/system_info/system_info_api.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h" 17 #include "chrome/browser/extensions/api/system_info_cpu/cpu_info_provider.h"
18 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide r.h" 18 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide r.h"
19 #include "chrome/browser/extensions/event_names.h" 19 #include "chrome/browser/extensions/event_names.h"
20 #include "chrome/browser/extensions/event_router_forwarder.h" 20 #include "chrome/browser/extensions/event_router_forwarder.h"
21 #include "chrome/common/extensions/api/experimental_system_info_cpu.h"
22 #include "chrome/common/extensions/api/experimental_system_info_storage.h" 21 #include "chrome/common/extensions/api/experimental_system_info_storage.h"
22 #include "chrome/common/extensions/api/system_info_cpu.h"
23 #include "ui/gfx/display_observer.h" 23 #include "ui/gfx/display_observer.h"
24 24
25 #if defined(USE_ASH) 25 #if defined(USE_ASH)
26 #include "ash/screen_ash.h" 26 #include "ash/screen_ash.h"
27 #include "ash/shell.h" 27 #include "ash/shell.h"
28 #endif 28 #endif
29 29
30 namespace extensions { 30 namespace extensions {
31 31
32 using api::experimental_system_info_cpu::CpuUpdateInfo; 32 using api::system_info_cpu::CpuUpdateInfo;
33 using api::experimental_system_info_storage::StorageUnitInfo; 33 using api::experimental_system_info_storage::StorageUnitInfo;
34 using api::experimental_system_info_storage::StorageUnitType; 34 using api::experimental_system_info_storage::StorageUnitType;
35 using api::experimental_system_info_storage::StorageChangeInfo; 35 using api::experimental_system_info_storage::StorageChangeInfo;
36 using content::BrowserThread; 36 using content::BrowserThread;
37 37
38 namespace { 38 namespace {
39 39
40 // The display events use the "systemInfo" prefix. 40 // The display events use the "systemInfo" prefix.
41 const char kSystemInfoEventPrefix[] = "systemInfo"; 41 const char kSystemInfoEventPrefix[] = "systemInfo";
42 // The storage and cpu events still use the "experimental.systemInfo" prefix. 42 // The storage and cpu events still use the "experimental.systemInfo" prefix.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void DispatchEvent(const std::string& event_name, 93 void DispatchEvent(const std::string& event_name,
94 scoped_ptr<base::ListValue> args); 94 scoped_ptr<base::ListValue> args);
95 95
96 // The callbacks of querying storage info to start and stop watching the 96 // The callbacks of querying storage info to start and stop watching the
97 // storages. Called from UI thread. 97 // storages. Called from UI thread.
98 void StartWatchingStorages(const StorageInfo& info, bool success); 98 void StartWatchingStorages(const StorageInfo& info, bool success);
99 void StopWatchingStorages(const StorageInfo& info, bool success); 99 void StopWatchingStorages(const StorageInfo& info, bool success);
100 100
101 // The callback for CPU sampling cycle. Called from FILE thread. 101 // The callback for CPU sampling cycle. Called from FILE thread.
102 void OnNextCpuSampling( 102 void OnNextCpuSampling(
103 scoped_ptr<api::experimental_system_info_cpu::CpuUpdateInfo> info); 103 scoped_ptr<api::system_info_cpu::CpuUpdateInfo> info);
104 104
105 // Called to dispatch the systemInfo.display.onDisplayChanged event. 105 // Called to dispatch the systemInfo.display.onDisplayChanged event.
106 void OnDisplayChanged(); 106 void OnDisplayChanged();
107 107
108 // Used to record the event names being watched. 108 // Used to record the event names being watched.
109 std::multiset<std::string> watching_event_set_; 109 std::multiset<std::string> watching_event_set_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(SystemInfoEventRouter); 111 DISALLOW_COPY_AND_ASSIGN(SystemInfoEventRouter);
112 }; 112 };
113 113
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 317
318 void SystemInfoAPI::OnListenerAdded(const EventListenerInfo& details) { 318 void SystemInfoAPI::OnListenerAdded(const EventListenerInfo& details) {
319 SystemInfoEventRouter::GetInstance()->AddEventListener(details.event_name); 319 SystemInfoEventRouter::GetInstance()->AddEventListener(details.event_name);
320 } 320 }
321 321
322 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { 322 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) {
323 SystemInfoEventRouter::GetInstance()->RemoveEventListener(details.event_name); 323 SystemInfoEventRouter::GetInstance()->RemoveEventListener(details.event_name);
324 } 324 }
325 325
326 } // namespace extensions 326 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698