| OLD | NEW |
| 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 "components/web_resource/resource_request_allowed_notifier.h" | 5 #include "components/web_resource/resource_request_allowed_notifier.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 | 8 |
| 9 namespace web_resource { | 9 namespace web_resource { |
| 10 | 10 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 eula_notifier_.reset(CreateEulaNotifier()); | 37 eula_notifier_.reset(CreateEulaNotifier()); |
| 38 if (eula_notifier_) { | 38 if (eula_notifier_) { |
| 39 eula_notifier_->Init(this); | 39 eula_notifier_->Init(this); |
| 40 waiting_for_user_to_accept_eula_ = !eula_notifier_->IsEulaAccepted(); | 40 waiting_for_user_to_accept_eula_ = !eula_notifier_->IsEulaAccepted(); |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| 44 ResourceRequestAllowedNotifier::State | 44 ResourceRequestAllowedNotifier::State |
| 45 ResourceRequestAllowedNotifier::GetResourceRequestsAllowedState() { | 45 ResourceRequestAllowedNotifier::GetResourceRequestsAllowedState() { |
| 46 if (disable_network_switch_ && | 46 if (disable_network_switch_ && |
| 47 CommandLine::ForCurrentProcess()->HasSwitch(disable_network_switch_)) { | 47 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 48 disable_network_switch_)) { |
| 48 return DISALLOWED_COMMAND_LINE_DISABLED; | 49 return DISALLOWED_COMMAND_LINE_DISABLED; |
| 49 } | 50 } |
| 50 | 51 |
| 51 // The observer requested permission. Return the current criteria state and | 52 // The observer requested permission. Return the current criteria state and |
| 52 // set a flag to remind this class to notify the observer once the criteria | 53 // set a flag to remind this class to notify the observer once the criteria |
| 53 // is met. | 54 // is met. |
| 54 observer_requested_permission_ = waiting_for_user_to_accept_eula_ || | 55 observer_requested_permission_ = waiting_for_user_to_accept_eula_ || |
| 55 waiting_for_network_; | 56 waiting_for_network_; |
| 56 if (!observer_requested_permission_) | 57 if (!observer_requested_permission_) |
| 57 return ALLOWED; | 58 return ALLOWED; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 DVLOG(1) << "Network came back online."; | 116 DVLOG(1) << "Network came back online."; |
| 116 MaybeNotifyObserver(); | 117 MaybeNotifyObserver(); |
| 117 } else if (!waiting_for_network_ && | 118 } else if (!waiting_for_network_ && |
| 118 type == net::NetworkChangeNotifier::CONNECTION_NONE) { | 119 type == net::NetworkChangeNotifier::CONNECTION_NONE) { |
| 119 waiting_for_network_ = true; | 120 waiting_for_network_ = true; |
| 120 DVLOG(1) << "Network went offline."; | 121 DVLOG(1) << "Network went offline."; |
| 121 } | 122 } |
| 122 } | 123 } |
| 123 | 124 |
| 124 } // namespace web_resource | 125 } // namespace web_resource |
| OLD | NEW |