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

Side by Side Diff: google_apis/google_api_keys_mac.mm

Issue 2224473002: Add support for loading API keys from Info.plist on iOS and macOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 4 years, 4 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
(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 #include "base/mac/bundle_locations.h"
8 #include "base/mac/foundation_util.h"
9 #include "base/strings/sys_string_conversions.h"
10
11 namespace google_apis {
12
13 std::string GetAPIKeyFromInfoPlist(const std::string& key_name) {
14 NSString* keyName = base::SysUTF8ToNSString(key_name);
15 NSString* keyValue = base::mac::ObjCCast<NSString>(
16 [base::mac::FrameworkBundle() objectForInfoDictionaryKey:keyName]);
17 return base::SysNSStringToUTF8(keyValue);
18 }
19
20 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698