Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ | 5 #ifndef IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ |
| 6 #define IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ | 6 #define IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #import "ios/web/public/web_client.h" | 11 #import "ios/web/public/web_client.h" |
| 12 | 12 |
| 13 namespace ios_web_view { | 13 namespace ios_web_view { |
| 14 class WebViewBrowserState; | |
| 15 class WebViewWebMainParts; | 14 class WebViewWebMainParts; |
| 16 | 15 |
| 17 // WebView implementation of WebClient. | 16 // WebView implementation of WebClient. |
| 18 class WebViewWebClient : public web::WebClient { | 17 class WebViewWebClient : public web::WebClient { |
| 19 public: | 18 public: |
| 20 explicit WebViewWebClient(const std::string& user_agent_product); | 19 WebViewWebClient(); |
| 21 ~WebViewWebClient() override; | 20 ~WebViewWebClient() override; |
| 22 | 21 |
| 23 // WebClient implementation. | 22 // WebClient implementation. |
| 24 web::WebMainParts* CreateWebMainParts() override; | 23 web::WebMainParts* CreateWebMainParts() override; |
| 25 std::string GetProduct() const override; | 24 std::string GetProduct() const override; |
| 26 std::string GetUserAgent(web::UserAgentType type) const override; | 25 std::string GetUserAgent(web::UserAgentType type) const override; |
| 27 NSString* GetEarlyPageScript(web::BrowserState* browser_state) const override; | 26 NSString* GetEarlyPageScript(web::BrowserState* browser_state) const override; |
| 28 | 27 |
| 29 // Normal browser state associated with the receiver. | 28 // Setter to modify the User Agent product. |
| 30 WebViewBrowserState* browser_state() const; | 29 void SetProduct(const std::string& user_agent_product); |
|
Eugene But (OOO till 7-30)
2017/04/11 17:52:42
Do you want to split ownership refactoring and add
michaeldo
2017/04/11 21:57:03
I tried to do this, but I would have to set user_a
| |
| 31 // Off the record browser state associated with the receiver. | |
| 32 WebViewBrowserState* off_the_record_browser_state() const; | |
| 33 | 30 |
| 34 private: | 31 private: |
| 35 // The name of the product to be used in the User Agent string. | 32 // The name of the product to be used in the User Agent string. |
| 36 std::string user_agent_product_; | 33 std::string user_agent_product_; |
| 37 | 34 |
| 38 // The WebMainParts created by |CreateWebMainParts()|. | 35 // The WebMainParts created by |CreateWebMainParts()|. |
| 39 WebViewWebMainParts* web_main_parts_; | 36 WebViewWebMainParts* web_main_parts_; |
| 40 | 37 |
| 41 DISALLOW_COPY_AND_ASSIGN(WebViewWebClient); | 38 DISALLOW_COPY_AND_ASSIGN(WebViewWebClient); |
| 42 }; | 39 }; |
| 43 | 40 |
| 44 } // namespace ios_web_view | 41 } // namespace ios_web_view |
| 45 | 42 |
| 46 #endif // IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ | 43 #endif // IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ |
| OLD | NEW |