Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 266053003: Remove page IDs from three WebContentsObserver APIs that don't need it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 for (size_t i = 0; i < icon_urls.size(); i++) { 2316 for (size_t i = 0; i < icon_urls.size(); i++) {
2317 std::vector<gfx::Size> sizes; 2317 std::vector<gfx::Size> sizes;
2318 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 2318 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
2319 urls.push_back(FaviconURL( 2319 urls.push_back(FaviconURL(
2320 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes)); 2320 icon_urls[i].iconURL(), ToFaviconType(icon_urls[i].iconType()), sizes));
2321 } 2321 }
2322 SendUpdateFaviconURL(urls); 2322 SendUpdateFaviconURL(urls);
2323 } 2323 }
2324 2324
2325 void RenderViewImpl::didHandleOnloadEvents(WebLocalFrame* frame) { 2325 void RenderViewImpl::didHandleOnloadEvents(WebLocalFrame* frame) {
2326 if (webview()->mainFrame() == frame) { 2326 if (webview()->mainFrame() == frame)
2327 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_, 2327 Send(new ViewHostMsg_DocumentOnLoadCompletedInMainFrame(routing_id_));
2328 page_id_));
2329 }
2330 } 2328 }
2331 2329
2332 void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) { 2330 void RenderViewImpl::didUpdateCurrentHistoryItem(WebLocalFrame* frame) {
2333 StartNavStateSyncTimerIfNecessary(); 2331 StartNavStateSyncTimerIfNecessary();
2334 } 2332 }
2335 2333
2336 void RenderViewImpl::CheckPreferredSize() { 2334 void RenderViewImpl::CheckPreferredSize() {
2337 // We don't always want to send the change messages over IPC, only if we've 2335 // We don't always want to send the change messages over IPC, only if we've
2338 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| 2336 // been put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode|
2339 // message. 2337 // message.
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
3338 // If we have a provisional frame we are between the start and commit stages 3336 // If we have a provisional frame we are between the start and commit stages
3339 // of loading and we don't want to save stats. 3337 // of loading and we don't want to save stats.
3340 if (!main_frame->provisionalDataSource()) { 3338 if (!main_frame->provisionalDataSource()) {
3341 WebDataSource* ds = main_frame->dataSource(); 3339 WebDataSource* ds = main_frame->dataSource();
3342 DocumentState* document_state = DocumentState::FromDataSource(ds); 3340 DocumentState* document_state = DocumentState::FromDataSource(ds);
3343 InternalDocumentStateData* data = 3341 InternalDocumentStateData* data =
3344 InternalDocumentStateData::FromDocumentState(document_state); 3342 InternalDocumentStateData::FromDocumentState(document_state);
3345 if (data->did_first_visually_non_empty_layout() && 3343 if (data->did_first_visually_non_empty_layout() &&
3346 !data->did_first_visually_non_empty_paint()) { 3344 !data->did_first_visually_non_empty_paint()) {
3347 data->set_did_first_visually_non_empty_paint(true); 3345 data->set_did_first_visually_non_empty_paint(true);
3348 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_, 3346 Send(new ViewHostMsg_DidFirstVisuallyNonEmptyPaint(routing_id_));
3349 page_id_));
3350 } 3347 }
3351 3348
3352 // TODO(jar): The following code should all be inside a method, probably in 3349 // TODO(jar): The following code should all be inside a method, probably in
3353 // NavigatorState. 3350 // NavigatorState.
3354 Time now = Time::Now(); 3351 Time now = Time::Now();
3355 if (document_state->first_paint_time().is_null()) { 3352 if (document_state->first_paint_time().is_null()) {
3356 document_state->set_first_paint_time(now); 3353 document_state->set_first_paint_time(now);
3357 } 3354 }
3358 if (document_state->first_paint_after_load_time().is_null() && 3355 if (document_state->first_paint_after_load_time().is_null() &&
3359 !document_state->finish_load_time().is_null()) { 3356 !document_state->finish_load_time().is_null()) {
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
4306 disambiguation_bitmaps_.erase(it); 4303 disambiguation_bitmaps_.erase(it);
4307 } 4304 }
4308 4305
4309 void RenderViewImpl::DidCommitCompositorFrame() { 4306 void RenderViewImpl::DidCommitCompositorFrame() {
4310 RenderWidget::DidCommitCompositorFrame(); 4307 RenderWidget::DidCommitCompositorFrame();
4311 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame()); 4308 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCommitCompositorFrame());
4312 } 4309 }
4313 4310
4314 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) { 4311 void RenderViewImpl::SendUpdateFaviconURL(const std::vector<FaviconURL>& urls) {
4315 if (!urls.empty()) 4312 if (!urls.empty())
4316 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, page_id_, urls)); 4313 Send(new ViewHostMsg_UpdateFaviconURL(routing_id_, urls));
4317 } 4314 }
4318 4315
4319 void RenderViewImpl::DidStopLoadingIcons() { 4316 void RenderViewImpl::DidStopLoadingIcons() {
4320 int icon_types = WebIconURL::TypeFavicon; 4317 int icon_types = WebIconURL::TypeFavicon;
4321 if (TouchEnabled()) 4318 if (TouchEnabled())
4322 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch; 4319 icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch;
4323 4320
4324 WebVector<WebIconURL> icon_urls = 4321 WebVector<WebIconURL> icon_urls =
4325 webview()->mainFrame()->iconURLs(icon_types); 4322 webview()->mainFrame()->iconURLs(icon_types);
4326 4323
4327 std::vector<FaviconURL> urls; 4324 std::vector<FaviconURL> urls;
4328 for (size_t i = 0; i < icon_urls.size(); i++) { 4325 for (size_t i = 0; i < icon_urls.size(); i++) {
4329 WebURL url = icon_urls[i].iconURL(); 4326 WebURL url = icon_urls[i].iconURL();
4330 std::vector<gfx::Size> sizes; 4327 std::vector<gfx::Size> sizes;
4331 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); 4328 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes);
4332 if (!url.isEmpty()) 4329 if (!url.isEmpty())
4333 urls.push_back( 4330 urls.push_back(
4334 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); 4331 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes));
4335 } 4332 }
4336 SendUpdateFaviconURL(urls); 4333 SendUpdateFaviconURL(urls);
4337 } 4334 }
4338 4335
4339 } // namespace content 4336 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698