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

Side by Side Diff: chrome/browser/chromeos/login/version_info_updater.h

Issue 2876753003: Bootstrapping: Display Bluetooth name of CrOS device on OOBE screen. (Closed)
Patch Set: Address achuith@'s comments. 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/version_info_updater.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/chromeos/settings/cros_settings.h" 14 #include "chrome/browser/chromeos/settings/cros_settings.h"
15 #include "chromeos/system/version_loader.h" 15 #include "chromeos/system/version_loader.h"
16 #include "components/policy/core/common/cloud/cloud_policy_store.h" 16 #include "components/policy/core/common/cloud/cloud_policy_store.h"
17 17
18 namespace device {
19 class BluetoothAdapter;
20 }
21
18 namespace chromeos { 22 namespace chromeos {
19 23
20 class CrosSettings; 24 class CrosSettings;
21 25
22 // Fetches all info we want to show on OOBE/Login screens about system 26 // Fetches all info we want to show on OOBE/Login screens about system
23 // version, boot times and cloud policy. 27 // version, boot times and cloud policy.
24 class VersionInfoUpdater : public policy::CloudPolicyStore::Observer { 28 class VersionInfoUpdater : public policy::CloudPolicyStore::Observer {
25 public: 29 public:
26 class Delegate { 30 class Delegate {
27 public: 31 public:
28 virtual ~Delegate() {} 32 virtual ~Delegate() {}
29 33
30 // Called when OS version label should be updated. 34 // Called when OS version label should be updated.
31 virtual void OnOSVersionLabelTextUpdated( 35 virtual void OnOSVersionLabelTextUpdated(
32 const std::string& os_version_label_text) = 0; 36 const std::string& os_version_label_text) = 0;
33 37
34 // Called when the enterprise info notice should be updated. 38 // Called when the enterprise info notice should be updated.
35 virtual void OnEnterpriseInfoUpdated(const std::string& enterprise_info, 39 virtual void OnEnterpriseInfoUpdated(const std::string& enterprise_info,
36 const std::string& asset_id) = 0; 40 const std::string& asset_id) = 0;
41
42 // Called when the device info should be updated.
43 virtual void OnDeviceInfoUpdated(const std::string& bluetooth_name) = 0;
37 }; 44 };
38 45
39 explicit VersionInfoUpdater(Delegate* delegate); 46 explicit VersionInfoUpdater(Delegate* delegate);
40 ~VersionInfoUpdater() override; 47 ~VersionInfoUpdater() override;
41 48
42 // Sets delegate. 49 // Sets delegate.
43 void set_delegate(Delegate* delegate) { delegate_ = delegate; } 50 void set_delegate(Delegate* delegate) { delegate_ = delegate; }
44 51
45 // Starts fetching version info. The delegate will be notified when update 52 // Starts fetching version info. The delegate will be notified when update
46 // is received. 53 // is received.
(...skipping 13 matching lines...) Expand all
60 // Set enterprise domain name and device asset ID. 67 // Set enterprise domain name and device asset ID.
61 void SetEnterpriseInfo(const std::string& domain_name, 68 void SetEnterpriseInfo(const std::string& domain_name,
62 const std::string& asset_id); 69 const std::string& asset_id);
63 70
64 // Creates a serial number string. 71 // Creates a serial number string.
65 void UpdateSerialNumberInfo(); 72 void UpdateSerialNumberInfo();
66 73
67 // Callback from chromeos::VersionLoader giving the version. 74 // Callback from chromeos::VersionLoader giving the version.
68 void OnVersion(const std::string& version); 75 void OnVersion(const std::string& version);
69 76
77 // Callback from device::BluetoothAdapterFactory::GetAdapter.
78 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
79
70 // Information pieces for version label. 80 // Information pieces for version label.
71 std::string version_text_; 81 std::string version_text_;
72 std::string serial_number_text_; 82 std::string serial_number_text_;
73 83
74 // Full text for the OS version label. 84 // Full text for the OS version label.
75 std::string os_version_label_text_; 85 std::string os_version_label_text_;
76 86
77 std::vector<std::unique_ptr<CrosSettings::ObserverSubscription>> 87 std::vector<std::unique_ptr<CrosSettings::ObserverSubscription>>
78 subscriptions_; 88 subscriptions_;
79 89
80 chromeos::CrosSettings* cros_settings_; 90 chromeos::CrosSettings* cros_settings_;
81 91
82 Delegate* delegate_; 92 Delegate* delegate_;
83 93
84 // Weak pointer factory so we can give our callbacks for invocation 94 // Weak pointer factory so we can give our callbacks for invocation
85 // at a later time without worrying that they will actually try to 95 // at a later time without worrying that they will actually try to
86 // happen after the lifetime of this object. 96 // happen after the lifetime of this object.
87 base::WeakPtrFactory<VersionInfoUpdater> weak_pointer_factory_; 97 base::WeakPtrFactory<VersionInfoUpdater> weak_pointer_factory_;
88 98
89 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater); 99 DISALLOW_COPY_AND_ASSIGN(VersionInfoUpdater);
90 }; 100 };
91 101
92 } // namespace chromeos 102 } // namespace chromeos
93 103
94 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_ 104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_VERSION_INFO_UPDATER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/version_info_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698