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

Side by Side Diff: content/browser/geolocation/wifi_data_provider_corewlan_mac.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Implements a WLAN API binding for CoreWLAN, as available on OSX 10.6 5 // Implements a WLAN API binding for CoreWLAN, as available on OSX 10.6
6 6
7 #include "content/browser/geolocation/wifi_data_provider_mac.h" 7 #include "content/browser/geolocation/wifi_data_provider_mac.h"
8 8
9 #include <dlfcn.h> 9 #include <dlfcn.h>
10 #import <Foundation/Foundation.h> 10 #import <Foundation/Foundation.h>
11 11
12 #include "base/mac/scoped_nsautorelease_pool.h" 12 #include "base/mac/scoped_nsautorelease_pool.h"
13 #include "base/memory/scoped_nsobject.h" 13 #include "base/mac/scoped_nsobject.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
16 16
17 // Define a subset of the CoreWLAN interfaces we require. We can't depend on 17 // Define a subset of the CoreWLAN interfaces we require. We can't depend on
18 // CoreWLAN.h existing as we need to build on 10.5 SDKs. We can't just send 18 // CoreWLAN.h existing as we need to build on 10.5 SDKs. We can't just send
19 // messages to an untyped id due to the build treating warnings as errors, 19 // messages to an untyped id due to the build treating warnings as errors,
20 // hence the reason we need class definitions. 20 // hence the reason we need class definitions.
21 // TODO(joth): When we build all 10.6 code exclusively 10.6 SDK (or later) 21 // TODO(joth): When we build all 10.6 code exclusively 10.6 SDK (or later)
22 // tidy this up to use the framework directly. See http://crbug.com/37703 22 // tidy this up to use the framework directly. See http://crbug.com/37703
23 23
(...skipping 27 matching lines...) Expand all
51 51
52 // Must be called before any other interface method. Will return false if the 52 // Must be called before any other interface method. Will return false if the
53 // CoreWLAN framework cannot be initialized (e.g. running on pre-10.6 OSX), 53 // CoreWLAN framework cannot be initialized (e.g. running on pre-10.6 OSX),
54 // in which case no other method may be called. 54 // in which case no other method may be called.
55 bool Init(); 55 bool Init();
56 56
57 // WlanApiInterface 57 // WlanApiInterface
58 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) OVERRIDE; 58 virtual bool GetAccessPointData(WifiData::AccessPointDataSet* data) OVERRIDE;
59 59
60 private: 60 private:
61 scoped_nsobject<NSBundle> bundle_; 61 base::scoped_nsobject<NSBundle> bundle_;
62 scoped_nsobject<NSString> merge_key_; 62 base::scoped_nsobject<NSString> merge_key_;
63 63
64 DISALLOW_COPY_AND_ASSIGN(CoreWlanApi); 64 DISALLOW_COPY_AND_ASSIGN(CoreWlanApi);
65 }; 65 };
66 66
67 bool CoreWlanApi::Init() { 67 bool CoreWlanApi::Init() {
68 // As the WLAN api binding runs on its own thread, we need to provide our own 68 // As the WLAN api binding runs on its own thread, we need to provide our own
69 // auto release pool. It's simplest to do this as an automatic variable in 69 // auto release pool. It's simplest to do this as an automatic variable in
70 // each method that needs it, to ensure the scoping is correct and does not 70 // each method that needs it, to ensure the scoping is correct and does not
71 // interfere with any other code using autorelease pools on the thread. 71 // interfere with any other code using autorelease pools on the thread.
72 base::mac::ScopedNSAutoreleasePool auto_pool; 72 base::mac::ScopedNSAutoreleasePool auto_pool;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 WifiDataProviderCommon::WlanApiInterface* NewCoreWlanApi() { 179 WifiDataProviderCommon::WlanApiInterface* NewCoreWlanApi() {
180 scoped_ptr<CoreWlanApi> self(new CoreWlanApi); 180 scoped_ptr<CoreWlanApi> self(new CoreWlanApi);
181 if (self->Init()) 181 if (self->Init())
182 return self.release(); 182 return self.release();
183 183
184 return NULL; 184 return NULL;
185 } 185 }
186 186
187 } // namespace content 187 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698