| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ |
| 6 #define CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ | 6 #define CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "net/base/network_change_notifier.h" | 9 #include "net/base/network_change_notifier.h" |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // If ResourceRequestsAllowed returns true the first time, | 29 // If ResourceRequestsAllowed returns true the first time, |
| 30 // ResourceRequestAllowedNotifier will not notify the service in the future. | 30 // ResourceRequestAllowedNotifier will not notify the service in the future. |
| 31 // | 31 // |
| 32 // Note that this class handles the criteria state for a single service, so | 32 // Note that this class handles the criteria state for a single service, so |
| 33 // services should keep their own instance of this class rather than sharing a | 33 // services should keep their own instance of this class rather than sharing a |
| 34 // global instance. | 34 // global instance. |
| 35 class ResourceRequestAllowedNotifier : | 35 class ResourceRequestAllowedNotifier : |
| 36 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
| 37 public content::NotificationObserver, | 37 public content::NotificationObserver, |
| 38 #endif | 38 #endif |
| 39 public net::NetworkChangeNotifier::ConnectionTypeObserver { | 39 public net::NetworkChangeNotifier::NetworkChangeObserver { |
| 40 public: | 40 public: |
| 41 // Observes resource request allowed state changes. | 41 // Observes resource request allowed state changes. |
| 42 class Observer { | 42 class Observer { |
| 43 public: | 43 public: |
| 44 virtual void OnResourceRequestsAllowed() = 0; | 44 virtual void OnResourceRequestsAllowed() = 0; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 ResourceRequestAllowedNotifier(); | 47 ResourceRequestAllowedNotifier(); |
| 48 virtual ~ResourceRequestAllowedNotifier(); | 48 virtual ~ResourceRequestAllowedNotifier(); |
| 49 | 49 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 // always returns false on unofficial builds since there is no notion of a | 74 // always returns false on unofficial builds since there is no notion of a |
| 75 // EULA. | 75 // EULA. |
| 76 // | 76 // |
| 77 // This is virtual so it can be overriden by test classes to avoid making them | 77 // This is virtual so it can be overriden by test classes to avoid making them |
| 78 // aware of the ChromeOS details. This is protected so it call be overriden in | 78 // aware of the ChromeOS details. This is protected so it call be overriden in |
| 79 // subclasses for testing. | 79 // subclasses for testing. |
| 80 virtual bool NeedsEulaAcceptance(); | 80 virtual bool NeedsEulaAcceptance(); |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides: | 84 // net::NetworkChangeNotifier::NetworkChangeObserver overrides: |
| 85 virtual void OnConnectionTypeChanged( | 85 virtual void OnNetworkChanged( |
| 86 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; | 86 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
| 87 | 87 |
| 88 #if defined(OS_CHROMEOS) | 88 #if defined(OS_CHROMEOS) |
| 89 // content::NotificationObserver overrides: | 89 // content::NotificationObserver overrides: |
| 90 virtual void Observe(int type, | 90 virtual void Observe(int type, |
| 91 const content::NotificationSource& source, | 91 const content::NotificationSource& source, |
| 92 const content::NotificationDetails& details) OVERRIDE; | 92 const content::NotificationDetails& details) OVERRIDE; |
| 93 #endif | 93 #endif |
| 94 | 94 |
| 95 // Tracks whether or not the observer/service depending on this class actually | 95 // Tracks whether or not the observer/service depending on this class actually |
| (...skipping 12 matching lines...) Expand all Loading... |
| 108 content::NotificationRegistrar registrar_; | 108 content::NotificationRegistrar registrar_; |
| 109 #endif | 109 #endif |
| 110 | 110 |
| 111 // Observing service interested in request permissions. | 111 // Observing service interested in request permissions. |
| 112 Observer* observer_; | 112 Observer* observer_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(ResourceRequestAllowedNotifier); | 114 DISALLOW_COPY_AND_ASSIGN(ResourceRequestAllowedNotifier); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 #endif // CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H
_ | 117 #endif // CHROME_BROWSER_METRICS_VARIATIONS_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H
_ |
| OLD | NEW |