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 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2114 return; | 2114 return; |
2115 } | 2115 } |
2116 | 2116 |
2117 is_loading_ = false; | 2117 is_loading_ = false; |
2118 | 2118 |
2119 // NOTE: For now we're doing the safest thing, and sending out notification | 2119 // NOTE: For now we're doing the safest thing, and sending out notification |
2120 // when done loading. This currently isn't an issue as the favicon is only | 2120 // when done loading. This currently isn't an issue as the favicon is only |
2121 // displayed when done loading. Ideally we would send notification when | 2121 // displayed when done loading. Ideally we would send notification when |
2122 // finished parsing the head, but webkit doesn't support that yet. | 2122 // finished parsing the head, but webkit doesn't support that yet. |
2123 // The feed discovery code would also benefit from access to the head. | 2123 // The feed discovery code would also benefit from access to the head. |
2124 | |
2125 // TODO : Get both favicon and touch icon url, and send them to the browser. | |
sky
2011/03/22 19:48:48
You should only do this if the browser cares about
michaelbai
2011/03/22 23:59:03
I will revisit it after I get the webkit part done
| |
2124 GURL favicon_url(webview()->mainFrame()->favIconURL()); | 2126 GURL favicon_url(webview()->mainFrame()->favIconURL()); |
2125 if (!favicon_url.is_empty()) | 2127 if (!favicon_url.is_empty()) { |
2126 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, favicon_url)); | 2128 std::vector<FaviconURL> urls; |
2129 urls.push_back(FaviconURL(favicon_url, FAVICON)); | |
2130 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); | |
2131 } | |
2127 | 2132 |
2128 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), | 2133 AddGURLSearchProvider(webview()->mainFrame()->openSearchDescriptionURL(), |
2129 ViewHostMsg_PageHasOSDD_Type::Autodetected()); | 2134 ViewHostMsg_PageHasOSDD_Type::Autodetected()); |
2130 | 2135 |
2131 Send(new ViewHostMsg_DidStopLoading(routing_id_)); | 2136 Send(new ViewHostMsg_DidStopLoading(routing_id_)); |
2132 | 2137 |
2133 if (load_progress_tracker_ != NULL) | 2138 if (load_progress_tracker_ != NULL) |
2134 load_progress_tracker_->DidStopLoading(); | 2139 load_progress_tracker_->DidStopLoading(); |
2135 | 2140 |
2136 MessageLoop::current()->PostDelayedTask( | 2141 MessageLoop::current()->PostDelayedTask( |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3332 | 3337 |
3333 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { | 3338 void RenderView::didReceiveTitle(WebFrame* frame, const WebString& title) { |
3334 UpdateTitle(frame, title); | 3339 UpdateTitle(frame, title); |
3335 | 3340 |
3336 // Also check whether we have new encoding name. | 3341 // Also check whether we have new encoding name. |
3337 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 3342 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
3338 } | 3343 } |
3339 | 3344 |
3340 void RenderView::didChangeIcons(WebFrame* frame) { | 3345 void RenderView::didChangeIcons(WebFrame* frame) { |
3341 if (!frame->parent()) { | 3346 if (!frame->parent()) { |
3342 Send(new ViewHostMsg_UpdateFaviconURL( | 3347 std::vector<FaviconURL> urls; |
3343 routing_id_, | 3348 urls.push_back(FaviconURL(frame->favIconURL(), FAVICON)); |
3344 page_id_, | 3349 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); |
3345 frame->favIconURL())); | |
3346 } | 3350 } |
3347 } | 3351 } |
3348 | 3352 |
3349 void RenderView::didFinishDocumentLoad(WebFrame* frame) { | 3353 void RenderView::didFinishDocumentLoad(WebFrame* frame) { |
3350 WebDataSource* ds = frame->dataSource(); | 3354 WebDataSource* ds = frame->dataSource(); |
3351 NavigationState* navigation_state = NavigationState::FromDataSource(ds); | 3355 NavigationState* navigation_state = NavigationState::FromDataSource(ds); |
3352 DCHECK(navigation_state); | 3356 DCHECK(navigation_state); |
3353 navigation_state->set_finish_document_load_time(Time::Now()); | 3357 navigation_state->set_finish_document_load_time(Time::Now()); |
3354 | 3358 |
3355 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); | 3359 Send(new ViewHostMsg_DocumentLoadedInFrame(routing_id_, frame->identifier())); |
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5412 const webkit_glue::CustomContextMenuContext& custom_context) { | 5416 const webkit_glue::CustomContextMenuContext& custom_context) { |
5413 if (custom_context.is_pepper_menu) | 5417 if (custom_context.is_pepper_menu) |
5414 pepper_delegate_.OnContextMenuClosed(custom_context); | 5418 pepper_delegate_.OnContextMenuClosed(custom_context); |
5415 else | 5419 else |
5416 context_menu_node_.reset(); | 5420 context_menu_node_.reset(); |
5417 } | 5421 } |
5418 | 5422 |
5419 void RenderView::OnNetworkStateChanged(bool online) { | 5423 void RenderView::OnNetworkStateChanged(bool online) { |
5420 WebNetworkStateNotifier::setOnLine(online); | 5424 WebNetworkStateNotifier::setOnLine(online); |
5421 } | 5425 } |
OLD | NEW |