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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 bounds.height()); | 175 bounds.height()); |
176 } | 176 } |
177 | 177 |
178 void PasswordGenerationPopupControllerImpl::Show(bool display_password) { | 178 void PasswordGenerationPopupControllerImpl::Show(bool display_password) { |
179 display_password_ = display_password; | 179 display_password_ = display_password; |
180 if (display_password_ && current_password_.empty()) | 180 if (display_password_ && current_password_.empty()) |
181 current_password_ = base::ASCIIToUTF16(generator_->Generate()); | 181 current_password_ = base::ASCIIToUTF16(generator_->Generate()); |
182 | 182 |
183 if (!view_) { | 183 if (!view_) { |
184 view_ = PasswordGenerationPopupView::Create(this); | 184 view_ = PasswordGenerationPopupView::Create(this); |
| 185 |
| 186 // Treat popup as being hidden if creation fails. |
| 187 if (!view_) { |
| 188 Hide(); |
| 189 return; |
| 190 } |
| 191 |
185 CalculateBounds(); | 192 CalculateBounds(); |
186 view_->Show(); | 193 view_->Show(); |
187 } else { | 194 } else { |
188 CalculateBounds(); | 195 CalculateBounds(); |
189 view_->UpdateBoundsAndRedrawPopup(); | 196 view_->UpdateBoundsAndRedrawPopup(); |
190 } | 197 } |
191 | 198 |
192 controller_common_.RegisterKeyPressCallback(); | 199 controller_common_.RegisterKeyPressCallback(); |
193 | 200 |
194 if (observer_) | 201 if (observer_) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 286 |
280 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { | 287 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { |
281 return help_text_; | 288 return help_text_; |
282 } | 289 } |
283 | 290 |
284 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { | 291 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { |
285 return link_range_; | 292 return link_range_; |
286 } | 293 } |
287 | 294 |
288 } // namespace autofill | 295 } // namespace autofill |
OLD | NEW |