[CrOS Network] Fix network configuration UI issues.

When a <network-config> element is used to configure a network
without also connecting to it, it was possible for it to get stuck in
an unresponsive state. In saveAndConnect_(), we either call
networkingPrivate.createNetwork() or
networkingPrivate.setProperties(), depending on the network's source.
In the createNetwork() callback, we previously did not close the
dialog, resulting in a dialog that stays open and does not respond
when the "Save" button is pressed.

This CL closes the dialog in that case and refactors the element so
that the same code path is used for both methods of network

Additionally, this cleans up a check in internet_page.js to use !! to
force a boolean value.

Bug: 974737
Change-Id: Icca3148d854c645586e5dc0ed0749f6f99a5e362
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1674412
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672237}
2 files changed