diff options
| author | ers@chromium.org <ers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 05:57:21 +0000 |
|---|---|---|
| committer | ers@chromium.org <ers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-11 05:57:21 +0000 |
| commit | e905c86be9a28558e4e165bcf501d20010771e80 (patch) | |
| tree | 9b78e3e371aee0f594204b8115ccaa1308784853 | |
| parent | 76dab22be9e8757b38c577d256a798ce4bd67ab4 (diff) | |
| download | chromium_src-e905c86be9a28558e4e165bcf501d20010771e80.zip chromium_src-e905c86be9a28558e4e165bcf501d20010771e80.tar.gz chromium_src-e905c86be9a28558e4e165bcf501d20010771e80.tar.bz2 | |
Merge 84926 - chromeos: refetch device properties when cellular modem powers on.
When the system starts up, chrome fetches the device properties for
all network devices. However, for cellular devices, many of the
Cellular.XXX properties don't become defined until the modem is
enabled. Since chrome doesn't refetch the properties, nor are any
property change signals sent out from flimflam for these properties
(because generally speaking they are ones that don't change),
chrome's cached copies are empty. The result is that when the Device
tab is brought up in the internet settings page, all the fields are
blank.
Chrome now refetches device properties when it sees the value of
the Powered property change.
Also, I removed the LastUpdate item from the device tab. That property
hasn't existed in flimflam for several months.
BUG=chromium-os:14180
TEST=To demonstrate the problem without this fix, reboot the machine,
go to internet settings, click "Options" for the cellular service,
and go to the device tab. The fields should be blank. Log out and
log back in, and the fields in the device tab should be populated,
because chrome restarted and thus fetched the properties again. With
this fix in place, the fields should be populated first time, every
time.
R=nkostylev@chromium.org,zel@chromium.org
Review URL: http://codereview.chromium.org/6903080
TBR=ers@chromium.org
Review URL: http://codereview.chromium.org/7005024
git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@84937 0039d316-1c4b-4281-b951-d872f2087c98
6 files changed, 20 insertions, 29 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index e2c57f8..8be9436 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -10412,9 +10412,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_HARDWARE_REVISION" desc="Cellular device hardware revision label under network details in chrome:settings/internet."> Hardware: </message> - <message name="IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_LAST_UPDATE" desc="Cellular device last updated label under network details in chrome:settings/internet."> - Last updated: - </message> <message name="IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_PRL_VERSION" desc="Cellular device PRL version label under network details in chrome:settings/internet."> PRL version: </message> @@ -11599,9 +11596,6 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_HARDWARE_REVISION" desc="Label for cellular network modem hardware revision under chrome://options/internet"> Hardware revision: </message> - <message name="IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_LAST_UPDATE" desc="Label for cellular network modem last update time under chrome://options/internet"> - Last update: - </message> <message name="IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_PRL_VERSION" desc="Label for cellular network modem PRL (Preferred Roaming List) version under chrome://options/internet"> PRL version: </message> diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 17147f3..ea48d75 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -193,7 +193,7 @@ const char* kModelIDProperty = "Cellular.ModelID"; const char* kManufacturerProperty = "Cellular.Manufacturer"; const char* kFirmwareRevisionProperty = "Cellular.FirmwareRevision"; const char* kHardwareRevisionProperty = "Cellular.HardwareRevision"; -const char* kLastDeviceUpdateProperty = "Cellular.LastDeviceUpdate"; +const char* kPoweredProperty = "Powered"; const char* kPRLVersionProperty = "Cellular.PRLVersion"; // (INT16) const char* kSelectedNetworkProperty = "Cellular.SelectedNetwork"; const char* kSupportNetworkScanProperty = "Cellular.SupportNetworkScan"; @@ -465,7 +465,6 @@ enum PropertyIndex { PROPERTY_INDEX_IMEI, PROPERTY_INDEX_IMSI, PROPERTY_INDEX_IS_ACTIVE, - PROPERTY_INDEX_LAST_DEVICE_UPDATE, PROPERTY_INDEX_L2TPIPSEC_CA_CERT, PROPERTY_INDEX_L2TPIPSEC_CERT, PROPERTY_INDEX_L2TPIPSEC_KEY, @@ -486,6 +485,7 @@ enum PropertyIndex { PROPERTY_INDEX_PASSPHRASE, PROPERTY_INDEX_PASSPHRASE_REQUIRED, PROPERTY_INDEX_PAYMENT_URL, + PROPERTY_INDEX_POWERED, PROPERTY_INDEX_PRL_VERSION, PROPERTY_INDEX_PROFILES, PROPERTY_INDEX_PROVIDER, @@ -558,7 +558,6 @@ StringToEnum<PropertyIndex>::Pair property_index_table[] = { { kL2TPIPSecPasswordProperty, PROPERTY_INDEX_L2TPIPSEC_PASSWORD }, { kL2TPIPSecPSKProperty, PROPERTY_INDEX_L2TPIPSEC_PSK }, { kL2TPIPSecUserProperty, PROPERTY_INDEX_L2TPIPSEC_USER }, - { kLastDeviceUpdateProperty, PROPERTY_INDEX_LAST_DEVICE_UPDATE }, { kManufacturerProperty, PROPERTY_INDEX_MANUFACTURER }, { kMdnProperty, PROPERTY_INDEX_MDN }, { kMeidProperty, PROPERTY_INDEX_MEID }, @@ -574,6 +573,7 @@ StringToEnum<PropertyIndex>::Pair property_index_table[] = { { kPassphraseProperty, PROPERTY_INDEX_PASSPHRASE }, { kPassphraseRequiredProperty, PROPERTY_INDEX_PASSPHRASE_REQUIRED }, { kPaymentURLProperty, PROPERTY_INDEX_PAYMENT_URL }, + { kPoweredProperty, PROPERTY_INDEX_POWERED }, { kProfilesProperty, PROPERTY_INDEX_PROFILES }, { kProviderProperty, PROPERTY_INDEX_PROVIDER }, { kRoamingStateProperty, PROPERTY_INDEX_ROAMING_STATE }, @@ -960,8 +960,9 @@ bool NetworkDevice::ParseValue(int index, const Value* value) { return value->GetAsString(&firmware_revision_); case PROPERTY_INDEX_HARDWARE_REVISION: return value->GetAsString(&hardware_revision_); - case PROPERTY_INDEX_LAST_DEVICE_UPDATE: - return value->GetAsString(&last_update_); + case PROPERTY_INDEX_POWERED: + // we don't care about the value, just the fact that it changed + return true; case PROPERTY_INDEX_PRL_VERSION: return value->GetAsInteger(&PRL_version_); case PROPERTY_INDEX_SELECTED_NETWORK: @@ -2107,8 +2108,8 @@ class NetworkLibraryImpl : public NetworkLibrary { if (iter != network_device_observers_.end()) { oblist = iter->second; } else { - oblist = new NetworkDeviceObserverList(this, device_path); - network_device_observers_[device_path] = oblist; + LOG(WARNING) << "No NetworkDeviceObserverList found for " + << device_path; } if (!oblist->HasObserver(observer)) oblist->AddObserver(observer); @@ -2122,10 +2123,6 @@ class NetworkLibraryImpl : public NetworkLibrary { network_device_observers_.find(device_path); if (map_iter != network_device_observers_.end()) { map_iter->second->RemoveObserver(observer); - if (!map_iter->second->size()) { - delete map_iter->second; - network_device_observers_.erase(map_iter); - } } } @@ -3644,6 +3641,12 @@ class NetworkLibraryImpl : public NetworkLibrary { VLOG(2) << " Adding device: " << device_path; device_map_[device_path] = found->second; old_device_map.erase(found); + // Add device property monitor before we request the + // full property list, to ensure that we won't miss any + // property changes. + network_device_observers_[device_path] = + new NetworkDeviceObserverList(this, device_path); + } RequestNetworkDeviceInfo( device_path.c_str(), &NetworkDeviceUpdate, this); @@ -3723,7 +3726,7 @@ class NetworkLibraryImpl : public NetworkLibrary { // Notifications. // We call this any time something in NetworkLibrary changes. - // TODO(stevenjb): We should consider breaking this into multiplie + // TODO(stevenjb): We should consider breaking this into multiple // notifications, e.g. connection state, devices, services, etc. void NotifyNetworkManagerChanged(bool force_update) { CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -3843,6 +3846,11 @@ class NetworkLibraryImpl : public NetworkLibrary { } // Notify only observers on device property change. NotifyNetworkDeviceChanged(device); + // If a device's power state changes, new properties may become + // defined. + if (strcmp(key, kPoweredProperty) == 0) { + RequestNetworkDeviceInfo(path, &NetworkDeviceUpdate, this); + } } } diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h index e276567..b02f36c 100644 --- a/chrome/browser/chromeos/cros/network_library.h +++ b/chrome/browser/chromeos/cros/network_library.h @@ -210,7 +210,6 @@ class NetworkDevice { SIMPinRequire sim_pin_required() const { return sim_pin_required_; } const std::string& firmware_revision() const { return firmware_revision_; } const std::string& hardware_revision() const { return hardware_revision_; } - const std::string& last_update() const { return last_update_; } const unsigned int prl_version() const { return PRL_version_; } const std::string& home_provider() const { return home_provider_; } const std::string& home_provider_code() const { return home_provider_code_; } @@ -257,7 +256,6 @@ class NetworkDevice { SIMPinRequire sim_pin_required_; std::string firmware_revision_; std::string hardware_revision_; - std::string last_update_; int PRL_version_; std::string selected_cellular_network_; CellularNetworkList found_cellular_networks_; diff --git a/chrome/browser/resources/options/chromeos/internet_detail.html b/chrome/browser/resources/options/chromeos/internet_detail.html index 3f57d8b..03d3d5f 100644 --- a/chrome/browser/resources/options/chromeos/internet_detail.html +++ b/chrome/browser/resources/options/chromeos/internet_detail.html @@ -174,10 +174,6 @@ <td id="hardwareRevision" class="option-value"></td> </tr> <tr> - <td class="option-name" i18n-content="lastUpdate"></td> - <td id="lastUpdate" class="option-value"></td> - </tr> - <tr> <td class="option-name" i18n-content="prlVersion"></td> <td id="prlVersion" class="option-value"></td> </tr> diff --git a/chrome/browser/resources/options/chromeos/internet_options.js b/chrome/browser/resources/options/chromeos/internet_options.js index 5168801..4902f1d 100644 --- a/chrome/browser/resources/options/chromeos/internet_options.js +++ b/chrome/browser/resources/options/chromeos/internet_options.js @@ -392,7 +392,6 @@ cr.define('options', function() { $('modelId').textContent = data.modelId; $('firmwareRevision').textContent = data.firmwareRevision; $('hardwareRevision').textContent = data.hardwareRevision; - $('lastUpdate').textContent = data.lastUpdate; $('prlVersion').textContent = data.prlVersion; $('meid').textContent = data.meid; $('imei').textContent = data.imei; diff --git a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc index 4e89b44..c27ab11 100644 --- a/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc @@ -230,9 +230,6 @@ void InternetOptionsHandler::GetLocalizedValues( localized_strings->SetString("hardwareRevision", l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_HARDWARE_REVISION)); - localized_strings->SetString("lastUpdate", - l10n_util::GetStringUTF16( - IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_LAST_UPDATE)); localized_strings->SetString("prlVersion", l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_INTERNET_CELLULAR_PRL_VERSION)); @@ -686,7 +683,6 @@ void InternetOptionsHandler::PopulateCellularDetails( dictionary->SetString("modelId", device->model_id()); dictionary->SetString("firmwareRevision", device->firmware_revision()); dictionary->SetString("hardwareRevision", device->hardware_revision()); - dictionary->SetString("lastUpdate", device->last_update()); dictionary->SetString("prlVersion", StringPrintf("%u", device->prl_version())); dictionary->SetString("meid", device->meid()); |
