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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 10823169: Another attempt at fixing dead frames being tracked by webNavigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 4 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 // Implements the Chrome Extensions WebNavigation API. 5 // Implements the Chrome Extensions WebNavigation API.
6 6
7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta nts.h" 10 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta nts.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 void WebNavigationTabObserver::DidCommitProvisionalLoadForFrame( 370 void WebNavigationTabObserver::DidCommitProvisionalLoadForFrame(
371 int64 frame_num, 371 int64 frame_num,
372 bool is_main_frame, 372 bool is_main_frame,
373 const GURL& url, 373 const GURL& url,
374 content::PageTransition transition_type, 374 content::PageTransition transition_type,
375 content::RenderViewHost* render_view_host) { 375 content::RenderViewHost* render_view_host) {
376 if (render_view_host != render_view_host_ && 376 if (render_view_host != render_view_host_ &&
377 render_view_host != pending_render_view_host_) 377 render_view_host != pending_render_view_host_)
378 return; 378 return;
379 FrameNavigationState::FrameID frame_id(frame_num, render_view_host); 379 FrameNavigationState::FrameID frame_id(frame_num, render_view_host);
380 FrameNavigationState::FrameID id_to_skip;
381 if (render_view_host == render_view_host_)
382 id_to_skip = frame_id;
383 if (is_main_frame)
384 SendErrorEvents(web_contents(), render_view_host_, id_to_skip);
385 render_view_host_ = render_view_host;
386 pending_render_view_host_ = NULL;
387
388 if (!navigation_state_.CanSendEvents(frame_id))
389 return;
390 380
391 bool is_reference_fragment_navigation = 381 bool is_reference_fragment_navigation =
392 IsReferenceFragmentNavigation(frame_id, url); 382 IsReferenceFragmentNavigation(frame_id, url);
393 bool is_history_navigation = 383 bool is_history_navigation =
394 navigation_state_.GetNavigationCommitted(frame_id); 384 navigation_state_.GetNavigationCommitted(frame_id);
395 385
386 if (is_main_frame && render_view_host_ == render_view_host) {
Matt Perry 2012/08/06 20:00:51 this branch confuses to me. how could the current
jochen (gone - plz use gerrit) 2012/08/06 21:08:39 pending means that it's in a different process. Th
Matt Perry 2012/08/06 21:16:26 Actually, the RVHM uses "pending" to refer to a na
Charlie Reis 2012/08/06 21:30:26 Pending is ambiguous here. NavigationController h
jochen (gone - plz use gerrit) 2012/08/06 21:42:32 I added a comment to the defintion in the header.
387 if (!is_reference_fragment_navigation && !is_history_navigation)
Charlie Reis 2012/08/06 20:04:13 Please add comments here, since this code is diffi
jochen (gone - plz use gerrit) 2012/08/06 21:08:39 I added a comment and clarified the variable name:
388 SendErrorEvents(web_contents(), render_view_host_, frame_id);
389 if (pending_render_view_host_) {
Matt Perry 2012/08/06 20:00:51 is it ever possible for pending_rvh_ to be the sam
jochen (gone - plz use gerrit) 2012/08/06 21:08:39 No (see above)
390 SendErrorEvents(web_contents(),
391 pending_render_view_host_,
392 FrameNavigationState::FrameID());
393 pending_render_view_host_ = NULL;
394 }
395 } else if (pending_render_view_host_ == render_view_host) {
396 SendErrorEvents(
397 web_contents(), render_view_host_, FrameNavigationState::FrameID());
398 render_view_host_ = pending_render_view_host_;
399 pending_render_view_host_ = NULL;
400 }
401
402 if (!navigation_state_.CanSendEvents(frame_id))
403 return;
404
396 // Update the URL as it might have changed. 405 // Update the URL as it might have changed.
397 navigation_state_.UpdateFrame(frame_id, url); 406 navigation_state_.UpdateFrame(frame_id, url);
398 navigation_state_.SetNavigationCommitted(frame_id); 407 navigation_state_.SetNavigationCommitted(frame_id);
399 408
400 if (is_reference_fragment_navigation) { 409 if (is_reference_fragment_navigation) {
401 helpers::DispatchOnCommitted( 410 helpers::DispatchOnCommitted(
402 keys::kOnReferenceFragmentUpdated, 411 keys::kOnReferenceFragmentUpdated,
403 web_contents(), 412 web_contents(),
404 frame_num, 413 frame_num,
405 is_main_frame, 414 is_main_frame,
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 navigation_state.IsMainFrame(frame_id), frame_id.frame_num); 688 navigation_state.IsMainFrame(frame_id), frame_id.frame_num);
680 frame->process_id = frame_id.render_view_host->GetProcess()->GetID(); 689 frame->process_id = frame_id.render_view_host->GetProcess()->GetID();
681 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); 690 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id);
682 result_list.push_back(frame); 691 result_list.push_back(frame);
683 } 692 }
684 results_ = GetAllFrames::Results::Create(result_list); 693 results_ = GetAllFrames::Results::Create(result_list);
685 return true; 694 return true;
686 } 695 }
687 696
688 } // namespace extensions 697 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698