OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/render_view.h" | 5 #include "content/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2003 return; | 2003 return; |
2004 } | 2004 } |
2005 | 2005 |
2006 is_loading_ = false; | 2006 is_loading_ = false; |
2007 | 2007 |
2008 // NOTE: For now we're doing the safest thing, and sending out notification | 2008 // NOTE: For now we're doing the safest thing, and sending out notification |
2009 // when done loading. This currently isn't an issue as the favicon is only | 2009 // when done loading. This currently isn't an issue as the favicon is only |
2010 // displayed when done loading. Ideally we would send notification when | 2010 // displayed when done loading. Ideally we would send notification when |
2011 // finished parsing the head, but webkit doesn't support that yet. | 2011 // finished parsing the head, but webkit doesn't support that yet. |
2012 // The feed discovery code would also benefit from access to the head. | 2012 // The feed discovery code would also benefit from access to the head. |
| 2013 |
| 2014 // TODO : Get both favicon and touch icon url, and send them to the browser. |
2013 GURL favicon_url(webview()->mainFrame()->favIconURL()); | 2015 GURL favicon_url(webview()->mainFrame()->favIconURL()); |
2014 if (!favicon_url.is_empty()) | 2016 if (!favicon_url.is_empty()) { |
2015 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, favicon_url)); | 2017 std::vector<FaviconURL> urls; |
| 2018 urls.push_back(FaviconURL(favicon_url, FAVICON)); |
| 2019 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); |
| 2020 } |
2016 | 2021 |
2017 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), | 2022 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), |
2018 search_provider::AUTODETECTED_PROVIDER); | 2023 search_provider::AUTODETECTED_PROVIDER); |
2019 | 2024 |
2020 Send(new ViewHostMsg_DidStopLoading(routing_id_)); | 2025 Send(new ViewHostMsg_DidStopLoading(routing_id_)); |
2021 | 2026 |
2022 if (load_progress_tracker_ != NULL) | 2027 if (load_progress_tracker_ != NULL) |
2023 load_progress_tracker_->DidStopLoading(); | 2028 load_progress_tracker_->DidStopLoading(); |
2024 | 2029 |
2025 MessageLoop::current()->PostDelayedTask( | 2030 MessageLoop::current()->PostDelayedTask( |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3140 | 3145 |
3141 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { | 3146 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { |
3142 UpdateTitle(frame, title); | 3147 UpdateTitle(frame, title); |
3143 | 3148 |
3144 // Also check whether we have new encoding name. | 3149 // Also check whether we have new encoding name. |
3145 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 3150 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
3146 } | 3151 } |
3147 | 3152 |
3148 void RenderView::didChangeIcons(WebFrame* frame) { | 3153 void RenderView::didChangeIcons(WebFrame* frame) { |
3149 if (!frame->parent()) { | 3154 if (!frame->parent()) { |
3150 Send(new ViewHostMsg_UpdateFaviconURL( | 3155 std::vector<FaviconURL> urls; |
3151 routing_id_, | 3156 urls.push_back(FaviconURL(frame->favIconURL(), FAVICON)); |
3152 page_id_, | 3157 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); |
3153 frame->favIconURL())); | |
3154 } | 3158 } |
3155 } | 3159 } |
3156 | 3160 |
3157 void RenderView::didFinishDocumentLoad(WebFrame* frame) { | 3161 void RenderView::didFinishDocumentLoad(WebFrame* frame) { |
3158 WebDataSource* ds = frame->dataSource(); | 3162 WebDataSource* ds = frame->dataSource(); |
3159 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 3163 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
3160 DCHECK(navigation_state); | 3164 DCHECK(navigation_state); |
3161 navigation_state->set_finish_document_load_time(Time::Now()); | 3165 navigation_state->set_finish_document_load_time(Time::Now()); |
3162 | 3166 |
3163 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); | 3167 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); |
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5077 const webkit_glue::CustomContextMenuContext& custom_context) { | 5081 const webkit_glue::CustomContextMenuContext& custom_context) { |
5078 if (custom_context.is_pepper_menu) | 5082 if (custom_context.is_pepper_menu) |
5079 pepper_delegate_.OnContextMenuClosed(custom_context); | 5083 pepper_delegate_.OnContextMenuClosed(custom_context); |
5080 else | 5084 else |
5081 context_menu_node_.reset(); | 5085 context_menu_node_.reset(); |
5082 } | 5086 } |
5083 | 5087 |
5084 void RenderView::OnNetworkStateChanged(bool online) { | 5088 void RenderView::OnNetworkStateChanged(bool online) { |
5085 WebNetworkStateNotifier::setOnLine(online); | 5089 WebNetworkStateNotifier::setOnLine(online); |
5086 } | 5090 } |
OLD | NEW |