| 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/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 166 |
| 167 void PasswordGenerationPopupControllerImpl::CalculateBounds() { | 167 void PasswordGenerationPopupControllerImpl::CalculateBounds() { |
| 168 gfx::Size bounds = view_->GetPreferredSizeOfPasswordView(); | 168 gfx::Size bounds = view_->GetPreferredSizeOfPasswordView(); |
| 169 | 169 |
| 170 popup_bounds_ = controller_common_.GetPopupBounds(bounds.width(), | 170 popup_bounds_ = controller_common_.GetPopupBounds(bounds.width(), |
| 171 bounds.height()); | 171 bounds.height()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 void PasswordGenerationPopupControllerImpl::Show(bool display_password) { | 174 void PasswordGenerationPopupControllerImpl::Show(bool display_password) { |
| 175 display_password_ = display_password; | 175 display_password_ = display_password; |
| 176 if (display_password_) | 176 if (display_password_ && current_password_.empty()) |
| 177 current_password_ = base::ASCIIToUTF16(generator_->Generate()); | 177 current_password_ = base::ASCIIToUTF16(generator_->Generate()); |
| 178 | 178 |
| 179 if (!view_) { | 179 if (!view_) { |
| 180 view_ = PasswordGenerationPopupView::Create(this); | 180 view_ = PasswordGenerationPopupView::Create(this); |
| 181 CalculateBounds(); | 181 CalculateBounds(); |
| 182 view_->Show(); | 182 view_->Show(); |
| 183 } else { | 183 } else { |
| 184 CalculateBounds(); | 184 CalculateBounds(); |
| 185 view_->UpdateBoundsAndRedrawPopup(); | 185 view_->UpdateBoundsAndRedrawPopup(); |
| 186 } | 186 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { | 268 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { |
| 269 return help_text_; | 269 return help_text_; |
| 270 } | 270 } |
| 271 | 271 |
| 272 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { | 272 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { |
| 273 return link_range_; | 273 return link_range_; |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace autofill | 276 } // namespace autofill |
| OLD | NEW |