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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 bool PasswordGenerationPopupControllerImpl::PossiblyAcceptPassword() { | 130 bool PasswordGenerationPopupControllerImpl::PossiblyAcceptPassword() { |
131 if (password_selected_) { | 131 if (password_selected_) { |
132 PasswordAccepted(); // This will delete |this|. | 132 PasswordAccepted(); // This will delete |this|. |
133 return true; | 133 return true; |
134 } | 134 } |
135 | 135 |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 void PasswordGenerationPopupControllerImpl::PasswordSelected(bool selected) { | 139 void PasswordGenerationPopupControllerImpl::PasswordSelected(bool selected) { |
140 if (!display_password_ || selected == password_selected_) | 140 if (!display_password_) |
141 return; | 141 return; |
142 | 142 |
143 password_selected_ = selected; | 143 password_selected_ = selected; |
144 view_->PasswordSelectionUpdated(); | 144 view_->PasswordSelectionUpdated(); |
145 view_->UpdateBoundsAndRedrawPopup(); | 145 view_->UpdateBoundsAndRedrawPopup(); |
146 } | 146 } |
147 | 147 |
148 void PasswordGenerationPopupControllerImpl::PasswordAccepted() { | 148 void PasswordGenerationPopupControllerImpl::PasswordAccepted() { |
149 if (!display_password_) | 149 if (!display_password_) |
150 return; | 150 return; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 Browser* browser = | 282 Browser* browser = |
283 chrome::FindBrowserWithWebContents(controller_common_.web_contents()); | 283 chrome::FindBrowserWithWebContents(controller_common_.web_contents()); |
284 content::OpenURLParams params( | 284 content::OpenURLParams params( |
285 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(), | 285 GURL(chrome::kAutoPasswordGenerationLearnMoreURL), content::Referrer(), |
286 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false); | 286 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false); |
287 browser->OpenURL(params); | 287 browser->OpenURL(params); |
288 } | 288 } |
289 | 289 |
290 void PasswordGenerationPopupControllerImpl::SetSelectionAtPoint( | 290 void PasswordGenerationPopupControllerImpl::SetSelectionAtPoint( |
291 const gfx::Point& point) { | 291 const gfx::Point& point) { |
292 PasswordSelected(password_bounds_.Contains(point)); | 292 if (password_bounds_.Contains(point)) |
| 293 PasswordSelected(true); |
293 } | 294 } |
294 | 295 |
295 bool PasswordGenerationPopupControllerImpl::AcceptSelectedLine() { | 296 bool PasswordGenerationPopupControllerImpl::AcceptSelectedLine() { |
296 if (!password_selected_) | 297 if (!password_selected_) |
297 return false; | 298 return false; |
298 | 299 |
299 PasswordAccepted(); | 300 PasswordAccepted(); |
300 return true; | 301 return true; |
301 } | 302 } |
302 | 303 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 349 |
349 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { | 350 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { |
350 return help_text_; | 351 return help_text_; |
351 } | 352 } |
352 | 353 |
353 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { | 354 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { |
354 return link_range_; | 355 return link_range_; |
355 } | 356 } |
356 | 357 |
357 } // namespace autofill | 358 } // namespace autofill |
OLD | NEW |