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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 3232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3243 // If we have a provisional frame we are between the start and commit stages | 3243 // If we have a provisional frame we are between the start and commit stages |
3244 // of loading and we don't want to save stats. | 3244 // of loading and we don't want to save stats. |
3245 if (!main_frame->provisionalDataSource()) { | 3245 if (!main_frame->provisionalDataSource()) { |
3246 WebDataSource* ds = main_frame->dataSource(); | 3246 WebDataSource* ds = main_frame->dataSource(); |
3247 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3247 DocumentState* document_state = DocumentState::FromDataSource(ds); |
3248 InternalDocumentStateData* data = | 3248 InternalDocumentStateData* data = |
3249 InternalDocumentStateData::FromDocumentState(document_state); | 3249 InternalDocumentStateData::FromDocumentState(document_state); |
3250 if (data->did_first_visually_non_empty_layout() && | 3250 if (data->did_first_visually_non_empty_layout() && |
3251 !data->did_first_visually_non_empty_paint()) { | 3251 !data->did_first_visually_non_empty_paint()) { |
3252 data->set_did_first_visually_non_empty_paint(true); | 3252 data->set_did_first_visually_non_empty_paint(true); |
3253 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_, | 3253 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_)); |
3254 page_id_)); | |
3255 } | 3254 } |
3256 | 3255 |
3257 // TODO(jar): The following code should all be inside a method, probably in | 3256 // TODO(jar): The following code should all be inside a method, probably in |
3258 // NavigatorState. | 3257 // NavigatorState. |
3259 Time now = Time::Now(); | 3258 Time now = Time::Now(); |
3260 if (document_state->first_paint_time().is_null()) { | 3259 if (document_state->first_paint_time().is_null()) { |
3261 document_state->set_first_paint_time(now); | 3260 document_state->set_first_paint_time(now); |
3262 } | 3261 } |
3263 if (document_state->first_paint_after_load_time().is_null() && | 3262 if (document_state->first_paint_after_load_time().is_null() && |
3264 !document_state->finish_load_time().is_null()) { | 3263 !document_state->finish_load_time().is_null()) { |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4124 disambiguation_bitmaps_.erase(it); | 4123 disambiguation_bitmaps_.erase(it); |
4125 } | 4124 } |
4126 | 4125 |
4127 void RenderViewImpl::DidCommitCompositorFrame() { | 4126 void RenderViewImpl::DidCommitCompositorFrame() { |
4128 RenderWidget::DidCommitCompositorFrame(); | 4127 RenderWidget::DidCommitCompositorFrame(); |
4129 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); | 4128 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); |
4130 } | 4129 } |
4131 | 4130 |
4132 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { | 4131 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { |
4133 if (!urls.empty()) | 4132 if (!urls.empty()) |
4134 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); | 4133 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls)); |
4135 } | 4134 } |
4136 | 4135 |
4137 void RenderViewImpl::DidStopLoadingIcons() { | 4136 void RenderViewImpl::DidStopLoadingIcons() { |
4138 int icon_types = WebIconURL::TypeFavicon; | 4137 int icon_types = WebIconURL::TypeFavicon; |
4139 if (TouchEnabled()) | 4138 if (TouchEnabled()) |
4140 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; | 4139 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; |
4141 | 4140 |
4142 WebVector<WebIconURL> icon_urls = | 4141 WebVector<WebIconURL> icon_urls = |
4143 webview()->mainFrame()->iconURLs(icon_types); | 4142 webview()->mainFrame()->iconURLs(icon_types); |
4144 | 4143 |
4145 std::vector<FaviconURL> urls; | 4144 std::vector<FaviconURL> urls; |
4146 for (size_t i = 0; i < icon_urls.size(); i++) { | 4145 for (size_t i = 0; i < icon_urls.size(); i++) { |
4147 WebURL url = icon_urls[i].iconURL(); | 4146 WebURL url = icon_urls[i].iconURL(); |
4148 std::vector<gfx::Size> sizes; | 4147 std::vector<gfx::Size> sizes; |
4149 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 4148 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
4150 if (!url.isEmpty()) | 4149 if (!url.isEmpty()) |
4151 urls.push_back( | 4150 urls.push_back( |
4152 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 4151 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
4153 } | 4152 } |
4154 SendUpdateFaviconURL(urls); | 4153 SendUpdateFaviconURL(urls); |
4155 } | 4154 } |
4156 | 4155 |
4157 } // namespace content | 4156 } // namespace content |
OLD | NEW |