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

Side by Side Diff: chrome/browser/chromeos/extensions/bluetooth_event_router.cc

Issue 10807087: Bluetooth API: add discovering changed events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
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 #include "chrome/browser/chromeos/extensions/bluetooth_event_router.h" 5 #include "chrome/browser/chromeos/extensions/bluetooth_event_router.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 77
78 void ExtensionBluetoothEventRouter::AdapterPoweredChanged( 78 void ExtensionBluetoothEventRouter::AdapterPoweredChanged(
79 chromeos::BluetoothAdapter* adapter, bool has_power) { 79 chromeos::BluetoothAdapter* adapter, bool has_power) {
80 DCHECK(adapter == adapter_.get()); 80 DCHECK(adapter == adapter_.get());
81 DispatchBooleanValueEvent( 81 DispatchBooleanValueEvent(
82 extension_event_names::kBluetoothOnPowerChanged, 82 extension_event_names::kBluetoothOnPowerChanged,
83 has_power); 83 has_power);
84 } 84 }
85 85
86 void ExtensionBluetoothEventRouter::AdapterDiscoveringChanged(
87 chromeos::BluetoothAdapter* adapter, bool discovering) {
88 DCHECK(adapter == adapter_.get());
miket_OOO 2012/07/24 16:58:50 Sorry I'm late to this design party, but if this m
bryeung 2012/07/24 17:02:09 It has to be in the signature because it's an over
89 DispatchBooleanValueEvent(
90 extension_event_names::kBluetoothOnDiscoveringChanged,
91 discovering);
92 }
93
86 void ExtensionBluetoothEventRouter::DeviceAdded( 94 void ExtensionBluetoothEventRouter::DeviceAdded(
87 chromeos::BluetoothAdapter* adapter, chromeos::BluetoothDevice* device) { 95 chromeos::BluetoothAdapter* adapter, chromeos::BluetoothDevice* device) {
88 if (!send_discovery_events_) 96 if (!send_discovery_events_)
89 return; 97 return;
90 98
91 DCHECK(adapter == adapter_.get()); 99 DCHECK(adapter == adapter_.get());
92 100
93 extensions::api::experimental_bluetooth::Device extension_device; 101 extensions::api::experimental_bluetooth::Device extension_device;
94 extensions::api::experimental_bluetooth::BluetoothDeviceToApiDevice( 102 extensions::api::experimental_bluetooth::BluetoothDeviceToApiDevice(
95 *device, &extension_device); 103 *device, &extension_device);
(...skipping 17 matching lines...) Expand all
113 std::string json_args; 121 std::string json_args;
114 base::JSONWriter::Write(&args, &json_args); 122 base::JSONWriter::Write(&args, &json_args);
115 123
116 // TODO(bryeung): only dispatch the event to interested renderers 124 // TODO(bryeung): only dispatch the event to interested renderers
117 // crbug.com/133179 125 // crbug.com/133179
118 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( 126 profile_->GetExtensionEventRouter()->DispatchEventToRenderers(
119 event_name, json_args, NULL, GURL()); 127 event_name, json_args, NULL, GURL());
120 } 128 }
121 129
122 } // namespace chromeos 130 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698