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

Side by Side 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: 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 unified diff | Download patch
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 #include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h" 5 #include "chrome/browser/extensions/api/web_navigation/frame_navigation_state.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
(...skipping 29 matching lines...) Expand all
40 bool FrameNavigationState::CanSendEvents( 40 bool FrameNavigationState::CanSendEvents(
41 content::RenderFrameHost* frame_host) const { 41 content::RenderFrameHost* frame_host) const {
42 FrameHostToStateMap::const_iterator it = 42 FrameHostToStateMap::const_iterator it =
43 frame_host_state_map_.find(frame_host); 43 frame_host_state_map_.find(frame_host);
44 if (it == frame_host_state_map_.end() || it->second.error_occurred) { 44 if (it == frame_host_state_map_.end() || it->second.error_occurred) {
45 return false; 45 return false;
46 } 46 }
47 return IsValidUrl(it->second.url); 47 return IsValidUrl(it->second.url);
48 } 48 }
49 49
50 bool FrameNavigationState::IsValidUrl(const GURL& url) const { 50 // static
51 bool FrameNavigationState::IsValidUrl(const GURL& url) {
51 for (unsigned i = 0; i < arraysize(kValidSchemes); ++i) { 52 for (unsigned i = 0; i < arraysize(kValidSchemes); ++i) {
52 if (url.scheme() == kValidSchemes[i]) 53 if (url.scheme() == kValidSchemes[i])
53 return true; 54 return true;
54 } 55 }
55 // Allow about:blank and about:srcdoc. 56 // Allow about:blank and about:srcdoc.
56 if (url.spec() == url::kAboutBlankURL || 57 if (url.spec() == url::kAboutBlankURL ||
57 url.spec() == content::kAboutSrcDocURL) { 58 url.spec() == content::kAboutSrcDocURL) {
58 return true; 59 return true;
59 } 60 }
60 return allow_extension_scheme_ && url.scheme() == kExtensionScheme; 61 return allow_extension_scheme_ && url.scheme() == kExtensionScheme;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 199
199 bool FrameNavigationState::GetIsServerRedirected( 200 bool FrameNavigationState::GetIsServerRedirected(
200 content::RenderFrameHost* frame_host) const { 201 content::RenderFrameHost* frame_host) const {
201 FrameHostToStateMap::const_iterator it = 202 FrameHostToStateMap::const_iterator it =
202 frame_host_state_map_.find(frame_host); 203 frame_host_state_map_.find(frame_host);
203 DCHECK(it != frame_host_state_map_.end()); 204 DCHECK(it != frame_host_state_map_.end());
204 return it != frame_host_state_map_.end() && it->second.is_server_redirected; 205 return it != frame_host_state_map_.end() && it->second.is_server_redirected;
205 } 206 }
206 207
207 } // namespace extensions 208 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698