| 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" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #import "ios/web/interstitials/web_interstitial_impl.h" | 14 #import "ios/web/interstitials/web_interstitial_impl.h" |
| 15 #import "ios/web/navigation/crw_session_controller.h" | 15 #import "ios/web/navigation/crw_session_controller.h" |
| 16 #import "ios/web/navigation/navigation_item_impl.h" | 16 #import "ios/web/navigation/navigation_item_impl.h" |
| 17 #import "ios/web/navigation/session_storage_builder.h" | 17 #import "ios/web/navigation/session_storage_builder.h" |
| 18 #include "ios/web/public/browser_state.h" | 18 #include "ios/web/public/browser_state.h" |
| 19 #import "ios/web/public/crw_session_storage.h" | 19 #import "ios/web/public/crw_session_storage.h" |
| 20 #import "ios/web/public/java_script_dialog_presenter.h" | 20 #import "ios/web/public/java_script_dialog_presenter.h" |
| 21 #import "ios/web/public/navigation_item.h" | 21 #import "ios/web/public/navigation_item.h" |
| 22 #include "ios/web/public/url_util.h" | 22 #include "ios/web/public/url_util.h" |
| 23 #import "ios/web/public/web_client.h" | 23 #import "ios/web/public/web_client.h" |
| 24 #import "ios/web/public/web_state/context_menu_params.h" | 24 #import "ios/web/public/web_state/context_menu_params.h" |
| 25 #import "ios/web/public/web_state/ui/crw_content_view.h" | 25 #import "ios/web/public/web_state/ui/crw_content_view.h" |
| 26 #import "ios/web/public/web_state/web_state_delegate.h" | 26 #import "ios/web/public/web_state/web_state_delegate.h" |
| 27 #include "ios/web/public/web_state/web_state_interface_provider.h" |
| 27 #include "ios/web/public/web_state/web_state_observer.h" | 28 #include "ios/web/public/web_state/web_state_observer.h" |
| 28 #import "ios/web/public/web_state/web_state_policy_decider.h" | 29 #import "ios/web/public/web_state/web_state_policy_decider.h" |
| 29 #include "ios/web/public/web_thread.h" | 30 #include "ios/web/public/web_thread.h" |
| 30 #include "ios/web/public/webui/web_ui_ios_controller.h" | 31 #include "ios/web/public/webui/web_ui_ios_controller.h" |
| 31 #include "ios/web/web_state/global_web_state_event_tracker.h" | 32 #include "ios/web/web_state/global_web_state_event_tracker.h" |
| 32 #include "ios/web/web_state/navigation_context_impl.h" | 33 #include "ios/web/web_state/navigation_context_impl.h" |
| 33 #import "ios/web/web_state/session_certificate_policy_cache_impl.h" | 34 #import "ios/web/web_state/session_certificate_policy_cache_impl.h" |
| 34 #import "ios/web/web_state/ui/crw_web_controller.h" | 35 #import "ios/web/web_state/ui/crw_web_controller.h" |
| 35 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" | 36 #import "ios/web/web_state/ui/crw_web_controller_container_view.h" |
| 36 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h" | 37 #include "ios/web/webui/web_ui_ios_controller_factory_registry.h" |
| 37 #include "ios/web/webui/web_ui_ios_impl.h" | 38 #include "ios/web/webui/web_ui_ios_impl.h" |
| 38 #include "net/http/http_response_headers.h" | 39 #include "net/http/http_response_headers.h" |
| 39 #include "services/service_manager/public/cpp/interface_registry.h" | |
| 40 | 40 |
| 41 namespace web { | 41 namespace web { |
| 42 | 42 |
| 43 /* static */ | 43 /* static */ |
| 44 std::unique_ptr<WebState> WebState::Create(const CreateParams& params) { | 44 std::unique_ptr<WebState> WebState::Create(const CreateParams& params) { |
| 45 std::unique_ptr<WebStateImpl> web_state(new WebStateImpl(params)); | 45 std::unique_ptr<WebStateImpl> web_state(new WebStateImpl(params)); |
| 46 | 46 |
| 47 // Initialize the new session. | 47 // Initialize the new session. |
| 48 web_state->GetNavigationManagerImpl().InitializeSession(); | 48 web_state->GetNavigationManagerImpl().InitializeSession(); |
| 49 | 49 |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) { | 533 bool WebStateImpl::ShouldAllowResponse(NSURLResponse* response) { |
| 534 for (auto& policy_decider : policy_deciders_) { | 534 for (auto& policy_decider : policy_deciders_) { |
| 535 if (!policy_decider.ShouldAllowResponse(response)) | 535 if (!policy_decider.ShouldAllowResponse(response)) |
| 536 return false; | 536 return false; |
| 537 } | 537 } |
| 538 return true; | 538 return true; |
| 539 } | 539 } |
| 540 | 540 |
| 541 #pragma mark - RequestTracker management | 541 #pragma mark - RequestTracker management |
| 542 | 542 |
| 543 service_manager::InterfaceRegistry* WebStateImpl::GetMojoInterfaceRegistry() { | 543 WebStateInterfaceProvider* WebStateImpl::GetWebStateInterfaceProvider() { |
| 544 if (!mojo_interface_registry_) { | 544 if (!web_state_interface_provider_) { |
| 545 mojo_interface_registry_ = | 545 web_state_interface_provider_ = |
| 546 base::MakeUnique<service_manager::InterfaceRegistry>(std::string()); | 546 base::MakeUnique<WebStateInterfaceProvider>(); |
| 547 } | 547 } |
| 548 return mojo_interface_registry_.get(); | 548 return web_state_interface_provider_.get(); |
| 549 } | 549 } |
| 550 | 550 |
| 551 base::WeakPtr<WebState> WebStateImpl::AsWeakPtr() { | 551 base::WeakPtr<WebState> WebStateImpl::AsWeakPtr() { |
| 552 return weak_factory_.GetWeakPtr(); | 552 return weak_factory_.GetWeakPtr(); |
| 553 } | 553 } |
| 554 | 554 |
| 555 #pragma mark - WebState implementation | 555 #pragma mark - WebState implementation |
| 556 | 556 |
| 557 bool WebStateImpl::IsWebUsageEnabled() const { | 557 bool WebStateImpl::IsWebUsageEnabled() const { |
| 558 return [web_controller_ webUsageEnabled]; | 558 return [web_controller_ webUsageEnabled]; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 const LoadCommittedDetails& load_details) { | 727 const LoadCommittedDetails& load_details) { |
| 728 for (auto& observer : observers_) | 728 for (auto& observer : observers_) |
| 729 observer.NavigationItemCommitted(load_details); | 729 observer.NavigationItemCommitted(load_details); |
| 730 } | 730 } |
| 731 | 731 |
| 732 WebState* WebStateImpl::GetWebState() { | 732 WebState* WebStateImpl::GetWebState() { |
| 733 return this; | 733 return this; |
| 734 } | 734 } |
| 735 | 735 |
| 736 } // namespace web | 736 } // namespace web |
| OLD | NEW |