Index: ios/web_view/internal/cwv_web_view.mm |
diff --git a/ios/web_view/internal/cwv_web_view.mm b/ios/web_view/internal/cwv_web_view.mm |
index 08fb4d8dc30b2994005f51fbd5799b2b1efbc42c..0da46bd48a7c6b8c517da960386e2403ce02aa41 100644 |
--- a/ios/web_view/internal/cwv_web_view.mm |
+++ b/ios/web_view/internal/cwv_web_view.mm |
@@ -10,6 +10,7 @@ |
#import "base/ios/weak_nsobject.h" |
#include "base/memory/ptr_util.h" |
#include "base/strings/sys_string_conversions.h" |
+#include "google_apis/google_api_keys.h" |
#import "ios/web/public/navigation_manager.h" |
#include "ios/web/public/referrer.h" |
#include "ios/web/public/reload_type.h" |
@@ -60,6 +61,21 @@ |
@synthesize estimatedProgress = _estimatedProgress; |
@synthesize UIDelegate = _UIDelegate; |
++ (void)setGoogleAPIKey:(NSString*)googleAPIKey |
+ clientID:(NSString*)clientID |
+ clientSecret:(NSString*)clientSecret { |
+ google_apis::SetAPIKey(base::SysNSStringToUTF8(googleAPIKey)); |
+ |
+ std::string clientIDString = base::SysNSStringToUTF8(clientID); |
+ std::string clientSecretString = base::SysNSStringToUTF8(clientSecret); |
+ for (size_t i = 0; i < google_apis::CLIENT_NUM_ITEMS; ++i) { |
+ google_apis::OAuth2Client client = |
+ static_cast<google_apis::OAuth2Client>(i); |
michaeldo
2017/04/14 15:25:55
Can we prevent the cast if we do this loop inside
jzw1
2017/04/17 01:41:20
I followed the loop example in google_api_keys.cc:
|
+ google_apis::SetOAuth2ClientID(client, clientIDString); |
+ google_apis::SetOAuth2ClientSecret(client, clientSecretString); |
+ } |
+} |
+ |
- (instancetype)initWithFrame:(CGRect)frame |
configuration:(CWVWebViewConfiguration*)configuration { |
self = [super initWithFrame:frame]; |