OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import "google_api_keys_mac.h" |
| 6 |
| 7 #import <Foundation/Foundation.h> |
| 8 |
| 9 #include "base/mac/bundle_locations.h" |
| 10 #include "base/mac/foundation_util.h" |
| 11 #include "base/strings/sys_string_conversions.h" |
| 12 |
| 13 namespace google_apis { |
| 14 |
| 15 std::string GetAPIKeyFromInfoPlist(const std::string& key_name) { |
| 16 NSString* keyName = base::SysUTF8ToNSString(key_name); |
| 17 NSString* keyValue = base::mac::ObjCCast<NSString>( |
| 18 [base::mac::FrameworkBundle() objectForInfoDictionaryKey:keyName]); |
| 19 return base::SysNSStringToUTF8(keyValue); |
| 20 } |
| 21 |
| 22 } // namespace google_apis |
OLD | NEW |