| 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/autofill/password_generation_popup_controller_impl.h
" | 5 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 bounds.height()); | 170 bounds.height()); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void PasswordGenerationPopupControllerImpl::Show(bool display_password) { | 173 void PasswordGenerationPopupControllerImpl::Show(bool display_password) { |
| 174 display_password_ = display_password; | 174 display_password_ = display_password; |
| 175 if (display_password_ && current_password_.empty()) | 175 if (display_password_ && current_password_.empty()) |
| 176 current_password_ = base::ASCIIToUTF16(generator_->Generate()); | 176 current_password_ = base::ASCIIToUTF16(generator_->Generate()); |
| 177 | 177 |
| 178 if (!view_) { | 178 if (!view_) { |
| 179 view_ = PasswordGenerationPopupView::Create(this); | 179 view_ = PasswordGenerationPopupView::Create(this); |
| 180 |
| 181 // Treat popup as being hidden if creation fails. |
| 182 if (!view_) { |
| 183 Hide(); |
| 184 return; |
| 185 } |
| 186 |
| 180 CalculateBounds(); | 187 CalculateBounds(); |
| 181 view_->Show(); | 188 view_->Show(); |
| 182 } else { | 189 } else { |
| 183 CalculateBounds(); | 190 CalculateBounds(); |
| 184 view_->UpdateBoundsAndRedrawPopup(); | 191 view_->UpdateBoundsAndRedrawPopup(); |
| 185 } | 192 } |
| 186 | 193 |
| 187 controller_common_.RegisterKeyPressCallback(); | 194 controller_common_.RegisterKeyPressCallback(); |
| 188 | 195 |
| 189 if (observer_) | 196 if (observer_) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 281 |
| 275 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { | 282 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { |
| 276 return help_text_; | 283 return help_text_; |
| 277 } | 284 } |
| 278 | 285 |
| 279 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { | 286 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { |
| 280 return link_range_; | 287 return link_range_; |
| 281 } | 288 } |
| 282 | 289 |
| 283 } // namespace autofill | 290 } // namespace autofill |
| OLD | NEW |