| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "ios/web/web_state/web_state_impl.h" | 5 #import "ios/web/web_state/web_state_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "ios/web/public/web_thread.h" | 29 #include "ios/web/public/web_thread.h" |
| 30 #include "ios/web/public/webui/web_ui_ios_controller.h" | 30 #include "ios/web/public/webui/web_ui_ios_controller.h" |
| 31 #include "ios/web/web_state/global_web_state_event_tracker.h" | 31 #include "ios/web/web_state/global_web_state_event_tracker.h" |
| 32 #include "ios/web/web_state/navigation_context_impl.h" | 32 #include "ios/web/web_state/navigation_context_impl.h" |
| 33 #import "ios/web/web_state/session_certificate_policy_cache_impl.h" | 33 #import "ios/web/web_state/session_certificate_policy_cache_impl.h" |
| 34 #import "ios/web/web_state/ui/crw_web_controller.h" | 34 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 35 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" | 35 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" |
| 36 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h" | 36 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h" |
| 37 #include "ios/web/webui/web_ui_ios_impl.h" | 37 #include "ios/web/webui/web_ui_ios_impl.h" |
| 38 #include "net/http/http_response_headers.h" | 38 #include "net/http/http_response_headers.h" |
| 39 #include "services/service_manager/public/cpp/interface_registry.h" | |
| 40 | 39 |
| 41 namespace web { | 40 namespace web { |
| 42 | 41 |
| 42 WebStateInterfaceProvider::WebStateInterfaceProvider() : binding_(this) {} |
| 43 WebStateInterfaceProvider::~WebStateInterfaceProvider() = default; |
| 44 |
| 45 void WebStateInterfaceProvider::Bind( |
| 46 service_manager::mojom::InterfaceProviderRequest request) { |
| 47 binding_.Bind(std::move(request)); |
| 48 } |
| 49 |
| 50 void WebStateInterfaceProvider::GetInterface( |
| 51 const std::string& interface_name, |
| 52 mojo::ScopedMessagePipeHandle handle) override { |
| 53 registry_.BindInterface(service_manager::Identity(), interface_name, |
| 54 std::move(handle)); |
| 55 } |
| 56 |
| 43 /* static */ | 57 /* static */ |
| 44 std::unique_ptr<WebState> WebState::Create(const CreateParams& params) { | 58 std::unique_ptr<WebState> WebState::Create(const CreateParams& params) { |
| 45 std::unique_ptr<WebStateImpl> web_state(new WebStateImpl(params)); | 59 std::unique_ptr<WebStateImpl> web_state(new WebStateImpl(params)); |
| 46 | 60 |
| 47 // Initialize the new session. | 61 // Initialize the new session. |
| 48 web_state->GetNavigationManagerImpl().InitializeSession(); | 62 web_state->GetNavigationManagerImpl().InitializeSession(); |
| 49 | 63 |
| 50 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. | 64 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. |
| 51 return std::move(web_state); | 65 return std::move(web_state); |
| 52 } | 66 } |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) { | 547 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) { |
| 534 for (auto& policy_decider : policy_deciders_) { | 548 for (auto& policy_decider : policy_deciders_) { |
| 535 if (!policy_decider.ShouldAllowResponse(response)) | 549 if (!policy_decider.ShouldAllowResponse(response)) |
| 536 return false; | 550 return false; |
| 537 } | 551 } |
| 538 return true; | 552 return true; |
| 539 } | 553 } |
| 540 | 554 |
| 541 #pragma mark - RequestTracker management | 555 #pragma mark - RequestTracker management |
| 542 | 556 |
| 543 service_manager::InterfaceRegistry* WebStateImpl::GetMojoInterfaceRegistry() { | 557 WebStateInterfaceProvider* WebStateImpl::GetWebStateInterfaceProvider() { |
| 544 if (!mojo_interface_registry_) { | 558 if (!web_state_interface_provider_) { |
| 545 mojo_interface_registry_ = | 559 web_state_interface_provider_ = |
| 546 base::MakeUnique<service_manager::InterfaceRegistry>(std::string()); | 560 base::MakeUnique<WebStateInterfaceProvider>(); |
| 547 } | 561 } |
| 548 return mojo_interface_registry_.get(); | 562 return web_state_interface_provider_.get(); |
| 549 } | 563 } |
| 550 | 564 |
| 551 base::WeakPtr<WebState> WebStateImpl::AsWeakPtr() { | 565 base::WeakPtr<WebState> WebStateImpl::AsWeakPtr() { |
| 552 return weak_factory_.GetWeakPtr(); | 566 return weak_factory_.GetWeakPtr(); |
| 553 } | 567 } |
| 554 | 568 |
| 555 #pragma mark - WebState implementation | 569 #pragma mark - WebState implementation |
| 556 | 570 |
| 557 bool WebStateImpl::IsWebUsageEnabled() const { | 571 bool WebStateImpl::IsWebUsageEnabled() const { |
| 558 return [web_controller_ webUsageEnabled]; | 572 return [web_controller_ webUsageEnabled]; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 const LoadCommittedDetails& load_details) { | 741 const LoadCommittedDetails& load_details) { |
| 728 for (auto& observer : observers_) | 742 for (auto& observer : observers_) |
| 729 observer.NavigationItemCommitted(load_details); | 743 observer.NavigationItemCommitted(load_details); |
| 730 } | 744 } |
| 731 | 745 |
| 732 WebState* WebStateImpl::GetWebState() { | 746 WebState* WebStateImpl::GetWebState() { |
| 733 return this; | 747 return this; |
| 734 } | 748 } |
| 735 | 749 |
| 736 } // namespace web | 750 } // namespace web |
| OLD | NEW |