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

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

Issue 294963004: Revert of Add OnDisplayMetricsChanged in DisplayObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@update_orientation
Patch Set: Created 6 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
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/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 SystemInfoEventRouter(); 60 SystemInfoEventRouter();
61 virtual ~SystemInfoEventRouter(); 61 virtual ~SystemInfoEventRouter();
62 62
63 // Add/remove event listener for the |event_name| event. 63 // Add/remove event listener for the |event_name| event.
64 void AddEventListener(const std::string& event_name); 64 void AddEventListener(const std::string& event_name);
65 void RemoveEventListener(const std::string& event_name); 65 void RemoveEventListener(const std::string& event_name);
66 66
67 private: 67 private:
68 // gfx::DisplayObserver: 68 // gfx::DisplayObserver:
69 virtual void OnDisplayBoundsChanged(const gfx::Display& display) OVERRIDE;
69 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; 70 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE;
70 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; 71 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE;
71 virtual void OnDisplayMetricsChanged(const gfx::Display& display,
72 uint32_t metrics) OVERRIDE;
73 72
74 // RemovableStorageObserver implementation. 73 // RemovableStorageObserver implementation.
75 virtual void OnRemovableStorageAttached( 74 virtual void OnRemovableStorageAttached(
76 const storage_monitor::StorageInfo& info) OVERRIDE; 75 const storage_monitor::StorageInfo& info) OVERRIDE;
77 virtual void OnRemovableStorageDetached( 76 virtual void OnRemovableStorageDetached(
78 const storage_monitor::StorageInfo& info) OVERRIDE; 77 const storage_monitor::StorageInfo& info) OVERRIDE;
79 78
80 // Called from any thread to dispatch the systemInfo event to all extension 79 // Called from any thread to dispatch the systemInfo event to all extension
81 // processes cross multiple profiles. 80 // processes cross multiple profiles.
82 void DispatchEvent(const std::string& event_name, 81 void DispatchEvent(const std::string& event_name,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const storage_monitor::StorageInfo& info) { 175 const storage_monitor::StorageInfo& info) {
177 scoped_ptr<base::ListValue> args(new base::ListValue); 176 scoped_ptr<base::ListValue> args(new base::ListValue);
178 std::string transient_id = 177 std::string transient_id =
179 StorageMonitor::GetInstance()->GetTransientIdForDeviceId( 178 StorageMonitor::GetInstance()->GetTransientIdForDeviceId(
180 info.device_id()); 179 info.device_id());
181 args->AppendString(transient_id); 180 args->AppendString(transient_id);
182 181
183 DispatchEvent(system_storage::OnDetached::kEventName, args.Pass()); 182 DispatchEvent(system_storage::OnDetached::kEventName, args.Pass());
184 } 183 }
185 184
185 void SystemInfoEventRouter::OnDisplayBoundsChanged(
186 const gfx::Display& display) {
187 OnDisplayChanged();
188 }
189
186 void SystemInfoEventRouter::OnDisplayAdded(const gfx::Display& new_display) { 190 void SystemInfoEventRouter::OnDisplayAdded(const gfx::Display& new_display) {
187 OnDisplayChanged(); 191 OnDisplayChanged();
188 } 192 }
189 193
190 void SystemInfoEventRouter::OnDisplayRemoved(const gfx::Display& old_display) { 194 void SystemInfoEventRouter::OnDisplayRemoved(const gfx::Display& old_display) {
191 OnDisplayChanged(); 195 OnDisplayChanged();
192 } 196 }
193 197
194 void SystemInfoEventRouter::OnDisplayMetricsChanged(const gfx::Display& display,
195 uint32_t metrics) {
196 OnDisplayChanged();
197 }
198
199 void SystemInfoEventRouter::OnDisplayChanged() { 198 void SystemInfoEventRouter::OnDisplayChanged() {
200 scoped_ptr<base::ListValue> args(new base::ListValue()); 199 scoped_ptr<base::ListValue> args(new base::ListValue());
201 DispatchEvent(system_display::OnDisplayChanged::kEventName, args.Pass()); 200 DispatchEvent(system_display::OnDisplayChanged::kEventName, args.Pass());
202 } 201 }
203 202
204 void SystemInfoEventRouter::DispatchEvent(const std::string& event_name, 203 void SystemInfoEventRouter::DispatchEvent(const std::string& event_name,
205 scoped_ptr<base::ListValue> args) { 204 scoped_ptr<base::ListValue> args) {
206 g_browser_process->extension_event_router_forwarder()-> 205 g_browser_process->extension_event_router_forwarder()->
207 BroadcastEventToRenderers(event_name, args.Pass(), GURL()); 206 BroadcastEventToRenderers(event_name, args.Pass(), GURL());
208 } 207 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) { 252 void SystemInfoAPI::OnListenerRemoved(const EventListenerInfo& details) {
254 if (IsSystemStorageEvent(details.event_name)) { 253 if (IsSystemStorageEvent(details.event_name)) {
255 StorageMonitor::GetInstance()->EnsureInitialized( 254 StorageMonitor::GetInstance()->EnsureInitialized(
256 base::Bind(&RemoveEventListener, details.event_name)); 255 base::Bind(&RemoveEventListener, details.event_name));
257 } else { 256 } else {
258 RemoveEventListener(details.event_name); 257 RemoveEventListener(details.event_name);
259 } 258 }
260 } 259 }
261 260
262 } // namespace extensions 261 } // namespace extensions
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector.cc ('k') | chrome/browser/ui/ash/launcher/browser_status_monitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698