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

Unified Diff: ios/web_view/internal/criwv_web_client.mm

Issue 2643773005: Upstream ios/web_view source code. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ios/web_view/internal/criwv_web_client.mm
diff --git a/ios/web_view/internal/criwv_web_client.mm b/ios/web_view/internal/criwv_web_client.mm
new file mode 100644
index 0000000000000000000000000000000000000000..dc8abf014fa1e8811fb0e3f0ee1a991ea57f3ee0
--- /dev/null
+++ b/ios/web_view/internal/criwv_web_client.mm
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/web_view/internal/criwv_web_client.h"
+
+#include "base/strings/sys_string_conversions.h"
+#include "ios/web/public/user_agent.h"
+#include "ios/web_view/internal/criwv_browser_state.h"
+#import "ios/web_view/internal/criwv_web_main_parts.h"
+#import "ios/web_view/public/criwv_delegate.h"
+
+namespace ios_web_view {
+
+CRIWVWebClient::CRIWVWebClient(id<CRIWVDelegate> delegate)
+ : delegate_(delegate) {}
+
+CRIWVWebClient::~CRIWVWebClient() {}
+
+web::WebMainParts* CRIWVWebClient::CreateWebMainParts() {
+ web_main_parts_.reset(new CRIWVWebMainParts(delegate_));
sdefresne 2017/01/20 10:28:12 This is seriously incorrect as this will cause two
michaeldo 2017/01/20 18:43:30 Done. I've filed crbug.com/683207 to fix the retur
+ return web_main_parts_.get();
+}
+
+CRIWVBrowserState* CRIWVWebClient::browser_state() const {
+ return web_main_parts_->browser_state();
+}
+
+std::string CRIWVWebClient::GetProduct() const {
+ return base::SysNSStringToUTF8([delegate_ partialUserAgent]);
+}
+
+std::string CRIWVWebClient::GetUserAgent(bool desktop_user_agent) const {
+ std::string product = GetProduct();
+ return web::BuildUserAgentFromProduct(product);
+}
+
+} // namespace ios_web_view

Powered by Google App Engine
This is Rietveld 408576698