Skip to content

Commit

Permalink
athena: Fix a couple of UX issues with entering password for networks.
Browse files Browse the repository at this point in the history
. Make sure a network-row that has a password entry remains visible when
 the network list is refreshed.
. Make sure the password text-entry gets the focus when it is added to the list,
  to make sure that the virtual keyboard is visible.

BUG=398393, 398395
R=oshima@chromium.org

Review URL: https://codereview.chromium.org/419683012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286268 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sadrul@chromium.org committed Jul 29, 2014
1 parent 1cb64aa commit a27feb2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions athena/main/debug/network_selector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class PasswordView : public views::View, public views::ButtonListener {
AddChildView(error_msg_);
InvalidateLayout();
parent_container_->Layout();
ScrollRectToVisible(error_msg_->bounds());
}
connect_->SetEnabled(true);
}
Expand Down Expand Up @@ -149,6 +150,13 @@ class PasswordView : public views::View, public views::ButtonListener {

void OnConnectionSucceed() { Close(true); }

// views::View:
virtual void ViewHierarchyChanged(
const views::View::ViewHierarchyChangedDetails& details) OVERRIDE {
if (details.is_add && details.child == this)
textfield_->RequestFocus();
}

// views::ButtonListener:
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE {
Expand All @@ -167,9 +175,7 @@ class PasswordView : public views::View, public views::ButtonListener {
textfield_->text()),
base::Bind(&PasswordView::OnKnownError, weak_ptr_.GetWeakPtr()));
} else if (sender == cancel_) {
views::View* parent_view = parent();
Close(false);
parent_view->Layout();
} else {
NOTREACHED();
}
Expand Down Expand Up @@ -217,11 +223,14 @@ class NetworkRow : public views::View {
AddChildView(password_view_.get());
}

bool has_password_view() const { return password_view_; }

private:
void OnPasswordComplete(bool successful) {
password_view_.reset();
InvalidateLayout();
container_->Layout();
ScrollRectToVisible(GetContentsBounds());
}

void ShowPasswordView(const std::string& service_path) {
Expand All @@ -245,6 +254,7 @@ class NetworkRow : public views::View {
AddChildView(password_view_.get());
PreferredSizeChanged();
container_->Layout();
ScrollRectToVisible(password_view_->bounds());
}

void OnNetworkConnectionError(const std::string& service_path,
Expand Down Expand Up @@ -383,7 +393,9 @@ class NetworkSelector : public ui::NetworkListDelegate,
return new NetworkRow(info, background_view_);
}

virtual bool IsViewHovered(views::View* view) OVERRIDE { return false; }
virtual bool IsViewHovered(views::View* view) OVERRIDE {
return static_cast<NetworkRow*>(view)->has_password_view();
}

virtual chromeos::NetworkTypePattern GetNetworkTypePattern() const OVERRIDE {
return chromeos::NetworkTypePattern::NonVirtual();
Expand Down

0 comments on commit a27feb2

Please sign in to comment.