| 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. | |
| 30 WebViewBrowserState* browser_state() const; | |
| 31 // Off the record browser state associated with the receiver. | |
| 32 WebViewBrowserState* off_the_record_browser_state() const; | |
| 33 | |
| 34 private: | 28 private: |
| 35 // The name of the product to be used in the User Agent string. | |
| 36 std::string user_agent_product_; | |
| 37 | |
| 38 // The WebMainParts created by |CreateWebMainParts()|. | 29 // The WebMainParts created by |CreateWebMainParts()|. |
| 39 WebViewWebMainParts* web_main_parts_; | 30 WebViewWebMainParts* web_main_parts_; |
| 40 | 31 |
| 41 DISALLOW_COPY_AND_ASSIGN(WebViewWebClient); | 32 DISALLOW_COPY_AND_ASSIGN(WebViewWebClient); |
| 42 }; | 33 }; |
| 43 | 34 |
| 44 } // namespace ios_web_view | 35 } // namespace ios_web_view |
| 45 | 36 |
| 46 #endif // IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ | 37 #endif // IOS_WEB_VIEW_INTERNAL_WEB_VIEW_WEB_CLIENT_H_ |
| OLD | NEW |