| Index: chrome/browser/resource_request_allowed_notifier.cc
|
| diff --git a/chrome/browser/resource_request_allowed_notifier.cc b/chrome/browser/resource_request_allowed_notifier.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..96095812b91f027a8b5445b88eeceeb4747fd1e2
|
| --- /dev/null
|
| +++ b/chrome/browser/resource_request_allowed_notifier.cc
|
| @@ -0,0 +1,58 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/resource_request_allowed_notifier.h"
|
| +#include "chrome/common/chrome_notification_types.h"
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| +#include "chrome/browser/chromeos/login/wizard_controller.h"
|
| +#endif
|
| +
|
| +ResourceRequestAllowedNotifier::ResourceRequestAllowedNotifier() {
|
| + net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
|
| +}
|
| +
|
| +ResourceRequestAllowedNotifier::~ResourceRequestAllowedNotifier() {
|
| + net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
|
| +}
|
| +
|
| +void ResourceRequestAllowedNotifier::AddObserver(Observer* observer) {
|
| + observer_list_.AddObserver(observer);
|
| +}
|
| +
|
| +void ResourceRequestAllowedNotifier::RemoveObserver(Observer* observer) {
|
| + observer_list_.RemoveObserver(observer);
|
| +}
|
| +
|
| +// static
|
| +bool ResourceRequestAllowedNotifier::IsNetworkOffline() {
|
| + return net::NetworkChangeNotifier::IsOffline();
|
| +}
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| +// static
|
| +bool ResourceRequestAllowedNotifier::IsEulaAccepted() {
|
| + return chromeos::WizardController::IsEulaAccepted();
|
| +}
|
| +
|
| +void ResourceRequestAllowedNotifier::Observe(
|
| + int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) {
|
| + DCHECK(type == chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED);
|
| +
|
| + // Pass the message on to the observers.
|
| + FOR_EACH_OBSERVER(Observer, observer_list_, OnEulaAccepted());
|
| +}
|
| +#endif
|
| +
|
| +// net::NetworkChangeNotifier::ConnectionTypeObserver implementation.
|
| +void ResourceRequestAllowedNotifier::OnConnectionTypeChanged(
|
| + net::NetworkChangeNotifier::ConnectionType type) {
|
| + if (type != net::NetworkChangeNotifier::CONNECTION_NONE) {
|
| + FOR_EACH_OBSERVER(Observer,
|
| + observer_list_,
|
| + OnNetworkChangedToActiveConnection());
|
| + }
|
| +}
|
|
|