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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 while ((observer = it.GetNext()) != NULL) | 708 while ((observer = it.GetNext()) != NULL) |
709 if (observer->OnMessageReceived(message)) | 709 if (observer->OnMessageReceived(message)) |
710 return true; | 710 return true; |
711 | 711 |
712 // Message handlers should be aware of which RenderViewHost sent the | 712 // Message handlers should be aware of which RenderViewHost sent the |
713 // message, which is temporarily stored in message_source_. | 713 // message, which is temporarily stored in message_source_. |
714 message_source_ = render_view_host; | 714 message_source_ = render_view_host; |
715 bool handled = true; | 715 bool handled = true; |
716 bool message_is_ok = true; | 716 bool message_is_ok = true; |
717 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) | 717 IPC_BEGIN_MESSAGE_MAP_EX(WebContentsImpl, message, message_is_ok) |
| 718 #if defined(ENABLE_WEB_INTENTS) |
718 IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, | 719 IPC_MESSAGE_HANDLER(IntentsHostMsg_RegisterIntentService, |
719 OnRegisterIntentService) | 720 OnRegisterIntentService) |
720 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, | 721 IPC_MESSAGE_HANDLER(IntentsHostMsg_WebIntentDispatch, |
721 OnWebIntentDispatch) | 722 OnWebIntentDispatch) |
| 723 #endif |
722 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, | 724 IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache, |
723 OnDidLoadResourceFromMemoryCache) | 725 OnDidLoadResourceFromMemoryCache) |
724 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, | 726 IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent, |
725 OnDidDisplayInsecureContent) | 727 OnDidDisplayInsecureContent) |
726 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, | 728 IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent, |
727 OnDidRunInsecureContent) | 729 OnDidRunInsecureContent) |
728 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, | 730 IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame, |
729 OnDocumentLoadedInFrame) | 731 OnDocumentLoadedInFrame) |
730 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) | 732 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
731 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError, | 733 IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError, |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 return web_ui->ShouldFocusLocationBarByDefault(); | 1986 return web_ui->ShouldFocusLocationBarByDefault(); |
1985 NavigationEntry* entry = controller_.GetActiveEntry(); | 1987 NavigationEntry* entry = controller_.GetActiveEntry(); |
1986 return (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)); | 1988 return (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)); |
1987 } | 1989 } |
1988 | 1990 |
1989 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { | 1991 void WebContentsImpl::SetFocusToLocationBar(bool select_all) { |
1990 if (delegate_) | 1992 if (delegate_) |
1991 delegate_->SetFocusToLocationBar(select_all); | 1993 delegate_->SetFocusToLocationBar(select_all); |
1992 } | 1994 } |
1993 | 1995 |
| 1996 #if defined(ENABLE_WEB_INTENTS) |
1994 void WebContentsImpl::OnRegisterIntentService( | 1997 void WebContentsImpl::OnRegisterIntentService( |
1995 const webkit_glue::WebIntentServiceData& data, | 1998 const webkit_glue::WebIntentServiceData& data, |
1996 bool user_gesture) { | 1999 bool user_gesture) { |
1997 if (delegate_) | 2000 if (delegate_) |
1998 delegate_->RegisterIntentHandler(this, data, user_gesture); | 2001 delegate_->RegisterIntentHandler(this, data, user_gesture); |
1999 } | 2002 } |
2000 | 2003 |
2001 void WebContentsImpl::OnWebIntentDispatch( | 2004 void WebContentsImpl::OnWebIntentDispatch( |
2002 const webkit_glue::WebIntentData& intent, | 2005 const webkit_glue::WebIntentData& intent, |
2003 int intent_id) { | 2006 int intent_id) { |
2004 if (!delegate_) | 2007 if (!delegate_) |
2005 return; | 2008 return; |
2006 | 2009 |
2007 WebIntentsDispatcherImpl* intents_dispatcher = | 2010 WebIntentsDispatcherImpl* intents_dispatcher = |
2008 new WebIntentsDispatcherImpl(this, intent, intent_id); | 2011 new WebIntentsDispatcherImpl(this, intent, intent_id); |
2009 delegate_->WebIntentDispatch(this, intents_dispatcher); | 2012 delegate_->WebIntentDispatch(this, intents_dispatcher); |
2010 } | 2013 } |
| 2014 #endif |
2011 | 2015 |
2012 void WebContentsImpl::DidStartProvisionalLoadForFrame( | 2016 void WebContentsImpl::DidStartProvisionalLoadForFrame( |
2013 RenderViewHost* render_view_host, | 2017 RenderViewHost* render_view_host, |
2014 int64 frame_id, | 2018 int64 frame_id, |
2015 int64 parent_frame_id, | 2019 int64 parent_frame_id, |
2016 bool is_main_frame, | 2020 bool is_main_frame, |
2017 const GURL& url) { | 2021 const GURL& url) { |
2018 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 2022 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
2019 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL); | 2023 bool is_iframe_srcdoc = (url.spec() == chrome::kAboutSrcDocURL); |
2020 GURL validated_url(url); | 2024 GURL validated_url(url); |
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3446 | 3450 |
3447 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3451 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
3448 return browser_plugin_guest_.get(); | 3452 return browser_plugin_guest_.get(); |
3449 } | 3453 } |
3450 | 3454 |
3451 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3455 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
3452 return browser_plugin_embedder_.get(); | 3456 return browser_plugin_embedder_.get(); |
3453 } | 3457 } |
3454 | 3458 |
3455 } // namespace content | 3459 } // namespace content |
OLD | NEW |