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

Unified Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 1140023002: Code Refactor and making function static in frame_navigation_state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
index aa6c568538fcbefa86173414d18b4e8aa8d898da..d5a9dda60d5eb8b242c75b87cad0ba321f436833 100644
--- a/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
+++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api.cc
@@ -122,11 +122,8 @@ void WebNavigationEventRouter::TabReplacedAt(
DCHECK(GetViewType(old_contents) != VIEW_TYPE_TAB_CONTENTS);
return;
}
- const FrameNavigationState& frame_navigation_state =
- tab_observer->frame_navigation_state();
-
- if (!frame_navigation_state.IsValidUrl(old_contents->GetURL()) ||
- !frame_navigation_state.IsValidUrl(new_contents->GetURL()))
+ if (!FrameNavigationState::IsValidUrl(old_contents->GetURL()) ||
+ !FrameNavigationState::IsValidUrl(new_contents->GetURL()))
return;
helpers::DispatchOnTabReplaced(old_contents, profile_, new_contents);
@@ -322,31 +319,21 @@ void WebNavigationTabObserver::DidCommitProvisionalLoadForFrame(
if (!navigation_state_.CanSendEvents(render_frame_host))
return;
+ std::string event_name;
if (is_reference_fragment_navigation) {
- helpers::DispatchOnCommitted(
- web_navigation::OnReferenceFragmentUpdated::kEventName,
- web_contents(),
- render_frame_host,
- navigation_state_.GetUrl(render_frame_host),
- transition_type);
+ event_name = web_navigation::OnReferenceFragmentUpdated::kEventName;
} else if (is_history_state_modification) {
- helpers::DispatchOnCommitted(
- web_navigation::OnHistoryStateUpdated::kEventName,
- web_contents(),
- render_frame_host,
- navigation_state_.GetUrl(render_frame_host),
- transition_type);
+ event_name = web_navigation::OnHistoryStateUpdated::kEventName;
} else {
if (navigation_state_.GetIsServerRedirected(render_frame_host)) {
transition_type = ui::PageTransitionFromInt(
transition_type | ui::PAGE_TRANSITION_SERVER_REDIRECT);
}
- helpers::DispatchOnCommitted(web_navigation::OnCommitted::kEventName,
- web_contents(),
- render_frame_host,
- navigation_state_.GetUrl(render_frame_host),
- transition_type);
+ event_name = web_navigation::OnCommitted::kEventName;
}
+ helpers::DispatchOnCommitted(event_name, web_contents(), render_frame_host,
+ navigation_state_.GetUrl(render_frame_host),
+ transition_type);
}
void WebNavigationTabObserver::DidFailProvisionalLoad(
« no previous file with comments | « chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698