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

Unified Diff: chrome/browser/managed_mode/managed_mode_resource_throttle.cc

Issue 13533017: Fix managed mode allow/block flow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename variable Created 7 years, 8 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/managed_mode/managed_mode_resource_throttle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/managed_mode/managed_mode_resource_throttle.cc
diff --git a/chrome/browser/managed_mode/managed_mode_resource_throttle.cc b/chrome/browser/managed_mode/managed_mode_resource_throttle.cc
index 654dca87238706fd85cb246e2bcd03e2ce67ea5b..a429a82797540ad700f0286bc79bfca529114b2a 100644
--- a/chrome/browser/managed_mode/managed_mode_resource_throttle.cc
+++ b/chrome/browser/managed_mode/managed_mode_resource_throttle.cc
@@ -29,19 +29,11 @@ struct WebContentsId {
int render_view_id;
};
-struct TemporaryExceptionData {
- // Hostname for which the temporary exception was added.
- std::string host;
- // Whether the user initiated a new navigation or not.
- bool new_navigation;
-};
-
// This map contains <render_process_host_id_, render_view_id> pairs mapped
-// to |TemporaryExceptionData| which identifies individual tabs. If a
-// |TemporaryExceptionData| is present for a specific pair then the user
-// clicked preview, is navigating around and has not clicked one of the options
-// on the infobar.
-typedef std::map<WebContentsId, TemporaryExceptionData> PreviewMap;
+// to a host string which identifies individual tabs. If a host is present for
+// a specific pair then the user clicked preview, is navigating around and has
+// not clicked one of the options on the infobar.
+typedef std::map<WebContentsId, std::string> PreviewMap;
base::LazyInstance<PreviewMap> g_in_preview_mode = LAZY_INSTANCE_INITIALIZER;
}
@@ -66,27 +58,9 @@ ManagedModeResourceThrottle::~ManagedModeResourceThrottle() {}
void ManagedModeResourceThrottle::AddTemporaryException(
int render_process_host_id,
int render_view_id,
- const GURL& url,
- bool new_navigation) {
- TemporaryExceptionData data;
- data.host = url.host();
- data.new_navigation = new_navigation;
- WebContentsId web_contents_id(render_process_host_id, render_view_id);
- g_in_preview_mode.Get()[web_contents_id] = data;
-}
-
-// static
-void ManagedModeResourceThrottle::UpdateExceptionNavigationStatus(
- int render_process_host_id,
- int render_view_id,
- bool new_navigation) {
- PreviewMap* preview_map = g_in_preview_mode.Pointer();
+ const GURL& url) {
WebContentsId web_contents_id(render_process_host_id, render_view_id);
- PreviewMap::iterator it = preview_map->find(web_contents_id);
- if (it == preview_map->end())
- return;
-
- it->second.new_navigation = new_navigation;
+ g_in_preview_mode.Get()[web_contents_id] = url.host();
}
// static
@@ -119,8 +93,7 @@ void ManagedModeResourceThrottle::ShowInterstitialIfNeeded(bool is_redirect,
WebContentsId web_contents_id(render_process_host_id_, render_view_id_);
PreviewMap::iterator it = preview_map->find(web_contents_id);
- if (it != preview_map->end() &&
- (!it->second.new_navigation || url.host() == it->second.host)) {
+ if (it != preview_map->end() && url.host() == it->second) {
temporarily_allowed_ = true;
RemoveTemporaryException(render_process_host_id_, render_view_id_);
return;
« no previous file with comments | « chrome/browser/managed_mode/managed_mode_resource_throttle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698