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

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

Issue 10917120: Activate the VariationsService for ChromeOS and ensure that it does not ping the server until the E… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Refactored to use ResourceRequestAllowedNotifier Created 8 years, 3 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/resource_request_allowed_notifier.h"
6 #include "chrome/common/chrome_notification_types.h"
7
8 #if defined(OS_CHROMEOS)
9 #include "chrome/browser/chromeos/login/wizard_controller.h"
10 #endif
11
12 ResourceRequestAllowedNotifier::ResourceRequestAllowedNotifier() {
13 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
14 }
15
16 ResourceRequestAllowedNotifier::~ResourceRequestAllowedNotifier() {
17 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
18 }
19
20 void ResourceRequestAllowedNotifier::AddObserver(Observer* observer) {
21 observer_list_.AddObserver(observer);
22 }
23
24 void ResourceRequestAllowedNotifier::RemoveObserver(Observer* observer) {
25 observer_list_.RemoveObserver(observer);
26 }
27
28 // static
29 bool ResourceRequestAllowedNotifier::IsNetworkOffline() {
30 return net::NetworkChangeNotifier::IsOffline();
31 }
32
33 #if defined(OS_CHROMEOS)
34 // static
35 bool ResourceRequestAllowedNotifier::IsEulaAccepted() {
36 return chromeos::WizardController::IsEulaAccepted();
37 }
38
39 void ResourceRequestAllowedNotifier::Observe(
40 int type,
41 const content::NotificationSource& source,
42 const content::NotificationDetails& details) {
43 DCHECK(type == chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED);
44
45 // Pass the message on to the observers.
46 FOR_EACH_OBSERVER(Observer, observer_list_, OnEulaAccepted());
47 }
48 #endif
49
50 // net::NetworkChangeNotifier::ConnectionTypeObserver implementation.
51 void ResourceRequestAllowedNotifier::OnConnectionTypeChanged(
52 net::NetworkChangeNotifier::ConnectionType type) {
53 if (type != net::NetworkChangeNotifier::CONNECTION_NONE) {
54 FOR_EACH_OBSERVER(Observer,
55 observer_list_,
56 OnNetworkChangedToActiveConnection());
57 }
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698