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 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
11 #include "base/strings/string_split.h" | 11 #include "base/strings/string_split.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversion_utils.h" | 13 #include "base/strings/utf_string_conversion_utils.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "chrome/browser/profiles/profile.h" | |
16 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
17 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" | 15 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" |
18 #include "chrome/browser/ui/autofill/password_generation_popup_view.h" | 16 #include "chrome/browser/ui/autofill/password_generation_popup_view.h" |
19 #include "chrome/browser/ui/autofill/popup_constants.h" | 17 #include "chrome/browser/ui/autofill/popup_constants.h" |
20 #include "chrome/browser/ui/browser_finder.h" | 18 #include "chrome/browser/ui/browser_finder.h" |
21 #include "chrome/browser/ui/chrome_pages.h" | 19 #include "chrome/browser/ui/chrome_pages.h" |
22 #include "chrome/common/features.h" | 20 #include "chrome/common/features.h" |
23 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
24 #include "chrome/grit/chromium_strings.h" | 22 #include "chrome/grit/chromium_strings.h" |
25 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
26 #include "components/autofill/core/browser/password_generator.h" | 24 #include "components/autofill/core/browser/password_generator.h" |
27 #include "components/autofill/core/browser/suggestion.h" | 25 #include "components/autofill/core/browser/suggestion.h" |
28 #include "components/browser_sync/profile_sync_service.h" | |
29 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 26 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
30 #include "components/password_manager/core/browser/password_manager.h" | 27 #include "components/password_manager/core/browser/password_manager.h" |
31 #include "content/public/browser/native_web_keyboard_event.h" | 28 #include "content/public/browser/native_web_keyboard_event.h" |
32 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
33 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
34 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
35 #include "ui/events/keycodes/keyboard_codes.h" | 32 #include "ui/events/keycodes/keyboard_codes.h" |
36 #include "ui/gfx/geometry/rect_conversions.h" | 33 #include "ui/gfx/geometry/rect_conversions.h" |
37 #include "ui/gfx/text_utils.h" | 34 #include "ui/gfx/text_utils.h" |
38 | 35 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 base::i18n::LEFT_TO_RIGHT, | 87 base::i18n::LEFT_TO_RIGHT, |
91 container_view, | 88 container_view, |
92 web_contents), | 89 web_contents), |
93 password_selected_(false), | 90 password_selected_(false), |
94 display_password_(false), | 91 display_password_(false), |
95 weak_ptr_factory_(this) { | 92 weak_ptr_factory_(this) { |
96 controller_common_.SetKeyPressCallback( | 93 controller_common_.SetKeyPressCallback( |
97 base::Bind(&PasswordGenerationPopupControllerImpl::HandleKeyPressEvent, | 94 base::Bind(&PasswordGenerationPopupControllerImpl::HandleKeyPressEvent, |
98 base::Unretained(this))); | 95 base::Unretained(this))); |
99 | 96 |
100 int link_id = IDS_MANAGE_PASSWORDS_LINK; | 97 base::string16 link = l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_LINK); |
101 int help_text_id = IDS_PASSWORD_GENERATION_PROMPT; | |
102 const browser_sync::ProfileSyncService* sync_service = | |
103 ProfileSyncServiceFactory::GetForProfile( | |
104 Profile::FromBrowserContext(web_contents->GetBrowserContext())); | |
105 if (password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service)) { | |
106 help_text_id = IDS_PASSWORD_GENERATION_SMART_LOCK_PROMPT; | |
vasilii
2016/12/16 16:56:53
You forgot to remove it. It's in two files.
vabr (Chromium)
2016/12/16 18:56:27
Done.
| |
107 link_id = IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS; | |
108 } | |
109 | |
110 base::string16 link = l10n_util::GetStringUTF16(link_id); | |
111 size_t offset; | 98 size_t offset; |
vasilii
2016/12/16 16:56:53
= 0; while you are here ;-)
vabr (Chromium)
2016/12/16 18:56:27
Done.
| |
112 help_text_ = l10n_util::GetStringFUTF16(help_text_id, link, &offset); | 99 help_text_ = |
100 l10n_util::GetStringFUTF16(IDS_PASSWORD_GENERATION_PROMPT, link, &offset); | |
113 link_range_ = gfx::Range(offset, offset + link.length()); | 101 link_range_ = gfx::Range(offset, offset + link.length()); |
114 } | 102 } |
115 | 103 |
116 PasswordGenerationPopupControllerImpl::~PasswordGenerationPopupControllerImpl() | 104 PasswordGenerationPopupControllerImpl::~PasswordGenerationPopupControllerImpl() |
117 {} | 105 {} |
118 | 106 |
119 base::WeakPtr<PasswordGenerationPopupControllerImpl> | 107 base::WeakPtr<PasswordGenerationPopupControllerImpl> |
120 PasswordGenerationPopupControllerImpl::GetWeakPtr() { | 108 PasswordGenerationPopupControllerImpl::GetWeakPtr() { |
121 return weak_ptr_factory_.GetWeakPtr(); | 109 return weak_ptr_factory_.GetWeakPtr(); |
122 } | 110 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
313 | 301 |
314 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { | 302 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { |
315 return help_text_; | 303 return help_text_; |
316 } | 304 } |
317 | 305 |
318 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { | 306 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { |
319 return link_range_; | 307 return link_range_; |
320 } | 308 } |
321 | 309 |
322 } // namespace autofill | 310 } // namespace autofill |
OLD | NEW |