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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_resource_throttle.cc

Issue 11826059: Add ManagedUserService for profile-specific managed user data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win fix Created 7 years, 11 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
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/managed_mode/managed_mode_resource_throttle.h" 5 #include "chrome/browser/managed_mode/managed_mode_resource_throttle.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/managed_mode/managed_mode.h" 8 #include "chrome/browser/managed_mode/managed_mode.h"
9 #include "chrome/browser/managed_mode/managed_mode_interstitial.h" 9 #include "chrome/browser/managed_mode/managed_mode_interstitial.h"
10 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" 10 #include "chrome/browser/managed_mode/managed_mode_url_filter.h"
11 #include "content/public/browser/resource_controller.h" 11 #include "content/public/browser/resource_controller.h"
12 #include "net/url_request/url_request.h" 12 #include "net/url_request/url_request.h"
13 13
14 namespace { 14 namespace {
15 15
16 // This map contains <render_process_host_id_, render_view_id> pairs mapped 16 // This map contains <render_process_host_id_, render_view_id> pairs mapped
17 // to hostnames which identify individual tabs. If a hostname 17 // to hostnames which identify individual tabs. If a hostname
18 // is present for a specific pair then the user clicked preview, is 18 // is present for a specific pair then the user clicked preview, is
19 // navigating around and has not clicked one of the options on the infobar. 19 // navigating around and has not clicked one of the options on the infobar.
20 typedef std::map<std::pair<int, int>, std::string> PreviewMap; 20 typedef std::map<std::pair<int, int>, std::string> PreviewMap;
21 base::LazyInstance<PreviewMap> g_in_preview_mode = LAZY_INSTANCE_INITIALIZER; 21 base::LazyInstance<PreviewMap> g_in_preview_mode = LAZY_INSTANCE_INITIALIZER;
22 22
23 } 23 }
24 24
25 ManagedModeResourceThrottle::ManagedModeResourceThrottle( 25 ManagedModeResourceThrottle::ManagedModeResourceThrottle(
26 const net::URLRequest* request, 26 const net::URLRequest* request,
27 int render_process_host_id, 27 int render_process_host_id,
28 int render_view_id, 28 int render_view_id,
29 bool is_main_frame) 29 bool is_main_frame,
30 const ManagedModeURLFilter* url_filter)
30 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), 31 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
31 request_(request), 32 request_(request),
32 render_process_host_id_(render_process_host_id), 33 render_process_host_id_(render_process_host_id),
33 render_view_id_(render_view_id), 34 render_view_id_(render_view_id),
34 is_main_frame_(is_main_frame), 35 is_main_frame_(is_main_frame),
35 temporarily_allowed_(false), 36 temporarily_allowed_(false),
36 url_filter_(ManagedMode::GetURLFilterForIOThread()) {} 37 url_filter_(url_filter) {}
37 38
38 ManagedModeResourceThrottle::~ManagedModeResourceThrottle() {} 39 ManagedModeResourceThrottle::~ManagedModeResourceThrottle() {}
39 40
40 // static 41 // static
41 void ManagedModeResourceThrottle::AddTemporaryException( 42 void ManagedModeResourceThrottle::AddTemporaryException(
42 int render_process_host_id, 43 int render_process_host_id,
43 int render_view_id, 44 int render_view_id,
44 const GURL& url) { 45 const GURL& url) {
45 g_in_preview_mode.Get()[std::make_pair(render_process_host_id, 46 g_in_preview_mode.Get()[std::make_pair(render_process_host_id,
46 render_view_id)] = url.host(); 47 render_view_id)] = url.host();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 97 }
97 98
98 void ManagedModeResourceThrottle::OnInterstitialResult(bool continue_request) { 99 void ManagedModeResourceThrottle::OnInterstitialResult(bool continue_request) {
99 if (continue_request) { 100 if (continue_request) {
100 temporarily_allowed_ = true; 101 temporarily_allowed_ = true;
101 controller()->Resume(); 102 controller()->Resume();
102 } else { 103 } else {
103 controller()->Cancel(); 104 controller()->Cancel();
104 } 105 }
105 } 106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698