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

Side by Side Diff: chrome/browser/extensions/extension_webnavigation_api.cc

Issue 7488011: Update the tracked URL of a frame if it changes during a navigation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webnavigation_apitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Implements the Chrome Extensions WebNavigation API. 5 // Implements the Chrome Extensions WebNavigation API.
6 6
7 #include "chrome/browser/extensions/extension_webnavigation_api.h" 7 #include "chrome/browser/extensions/extension_webnavigation_api.h"
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 tab_contents(), frame_id, is_main_frame, validated_url); 313 tab_contents(), frame_id, is_main_frame, validated_url);
314 } 314 }
315 315
316 void ExtensionWebNavigationTabObserver::DidCommitProvisionalLoadForFrame( 316 void ExtensionWebNavigationTabObserver::DidCommitProvisionalLoadForFrame(
317 int64 frame_id, 317 int64 frame_id,
318 bool is_main_frame, 318 bool is_main_frame,
319 const GURL& url, 319 const GURL& url,
320 PageTransition::Type transition_type) { 320 PageTransition::Type transition_type) {
321 if (!navigation_state_.CanSendEvents(frame_id)) 321 if (!navigation_state_.CanSendEvents(frame_id))
322 return; 322 return;
323
324 bool is_reference_fragment_navigation =
325 IsReferenceFragmentNavigation(frame_id, url);
326
327 // Update the URL as it might have changed.
328 navigation_state_.TrackFrame(frame_id,
329 url,
330 is_main_frame,
331 false,
332 tab_contents());
333
323 // On reference fragment navigations, only a new navigation state is 334 // On reference fragment navigations, only a new navigation state is
324 // committed. We need to catch this case and generate a full sequence 335 // committed. We need to catch this case and generate a full sequence
325 // of events. 336 // of events.
326 if (IsReferenceFragmentNavigation(frame_id, url)) { 337 if (is_reference_fragment_navigation) {
327 NavigatedReferenceFragment(frame_id, is_main_frame, url, transition_type); 338 NavigatedReferenceFragment(frame_id, is_main_frame, url, transition_type);
328 return; 339 return;
329 } 340 }
330 DispatchOnCommitted( 341 DispatchOnCommitted(
331 tab_contents(), frame_id, is_main_frame, url, transition_type); 342 tab_contents(), frame_id, is_main_frame, url, transition_type);
332 } 343 }
333 344
334 void ExtensionWebNavigationTabObserver::DidFailProvisionalLoad( 345 void ExtensionWebNavigationTabObserver::DidFailProvisionalLoad(
335 int64 frame_id, 346 int64 frame_id,
336 bool is_main_frame, 347 bool is_main_frame,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 replacements.ClearRef(); 428 replacements.ClearRef();
418 return existing_url.ReplaceComponents(replacements) == 429 return existing_url.ReplaceComponents(replacements) ==
419 url.ReplaceComponents(replacements); 430 url.ReplaceComponents(replacements);
420 } 431 }
421 432
422 void ExtensionWebNavigationTabObserver::NavigatedReferenceFragment( 433 void ExtensionWebNavigationTabObserver::NavigatedReferenceFragment(
423 int64 frame_id, 434 int64 frame_id,
424 bool is_main_frame, 435 bool is_main_frame,
425 const GURL& url, 436 const GURL& url,
426 PageTransition::Type transition_type) { 437 PageTransition::Type transition_type) {
427 navigation_state_.TrackFrame(frame_id,
428 url,
429 is_main_frame,
430 false,
431 tab_contents());
432
433 DispatchOnBeforeNavigate(tab_contents(), 438 DispatchOnBeforeNavigate(tab_contents(),
434 frame_id, 439 frame_id,
435 is_main_frame, 440 is_main_frame,
436 url); 441 url);
437 DispatchOnCommitted(tab_contents(), 442 DispatchOnCommitted(tab_contents(),
438 frame_id, 443 frame_id,
439 is_main_frame, 444 is_main_frame,
440 url, 445 url,
441 transition_type); 446 transition_type);
442 DispatchOnDOMContentLoaded(tab_contents(), 447 DispatchOnDOMContentLoaded(tab_contents(),
443 url, 448 url,
444 is_main_frame, 449 is_main_frame,
445 frame_id); 450 frame_id);
446 DispatchOnCompleted(tab_contents(), 451 DispatchOnCompleted(tab_contents(),
447 url, 452 url,
448 is_main_frame, 453 is_main_frame,
449 frame_id); 454 frame_id);
450 } 455 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_webnavigation_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698