OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 OnDidLoadResourceFromMemoryCache) | 521 OnDidLoadResourceFromMemoryCache) |
522 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, | 522 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |
523 OnDidDisplayInsecureContent) | 523 OnDidDisplayInsecureContent) |
524 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, | 524 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |
525 OnDidRunInsecureContent) | 525 OnDidRunInsecureContent) |
526 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) | 526 IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
527 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) | 527 IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
528 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) | 528 IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
529 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, | 529 IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
530 OnRegisterProtocolHandler) | 530 OnRegisterProtocolHandler) |
| 531 IPC_MESSAGE_HANDLER(ViewHostMsg_UnregisterProtocolHandler, |
| 532 OnUnregisterProtocolHandler) |
531 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) | 533 IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnFindReply) |
532 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) | 534 IPC_MESSAGE_HANDLER(ViewHostMsg_AppCacheAccessed, OnAppCacheAccessed) |
533 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) | 535 IPC_MESSAGE_HANDLER(ViewHostMsg_WebUISend, OnWebUISend) |
534 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, | 536 IPC_MESSAGE_HANDLER(ViewHostMsg_RequestPpapiBrokerPermission, |
535 OnRequestPpapiBrokerPermission) | 537 OnRequestPpapiBrokerPermission) |
536 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_AllocateInstanceID, | 538 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_AllocateInstanceID, |
537 OnBrowserPluginMessage(message)) | 539 OnBrowserPluginMessage(message)) |
538 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, | 540 IPC_MESSAGE_HANDLER_GENERIC(BrowserPluginHostMsg_Attach, |
539 OnBrowserPluginMessage(message)) | 541 OnBrowserPluginMessage(message)) |
540 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) | 542 IPC_MESSAGE_HANDLER(ImageHostMsg_DidDownloadImage, OnDidDownloadImage) |
(...skipping 2158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2699 return; | 2701 return; |
2700 | 2702 |
2701 ChildProcessSecurityPolicyImpl* policy = | 2703 ChildProcessSecurityPolicyImpl* policy = |
2702 ChildProcessSecurityPolicyImpl::GetInstance(); | 2704 ChildProcessSecurityPolicyImpl::GetInstance(); |
2703 if (policy->IsPseudoScheme(protocol)) | 2705 if (policy->IsPseudoScheme(protocol)) |
2704 return; | 2706 return; |
2705 | 2707 |
2706 delegate_->RegisterProtocolHandler(this, protocol, url, user_gesture); | 2708 delegate_->RegisterProtocolHandler(this, protocol, url, user_gesture); |
2707 } | 2709 } |
2708 | 2710 |
| 2711 void WebContentsImpl::OnUnregisterProtocolHandler(const std::string& protocol, |
| 2712 const GURL& url, |
| 2713 bool user_gesture) { |
| 2714 if (!delegate_) |
| 2715 return; |
| 2716 |
| 2717 ChildProcessSecurityPolicyImpl* policy = |
| 2718 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 2719 if (policy->IsPseudoScheme(protocol)) |
| 2720 return; |
| 2721 |
| 2722 delegate_->UnregisterProtocolHandler(this, protocol, url, user_gesture); |
| 2723 } |
| 2724 |
2709 void WebContentsImpl::OnFindReply(int request_id, | 2725 void WebContentsImpl::OnFindReply(int request_id, |
2710 int number_of_matches, | 2726 int number_of_matches, |
2711 const gfx::Rect& selection_rect, | 2727 const gfx::Rect& selection_rect, |
2712 int active_match_ordinal, | 2728 int active_match_ordinal, |
2713 bool final_update) { | 2729 bool final_update) { |
2714 if (delegate_) { | 2730 if (delegate_) { |
2715 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, | 2731 delegate_->FindReply(this, request_id, number_of_matches, selection_rect, |
2716 active_match_ordinal, final_update); | 2732 active_match_ordinal, final_update); |
2717 } | 2733 } |
2718 } | 2734 } |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4046 | 4062 |
4047 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 4063 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
4048 if (!delegate_) | 4064 if (!delegate_) |
4049 return; | 4065 return; |
4050 const gfx::Size new_size = GetPreferredSize(); | 4066 const gfx::Size new_size = GetPreferredSize(); |
4051 if (new_size != old_size) | 4067 if (new_size != old_size) |
4052 delegate_->UpdatePreferredSize(this, new_size); | 4068 delegate_->UpdatePreferredSize(this, new_size); |
4053 } | 4069 } |
4054 | 4070 |
4055 } // namespace content | 4071 } // namespace content |
OLD | NEW |