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

Side by Side Diff: chrome/browser/web_resource/resource_request_allowed_notifier.cc

Issue 739173002: Remove dependencies of ResourceRequestAllowedNotifier on chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and cleanup Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/web_resource/resource_request_allowed_notifier.h" 5 #include "chrome/browser/web_resource/resource_request_allowed_notifier.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 9
10 ResourceRequestAllowedNotifier::ResourceRequestAllowedNotifier() 10 ResourceRequestAllowedNotifier::ResourceRequestAllowedNotifier(
11 : observer_requested_permission_(false), 11 PrefService* local_state)
12 : local_state_(local_state),
13 observer_requested_permission_(false),
12 waiting_for_network_(false), 14 waiting_for_network_(false),
13 waiting_for_user_to_accept_eula_(false), 15 waiting_for_user_to_accept_eula_(false),
14 observer_(NULL) { 16 observer_(NULL) {
15 } 17 }
16 18
17 ResourceRequestAllowedNotifier::~ResourceRequestAllowedNotifier() { 19 ResourceRequestAllowedNotifier::~ResourceRequestAllowedNotifier() {
18 if (observer_) 20 if (observer_)
19 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 21 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
20 } 22 }
21 23
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (observer_requested_permission_ && ResourceRequestsAllowed()) { 80 if (observer_requested_permission_ && ResourceRequestsAllowed()) {
79 DVLOG(1) << "Notifying observer of state change."; 81 DVLOG(1) << "Notifying observer of state change.";
80 observer_->OnResourceRequestsAllowed(); 82 observer_->OnResourceRequestsAllowed();
81 // Reset this so the observer is not informed again unless they check 83 // Reset this so the observer is not informed again unless they check
82 // ResourceRequestsAllowed again. 84 // ResourceRequestsAllowed again.
83 observer_requested_permission_ = false; 85 observer_requested_permission_ = false;
84 } 86 }
85 } 87 }
86 88
87 EulaAcceptedNotifier* ResourceRequestAllowedNotifier::CreateEulaNotifier() { 89 EulaAcceptedNotifier* ResourceRequestAllowedNotifier::CreateEulaNotifier() {
88 return EulaAcceptedNotifier::Create(); 90 return EulaAcceptedNotifier::Create(local_state_);
89 } 91 }
90 92
91 void ResourceRequestAllowedNotifier::OnEulaAccepted() { 93 void ResourceRequestAllowedNotifier::OnEulaAccepted() {
92 // This flag should have been set if this was waiting on the EULA 94 // This flag should have been set if this was waiting on the EULA
93 // notification. 95 // notification.
94 DCHECK(waiting_for_user_to_accept_eula_); 96 DCHECK(waiting_for_user_to_accept_eula_);
95 DVLOG(1) << "EULA was accepted."; 97 DVLOG(1) << "EULA was accepted.";
96 waiting_for_user_to_accept_eula_ = false; 98 waiting_for_user_to_accept_eula_ = false;
97 MaybeNotifyObserver(); 99 MaybeNotifyObserver();
98 } 100 }
(...skipping 10 matching lines...) Expand all
109 type != net::NetworkChangeNotifier::CONNECTION_NONE) { 111 type != net::NetworkChangeNotifier::CONNECTION_NONE) {
110 waiting_for_network_ = false; 112 waiting_for_network_ = false;
111 DVLOG(1) << "Network came back online."; 113 DVLOG(1) << "Network came back online.";
112 MaybeNotifyObserver(); 114 MaybeNotifyObserver();
113 } else if (!waiting_for_network_ && 115 } else if (!waiting_for_network_ &&
114 type == net::NetworkChangeNotifier::CONNECTION_NONE) { 116 type == net::NetworkChangeNotifier::CONNECTION_NONE) {
115 waiting_for_network_ = true; 117 waiting_for_network_ = true;
116 DVLOG(1) << "Network went offline."; 118 DVLOG(1) << "Network went offline.";
117 } 119 }
118 } 120 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698