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

Side by Side Diff: chrome/browser/chromeos/tether/tether_service.h

Issue 2900903002: Create a FakeTetherService, which stubs out TetherService for development. (Closed)
Patch Set: Rebase. Created 3 years, 7 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_CHROMEOS_TETHER_TETHER_SERVICE_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_ 6 #define CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 29 matching lines...) Expand all
40 ~TetherService() override; 40 ~TetherService() override;
41 41
42 // Gets TetherService instance. 42 // Gets TetherService instance.
43 static TetherService* Get(Profile* profile); 43 static TetherService* Get(Profile* profile);
44 44
45 static void RegisterProfilePrefs(PrefRegistrySimple* registry); 45 static void RegisterProfilePrefs(PrefRegistrySimple* registry);
46 46
47 // Attempt to start the Tether module. Only succeeds if all conditions to 47 // Attempt to start the Tether module. Only succeeds if all conditions to
48 // reach chromeos::NetworkStateHandler::TechnologyState::ENABLED are reached. 48 // reach chromeos::NetworkStateHandler::TechnologyState::ENABLED are reached.
49 // Should only be called once a user is logged in. 49 // Should only be called once a user is logged in.
50 void StartTetherIfEnabled(); 50 virtual void StartTetherIfEnabled();
51 51
52 // Stop the Tether module. 52 // Stop the Tether module.
53 void StopTether(); 53 virtual void StopTether();
54 54
55 protected: 55 protected:
56 // KeyedService: 56 // KeyedService:
57 void Shutdown() override; 57 void Shutdown() override;
58 58
59 // chromeos::PowerManagerClient::Observer: 59 // chromeos::PowerManagerClient::Observer:
60 void SuspendImminent() override; 60 void SuspendImminent() override;
61 void SuspendDone(const base::TimeDelta& sleep_duration) override; 61 void SuspendDone(const base::TimeDelta& sleep_duration) override;
62 62
63 // chromeos::SessionManagerClient::Observer: 63 // chromeos::SessionManagerClient::Observer:
64 void ScreenIsLocked() override; 64 void ScreenIsLocked() override;
65 void ScreenIsUnlocked() override; 65 void ScreenIsUnlocked() override;
66 66
67 // cryptauth::CryptAuthDeviceManager::Observer 67 // cryptauth::CryptAuthDeviceManager::Observer
68 void OnSyncFinished(cryptauth::CryptAuthDeviceManager::SyncResult sync_result, 68 void OnSyncFinished(cryptauth::CryptAuthDeviceManager::SyncResult sync_result,
69 cryptauth::CryptAuthDeviceManager::DeviceChangeResult 69 cryptauth::CryptAuthDeviceManager::DeviceChangeResult
70 device_change_result) override; 70 device_change_result) override;
71 71
72 // device::BluetoothAdapter::Observer: 72 // device::BluetoothAdapter::Observer:
73 void AdapterPoweredChanged(device::BluetoothAdapter* adapter, 73 void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
74 bool powered) override; 74 bool powered) override;
75 75
76 // chromeos::NetworkStateHandlerObserver: 76 // chromeos::NetworkStateHandlerObserver:
77 void DeviceListChanged() override; 77 void DeviceListChanged() override;
78 78
79 // Callback when the controlling pref changes. 79 // Callback when the controlling pref changes.
80 void OnPrefsChanged(); 80 void OnPrefsChanged();
81 81
82 // Whether Tether hosts are available.
83 virtual bool HasSyncedTetherHosts() const;
84
82 virtual void UpdateTetherTechnologyState(); 85 virtual void UpdateTetherTechnologyState();
86 chromeos::NetworkStateHandler::TechnologyState GetTetherTechnologyState();
87
88 chromeos::NetworkStateHandler* network_state_handler() {
89 return network_state_handler_;
90 }
83 91
84 private: 92 private:
85 friend class TetherServiceTest; 93 friend class TetherServiceTest;
86 94
87 chromeos::NetworkStateHandler::TechnologyState GetTetherTechnologyState();
88
89 void OnBluetoothAdapterFetched( 95 void OnBluetoothAdapterFetched(
90 scoped_refptr<device::BluetoothAdapter> adapter); 96 scoped_refptr<device::BluetoothAdapter> adapter);
91 97
92 bool IsBluetoothAvailable() const; 98 bool IsBluetoothAvailable() const;
93 99
94 // Whether Tether hosts are available.
95 bool HasSyncedTetherHosts() const;
96
97 // Whether the Tether feature has been enabled via an about or command line 100 // Whether the Tether feature has been enabled via an about or command line
98 // flag. 101 // flag.
99 bool IsFeatureFlagEnabled() const; 102 bool IsFeatureFlagEnabled() const;
100 103
101 // Whether Tether is allowed to be used. If the controlling preference 104 // Whether Tether is allowed to be used. If the controlling preference
102 // is set (from policy), this returns the preference value. Otherwise, it is 105 // is set (from policy), this returns the preference value. Otherwise, it is
103 // permitted if the flag is enabled. 106 // permitted if the flag is enabled.
104 bool IsAllowedByPolicy() const; 107 bool IsAllowedByPolicy() const;
105 108
106 // Whether Tether is enabled. 109 // Whether Tether is enabled.
(...skipping 14 matching lines...) Expand all
121 124
122 PrefChangeRegistrar registrar_; 125 PrefChangeRegistrar registrar_;
123 scoped_refptr<device::BluetoothAdapter> adapter_; 126 scoped_refptr<device::BluetoothAdapter> adapter_;
124 127
125 base::WeakPtrFactory<TetherService> weak_ptr_factory_; 128 base::WeakPtrFactory<TetherService> weak_ptr_factory_;
126 129
127 DISALLOW_COPY_AND_ASSIGN(TetherService); 130 DISALLOW_COPY_AND_ASSIGN(TetherService);
128 }; 131 };
129 132
130 #endif // CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_ 133 #endif // CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698