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 #include "ios/web/web_state/web_state_impl.h" | 5 #include "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/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
11 #include "ios/web/interstitials/web_interstitial_impl.h" | 11 #include "ios/web/interstitials/web_interstitial_impl.h" |
12 #import "ios/web/navigation/crw_session_controller.h" | 12 #import "ios/web/navigation/crw_session_controller.h" |
13 #import "ios/web/navigation/crw_session_entry.h" | 13 #import "ios/web/navigation/crw_session_entry.h" |
14 #include "ios/web/navigation/navigation_item_impl.h" | 14 #include "ios/web/navigation/navigation_item_impl.h" |
15 #include "ios/web/net/request_group_util.h" | 15 #include "ios/web/net/request_group_util.h" |
16 #include "ios/web/public/browser_state.h" | 16 #include "ios/web/public/browser_state.h" |
17 #include "ios/web/public/dialog_presenter.h" | |
17 #include "ios/web/public/navigation_item.h" | 18 #include "ios/web/public/navigation_item.h" |
18 #include "ios/web/public/url_util.h" | 19 #include "ios/web/public/url_util.h" |
19 #include "ios/web/public/web_client.h" | 20 #include "ios/web/public/web_client.h" |
20 #import "ios/web/public/web_state/context_menu_params.h" | 21 #import "ios/web/public/web_state/context_menu_params.h" |
21 #include "ios/web/public/web_state/credential.h" | 22 #include "ios/web/public/web_state/credential.h" |
22 #include "ios/web/public/web_state/ui/crw_content_view.h" | 23 #include "ios/web/public/web_state/ui/crw_content_view.h" |
23 #include "ios/web/public/web_state/web_state_delegate.h" | 24 #include "ios/web/public/web_state/web_state_delegate.h" |
24 #include "ios/web/public/web_state/web_state_observer.h" | 25 #include "ios/web/public/web_state/web_state_observer.h" |
25 #include "ios/web/public/web_state/web_state_policy_decider.h" | 26 #include "ios/web/public/web_state/web_state_policy_decider.h" |
26 #include "ios/web/web_state/global_web_state_event_tracker.h" | 27 #include "ios/web/web_state/global_web_state_event_tracker.h" |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 } | 423 } |
423 } | 424 } |
424 | 425 |
425 bool WebStateImpl::HandleContextMenu(const web::ContextMenuParams& params) { | 426 bool WebStateImpl::HandleContextMenu(const web::ContextMenuParams& params) { |
426 if (delegate_) { | 427 if (delegate_) { |
427 return delegate_->HandleContextMenu(this, params); | 428 return delegate_->HandleContextMenu(this, params); |
428 } | 429 } |
429 return false; | 430 return false; |
430 } | 431 } |
431 | 432 |
433 void WebStateImpl::RunJavaScriptDialog( | |
434 const GURL& origin_url, | |
435 JavaScriptMessageType javascript_message_type, | |
436 NSString* message_text, | |
437 NSString* default_prompt_text, | |
438 const DialogClosedCallback& callback) { | |
439 if (!delegate_) { | |
440 callback.Run(false, nil); | |
441 return; | |
442 } | |
443 DialogPresenter* presenter = delegate_->GetDialogPresenter(this); | |
444 if (presenter) { | |
445 presenter->RunJavaScriptDialog(this, origin_url, javascript_message_type, | |
446 message_text, default_prompt_text, callback); | |
447 } | |
Eugene But (OOO till 7-30)
2016/06/24 17:04:53
I would expect a crash if GetDialogPresenter retur
michaeldo
2016/06/27 20:30:10
Done.
| |
448 } | |
449 | |
450 void WebStateImpl::RunAuthDialog(NSURLProtectionSpace* protectionSpace, | |
451 NSURLCredential* credential, | |
452 const AuthDialogCallback& callback) { | |
453 if (!delegate_) { | |
454 callback.Run(net::AuthCredentials()); | |
455 return; | |
456 } | |
457 DialogPresenter* presenter = delegate_->GetDialogPresenter(this); | |
458 if (presenter) { | |
459 presenter->RunAuthDialog(this, protectionSpace, credential, callback); | |
460 } | |
461 } | |
462 | |
463 void WebStateImpl::CancelActiveAndPendingDialogs() { | |
464 if (delegate_) { | |
465 DialogPresenter* presenter = delegate_->GetDialogPresenter(this); | |
466 if (presenter) { | |
467 presenter->CancelActiveAndPendingDialogs(this); | |
468 } | |
469 } | |
470 } | |
471 | |
432 WebUIIOS* WebStateImpl::CreateWebUIIOS(const GURL& url) { | 472 WebUIIOS* WebStateImpl::CreateWebUIIOS(const GURL& url) { |
433 WebUIIOSControllerFactory* factory = | 473 WebUIIOSControllerFactory* factory = |
434 WebUIIOSControllerFactoryRegistry::GetInstance(); | 474 WebUIIOSControllerFactoryRegistry::GetInstance(); |
435 if (!factory) | 475 if (!factory) |
436 return NULL; | 476 return NULL; |
437 WebUIIOSImpl* web_ui = new WebUIIOSImpl(this); | 477 WebUIIOSImpl* web_ui = new WebUIIOSImpl(this); |
438 WebUIIOSController* controller = | 478 WebUIIOSController* controller = |
439 factory->CreateWebUIIOSControllerForURL(web_ui, url); | 479 factory->CreateWebUIIOSControllerForURL(web_ui, url); |
440 if (controller) { | 480 if (controller) { |
441 web_ui->SetController(controller); | 481 web_ui->SetController(controller); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
663 const LoadCommittedDetails& load_details) { | 703 const LoadCommittedDetails& load_details) { |
664 FOR_EACH_OBSERVER(WebStateObserver, observers_, | 704 FOR_EACH_OBSERVER(WebStateObserver, observers_, |
665 NavigationItemCommitted(load_details)); | 705 NavigationItemCommitted(load_details)); |
666 } | 706 } |
667 | 707 |
668 WebState* WebStateImpl::GetWebState() { | 708 WebState* WebStateImpl::GetWebState() { |
669 return this; | 709 return this; |
670 } | 710 } |
671 | 711 |
672 } // namespace web | 712 } // namespace web |
OLD | NEW |