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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/utf_string_conversion_utils.h" | 12 #include "base/strings/utf_string_conversion_utils.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/sync/profile_sync_service_factory.h" | 15 #include "chrome/browser/sync/profile_sync_service_factory.h" |
16 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" | 16 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" |
17 #include "chrome/browser/ui/autofill/password_generation_popup_view.h" | 17 #include "chrome/browser/ui/autofill/password_generation_popup_view.h" |
18 #include "chrome/browser/ui/autofill/popup_constants.h" | 18 #include "chrome/browser/ui/autofill/popup_constants.h" |
19 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
20 #include "chrome/browser/ui/chrome_pages.h" | 20 #include "chrome/browser/ui/chrome_pages.h" |
| 21 #include "chrome/common/features.h" |
21 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" |
22 #include "chrome/grit/chromium_strings.h" | 23 #include "chrome/grit/chromium_strings.h" |
23 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
24 #include "components/autofill/content/common/autofill_messages.h" | 25 #include "components/autofill/content/common/autofill_messages.h" |
25 #include "components/autofill/core/browser/password_generator.h" | 26 #include "components/autofill/core/browser/password_generator.h" |
26 #include "components/browser_sync/browser/profile_sync_service.h" | 27 #include "components/browser_sync/browser/profile_sync_service.h" |
27 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 28 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
28 #include "components/password_manager/core/browser/password_manager.h" | 29 #include "components/password_manager/core/browser/password_manager.h" |
29 #include "content/public/browser/native_web_keyboard_event.h" | 30 #include "content/public/browser/native_web_keyboard_event.h" |
30 #include "content/public/browser/render_view_host.h" | 31 #include "content/public/browser/render_view_host.h" |
31 #include "content/public/browser/web_contents.h" | 32 #include "content/public/browser/web_contents.h" |
32 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/events/keycodes/keyboard_codes.h" | 34 #include "ui/events/keycodes/keyboard_codes.h" |
34 #include "ui/gfx/geometry/rect_conversions.h" | 35 #include "ui/gfx/geometry/rect_conversions.h" |
35 #include "ui/gfx/text_utils.h" | 36 #include "ui/gfx/text_utils.h" |
36 | 37 |
37 #if defined(OS_ANDROID) | 38 #if BUILDFLAG(ANDROID_JAVA_UI) |
38 #include "chrome/browser/android/chrome_application.h" | 39 #include "chrome/browser/android/chrome_application.h" |
39 #endif | 40 #endif |
40 | 41 |
41 namespace autofill { | 42 namespace autofill { |
42 | 43 |
43 base::WeakPtr<PasswordGenerationPopupControllerImpl> | 44 base::WeakPtr<PasswordGenerationPopupControllerImpl> |
44 PasswordGenerationPopupControllerImpl::GetOrCreate( | 45 PasswordGenerationPopupControllerImpl::GetOrCreate( |
45 base::WeakPtr<PasswordGenerationPopupControllerImpl> previous, | 46 base::WeakPtr<PasswordGenerationPopupControllerImpl> previous, |
46 const gfx::RectF& bounds, | 47 const gfx::RectF& bounds, |
47 const PasswordForm& form, | 48 const PasswordForm& form, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 delete this; | 226 delete this; |
226 } | 227 } |
227 | 228 |
228 void PasswordGenerationPopupControllerImpl::ViewDestroyed() { | 229 void PasswordGenerationPopupControllerImpl::ViewDestroyed() { |
229 view_ = NULL; | 230 view_ = NULL; |
230 | 231 |
231 Hide(); | 232 Hide(); |
232 } | 233 } |
233 | 234 |
234 void PasswordGenerationPopupControllerImpl::OnSavedPasswordsLinkClicked() { | 235 void PasswordGenerationPopupControllerImpl::OnSavedPasswordsLinkClicked() { |
235 #if defined(OS_ANDROID) | 236 #if BUILDFLAG(ANDROID_JAVA_UI) |
236 chrome::android::ChromeApplication::ShowPasswordSettings(); | 237 chrome::android::ChromeApplication::ShowPasswordSettings(); |
237 #else | 238 #else |
238 chrome::ShowSettingsSubPage( | 239 chrome::ShowSettingsSubPage( |
239 chrome::FindBrowserWithWebContents(controller_common_.web_contents()), | 240 chrome::FindBrowserWithWebContents(controller_common_.web_contents()), |
240 chrome::kPasswordManagerSubPage); | 241 chrome::kPasswordManagerSubPage); |
241 #endif | 242 #endif |
242 } | 243 } |
243 | 244 |
244 void PasswordGenerationPopupControllerImpl::SetSelectionAtPoint( | 245 void PasswordGenerationPopupControllerImpl::SetSelectionAtPoint( |
245 const gfx::Point& point) { | 246 const gfx::Point& point) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 294 |
294 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { | 295 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { |
295 return help_text_; | 296 return help_text_; |
296 } | 297 } |
297 | 298 |
298 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { | 299 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { |
299 return link_range_; | 300 return link_range_; |
300 } | 301 } |
301 | 302 |
302 } // namespace autofill | 303 } // namespace autofill |
OLD | NEW |