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 // 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 SendErrorEvents(web_contents(), | 361 SendErrorEvents(web_contents(), |
362 pending_render_view_host_, | 362 pending_render_view_host_, |
363 FrameNavigationState::FrameID()); | 363 FrameNavigationState::FrameID()); |
364 } | 364 } |
365 pending_render_view_host_ = render_view_host; | 365 pending_render_view_host_ = render_view_host; |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 void WebNavigationTabObserver::DidStartProvisionalLoadForFrame( | 369 void WebNavigationTabObserver::DidStartProvisionalLoadForFrame( |
370 int64 frame_num, | 370 int64 frame_num, |
| 371 int64 parent_frame_num, |
371 bool is_main_frame, | 372 bool is_main_frame, |
372 const GURL& validated_url, | 373 const GURL& validated_url, |
373 bool is_error_page, | 374 bool is_error_page, |
374 content::RenderViewHost* render_view_host) { | 375 content::RenderViewHost* render_view_host) { |
375 if (!render_view_host_) | 376 if (!render_view_host_) |
376 render_view_host_ = render_view_host; | 377 render_view_host_ = render_view_host; |
377 if (render_view_host != render_view_host_ && | 378 if (render_view_host != render_view_host_ && |
378 render_view_host != pending_render_view_host_) | 379 render_view_host != pending_render_view_host_) |
379 return; | 380 return; |
380 | 381 |
381 FrameNavigationState::FrameID frame_id(frame_num, render_view_host); | 382 FrameNavigationState::FrameID frame_id(frame_num, render_view_host); |
| 383 FrameNavigationState::FrameID parent_frame_id( |
| 384 parent_frame_num, render_view_host); |
382 | 385 |
383 navigation_state_.TrackFrame(frame_id, | 386 navigation_state_.TrackFrame(frame_id, |
| 387 parent_frame_id, |
384 validated_url, | 388 validated_url, |
385 is_main_frame, | 389 is_main_frame, |
386 is_error_page); | 390 is_error_page); |
387 if (!navigation_state_.CanSendEvents(frame_id)) | 391 if (!navigation_state_.CanSendEvents(frame_id)) |
388 return; | 392 return; |
389 | 393 |
390 helpers::DispatchOnBeforeNavigate( | 394 helpers::DispatchOnBeforeNavigate( |
391 web_contents(), render_view_host->GetProcess()->GetID(), frame_num, | 395 web_contents(), render_view_host->GetProcess()->GetID(), frame_num, |
392 is_main_frame, validated_url); | 396 is_main_frame, validated_url); |
393 } | 397 } |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 navigation_state.IsMainFrame(frame_id), frame_id.frame_num); | 726 navigation_state.IsMainFrame(frame_id), frame_id.frame_num); |
723 frame->process_id = frame_id.render_view_host->GetProcess()->GetID(); | 727 frame->process_id = frame_id.render_view_host->GetProcess()->GetID(); |
724 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); | 728 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(frame_id); |
725 result_list.push_back(frame); | 729 result_list.push_back(frame); |
726 } | 730 } |
727 results_ = GetAllFrames::Results::Create(result_list); | 731 results_ = GetAllFrames::Results::Create(result_list); |
728 return true; | 732 return true; |
729 } | 733 } |
730 | 734 |
731 } // namespace extensions | 735 } // namespace extensions |
OLD | NEW |