| 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 #ifndef CHROME_BROWSER_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ | 5 #ifndef CHROME_BROWSER_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ |
| 6 #define CHROME_BROWSER_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ | 6 #define CHROME_BROWSER_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/web_resource/eula_accepted_notifier.h" | 8 #include "chrome/browser/web_resource/eula_accepted_notifier.h" |
| 9 #include "net/base/network_change_notifier.h" | 9 #include "net/base/network_change_notifier.h" |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 void Init(Observer* observer); | 48 void Init(Observer* observer); |
| 49 | 49 |
| 50 // Returns true iff all resource request criteria are met. If not, this call | 50 // Returns true iff all resource request criteria are met. If not, this call |
| 51 // will set some flags so it knows to notify the observer if the criteria | 51 // will set some flags so it knows to notify the observer if the criteria |
| 52 // changes. Note that the observer will never be notified unless it calls this | 52 // changes. Note that the observer will never be notified unless it calls this |
| 53 // method first. This is virtual so it can be overridden for tests. | 53 // method first. This is virtual so it can be overridden for tests. |
| 54 virtual bool ResourceRequestsAllowed(); | 54 virtual bool ResourceRequestsAllowed(); |
| 55 | 55 |
| 56 void SetWaitingForNetworkForTesting(bool waiting); | 56 void SetWaitingForNetworkForTesting(bool waiting); |
| 57 void SetWaitingForEulaForTesting(bool waiting); | 57 void SetWaitingForEulaForTesting(bool waiting); |
| 58 void SetObserverRequestedForTesting(bool requested); |
| 58 | 59 |
| 59 protected: | 60 protected: |
| 60 // Notifies the observer if all criteria needed for resource requests are met. | 61 // Notifies the observer if all criteria needed for resource requests are met. |
| 61 // This is protected so it can be called from subclasses for testing. | 62 // This is protected so it can be called from subclasses for testing. |
| 62 void MaybeNotifyObserver(); | 63 void MaybeNotifyObserver(); |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 // Creates the EulaAcceptNotifier or NULL if one is not needed. Virtual so | 66 // Creates the EulaAcceptNotifier or NULL if one is not needed. Virtual so |
| 66 // that it can be overridden by test subclasses. | 67 // that it can be overridden by test subclasses. |
| 67 virtual EulaAcceptedNotifier* CreateEulaNotifier(); | 68 virtual EulaAcceptedNotifier* CreateEulaNotifier(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 87 // Platform-specific notifier of EULA acceptance, or NULL if not needed. | 88 // Platform-specific notifier of EULA acceptance, or NULL if not needed. |
| 88 scoped_ptr<EulaAcceptedNotifier> eula_notifier_; | 89 scoped_ptr<EulaAcceptedNotifier> eula_notifier_; |
| 89 | 90 |
| 90 // Observing service interested in request permissions. | 91 // Observing service interested in request permissions. |
| 91 Observer* observer_; | 92 Observer* observer_; |
| 92 | 93 |
| 93 DISALLOW_COPY_AND_ASSIGN(ResourceRequestAllowedNotifier); | 94 DISALLOW_COPY_AND_ASSIGN(ResourceRequestAllowedNotifier); |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 #endif // CHROME_BROWSER_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ | 97 #endif // CHROME_BROWSER_WEB_RESOURCE_RESOURCE_REQUEST_ALLOWED_NOTIFIER_H_ |
| OLD | NEW |