Commit fc7af3fb authored by James Cook's avatar James Cook Committed by Commit Bot

chromeos: Fix DCHECK in IsOSSettingsSubPage().

Sub-pages may have parameters (e.g. networkDetail?guid=vpn2_guid) so we
need to trim off the query before deciding if it's an OS sub-page.

Bug: 966579
Change-Id: I179ccec90edb4155cd09bc44d498ee62f2e077b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1628132
Auto-Submit: James Cook <jamescook@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662870}
parent 5f22a827
......@@ -367,13 +367,15 @@ const char kConnectedDevicesSubPage[] = "multidevice/features";
const char kLockScreenSubPage[] = "lockScreen";
const char kNativePrintingSettingsSubPage[] = "cupsPrinters";
const char kNetworkDetailSubPage[] = "networkDetail";
const char kNetworksSubPage[] = "networks";
const char kPluginVmDetailsSubPage[] = "pluginVm/details";
const char kPluginVmSharedPathSubPage[] = "pluginVm/sharedPath";
const char kPowerSubPage[] = "power";
const char kSmartLockSettingsSubPage[] = "multidevice/features/smartLock";
const char kSmbSharesPageAddDialog[] = "smbShares?showAddShare=true";
const char kSmbSharesSubPage[] = "smbShares";
const char kStorageSubPage[] = "storage";
const char kStylusSubPage[] = "stylus";
// Tether is a child of the 'networks' route.
const char kTetherSettingsSubPage[] = "networks?type=Tether";
bool IsOSSettingsSubPage(const std::string& sub_page) {
......@@ -390,14 +392,20 @@ bool IsOSSettingsSubPage(const std::string& sub_page) {
kConnectedDevicesSubPage,
kLockScreenSubPage,
kNetworkDetailSubPage,
kNetworksSubPage,
kPowerSubPage,
kSmartLockSettingsSubPage,
kSmbSharesPageAddDialog,
kSmbSharesSubPage,
kStorageSubPage,
kStylusSubPage,
kTetherSettingsSubPage};
kStylusSubPage};
// Sub-pages may have query parameters, e.g. networkDetail?guid=123456.
std::string sub_page_without_query = sub_page;
std::string::size_type index = sub_page.find('?');
if (index != std::string::npos)
sub_page_without_query.resize(index);
for (const char* p : kSubPages) {
if (sub_page == p)
if (sub_page_without_query == p)
return true;
}
return false;
......
......@@ -329,12 +329,12 @@ extern const char kConnectedDevicesSubPage[];
extern const char kLockScreenSubPage[];
extern const char kNativePrintingSettingsSubPage[];
extern const char kNetworkDetailSubPage[];
extern const char kNetworksSubPage[];
extern const char kPluginVmDetailsSubPage[];
extern const char kPluginVmSharedPathSubPage[];
extern const char kPowerSubPage[];
extern const char kSmartLockSettingsSubPage[];
extern const char kSmbSharesPage[];
extern const char kSmbSharesPageAddDialog[];
extern const char kSmbSharesSubPage[];
extern const char kStorageSubPage[];
extern const char kStylusSubPage[];
extern const char kTetherSettingsSubPage[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment