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

Unified Diff: chrome/browser/extensions/api/web_navigation/frame_navigation_state.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
Index: chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc
diff --git a/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc b/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc
index 37764cb0064a8f70f43de14d1849aebcb8ec84b3..63565374839b9084a4a235e94f4923bee341e59f 100644
--- a/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc
+++ b/chrome/browser/extensions/api/web_navigation/frame_navigation_state.cc
@@ -37,17 +37,8 @@ FrameNavigationState::FrameNavigationState() {
FrameNavigationState::~FrameNavigationState() {}
-bool FrameNavigationState::CanSendEvents(
- content::RenderFrameHost* frame_host) const {
- FrameHostToStateMap::const_iterator it =
- frame_host_state_map_.find(frame_host);
- if (it == frame_host_state_map_.end() || it->second.error_occurred) {
- return false;
- }
- return IsValidUrl(it->second.url);
-}
-
-bool FrameNavigationState::IsValidUrl(const GURL& url) const {
+// static
+bool FrameNavigationState::IsValidUrl(const GURL& url) {
for (unsigned i = 0; i < arraysize(kValidSchemes); ++i) {
if (url.scheme() == kValidSchemes[i])
return true;
@@ -60,6 +51,16 @@ bool FrameNavigationState::IsValidUrl(const GURL& url) const {
return allow_extension_scheme_ && url.scheme() == kExtensionScheme;
}
+bool FrameNavigationState::CanSendEvents(
+ content::RenderFrameHost* frame_host) const {
+ FrameHostToStateMap::const_iterator it =
+ frame_host_state_map_.find(frame_host);
+ if (it == frame_host_state_map_.end() || it->second.error_occurred) {
+ return false;
+ }
+ return IsValidUrl(it->second.url);
+}
+
void FrameNavigationState::StartTrackingNavigation(
content::RenderFrameHost* frame_host,
const GURL& url,

Powered by Google App Engine
This is Rietveld 408576698