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

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

Issue 24197002: Don't send the oncompleted signal twice in the webnavigation API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/test/data/extensions/api_test/webnavigation/history/c.html » ('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) 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/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 SendErrorEvents( 440 SendErrorEvents(
441 web_contents(), render_view_host_, FrameNavigationState::FrameID()); 441 web_contents(), render_view_host_, FrameNavigationState::FrameID());
442 render_view_host_ = pending_render_view_host_; 442 render_view_host_ = pending_render_view_host_;
443 pending_render_view_host_ = NULL; 443 pending_render_view_host_ = NULL;
444 } 444 }
445 445
446 // Update the URL as it might have changed. 446 // Update the URL as it might have changed.
447 navigation_state_.UpdateFrame(frame_id, url); 447 navigation_state_.UpdateFrame(frame_id, url);
448 navigation_state_.SetNavigationCommitted(frame_id); 448 navigation_state_.SetNavigationCommitted(frame_id);
449 449
450 if (is_reference_fragment_navigation || is_history_state_modification)
451 navigation_state_.SetNavigationCompleted(frame_id);
452
453 if (!navigation_state_.CanSendEvents(frame_id)) 450 if (!navigation_state_.CanSendEvents(frame_id))
454 return; 451 return;
455 452
456 if (is_reference_fragment_navigation) { 453 if (is_reference_fragment_navigation) {
457 helpers::DispatchOnCommitted( 454 helpers::DispatchOnCommitted(
458 web_navigation::OnReferenceFragmentUpdated::kEventName, 455 web_navigation::OnReferenceFragmentUpdated::kEventName,
459 web_contents(), 456 web_contents(),
460 frame_num, 457 frame_num,
461 is_main_frame, 458 is_main_frame,
462 navigation_state_.GetUrl(frame_id), 459 navigation_state_.GetUrl(frame_id),
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 855 }
859 856
860 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { 857 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) {
861 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); 858 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_));
862 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 859 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
863 } 860 }
864 861
865 #endif // OS_ANDROID 862 #endif // OS_ANDROID
866 863
867 } // namespace extensions 864 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/webnavigation/history/c.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698