| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/ui/views/autofill/password_generation_popup_view_views.
h" | 5 #include "chrome/browser/ui/views/autofill/password_generation_popup_view_views.
h" |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" | 8 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h" |
| 9 #include "chrome/browser/ui/autofill/popup_constants.h" | 9 #include "chrome/browser/ui/autofill/popup_constants.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 return false; | 112 return false; |
| 113 } | 113 } |
| 114 | 114 |
| 115 private: | 115 private: |
| 116 | 116 |
| 117 DISALLOW_COPY_AND_ASSIGN(PasswordBox); | 117 DISALLOW_COPY_AND_ASSIGN(PasswordBox); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 PasswordGenerationPopupViewViews::PasswordGenerationPopupViewViews( | 120 PasswordGenerationPopupViewViews::PasswordGenerationPopupViewViews( |
| 121 PasswordGenerationPopupController* controller, | 121 PasswordGenerationPopupController* controller, |
| 122 views::Widget* observing_widget) | 122 views::FocusManager* focus_manager) |
| 123 : AutofillPopupBaseView(controller, observing_widget), | 123 : AutofillPopupBaseView(controller, focus_manager), |
| 124 password_view_(NULL), | 124 password_view_(NULL), |
| 125 font_list_(ResourceBundle::GetSharedInstance().GetFontList( | 125 font_list_(ResourceBundle::GetSharedInstance().GetFontList( |
| 126 ResourceBundle::SmallFont)), | 126 ResourceBundle::SmallFont)), |
| 127 controller_(controller) { | 127 controller_(controller) { |
| 128 if (controller_->display_password()) | 128 if (controller_->display_password()) |
| 129 CreatePasswordView(); | 129 CreatePasswordView(); |
| 130 | 130 |
| 131 help_label_ = new views::StyledLabel(controller_->HelpText(), this); | 131 help_label_ = new views::StyledLabel(controller_->HelpText(), this); |
| 132 help_label_->SetBaseFontList(font_list_); | 132 help_label_->SetBaseFontList(font_list_); |
| 133 help_label_->SetLineHeight(20); | 133 help_label_->SetLineHeight(20); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 PasswordGenerationPopupController* controller) { | 266 PasswordGenerationPopupController* controller) { |
| 267 views::Widget* observing_widget = | 267 views::Widget* observing_widget = |
| 268 views::Widget::GetTopLevelWidgetForNativeView( | 268 views::Widget::GetTopLevelWidgetForNativeView( |
| 269 controller->container_view()); | 269 controller->container_view()); |
| 270 | 270 |
| 271 // If the top level widget can't be found, cancel the popup since we can't | 271 // If the top level widget can't be found, cancel the popup since we can't |
| 272 // fully set it up. | 272 // fully set it up. |
| 273 if (!observing_widget) | 273 if (!observing_widget) |
| 274 return NULL; | 274 return NULL; |
| 275 | 275 |
| 276 return new PasswordGenerationPopupViewViews(controller, observing_widget); | 276 return new PasswordGenerationPopupViewViews( |
| 277 controller, observing_widget->GetFocusManager()); |
| 277 } | 278 } |
| 278 | 279 |
| 279 void PasswordGenerationPopupViewViews::GetAccessibleState( | 280 void PasswordGenerationPopupViewViews::GetAccessibleState( |
| 280 ui::AXViewState* state) { | 281 ui::AXViewState* state) { |
| 281 state->name = controller_->SuggestedText(); | 282 state->name = controller_->SuggestedText(); |
| 282 state->role = ui::AX_ROLE_MENU_ITEM; | 283 state->role = ui::AX_ROLE_MENU_ITEM; |
| 283 } | 284 } |
| 284 | 285 |
| 285 } // namespace autofill | 286 } // namespace autofill |
| OLD | NEW |