Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: chrome/browser/ui/autofill/password_generation_popup_controller_impl.cc

Issue 1141413002: Prepare password_bubble_experiment and password_manager_util for componentisation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android 2 Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h"
16 #include "chrome/browser/sync/profile_sync_service_factory.h"
15 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h" 17 #include "chrome/browser/ui/autofill/password_generation_popup_observer.h"
16 #include "chrome/browser/ui/autofill/password_generation_popup_view.h" 18 #include "chrome/browser/ui/autofill/password_generation_popup_view.h"
17 #include "chrome/browser/ui/autofill/popup_constants.h" 19 #include "chrome/browser/ui/autofill/popup_constants.h"
18 #include "chrome/browser/ui/browser_finder.h" 20 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/chrome_pages.h" 21 #include "chrome/browser/ui/chrome_pages.h"
20 #include "chrome/browser/ui/passwords/password_bubble_experiment.h" 22 #include "chrome/browser/ui/passwords/password_bubble_experiment.h"
21 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
22 #include "chrome/grit/chromium_strings.h" 24 #include "chrome/grit/chromium_strings.h"
23 #include "chrome/grit/generated_resources.h" 25 #include "chrome/grit/generated_resources.h"
24 #include "components/autofill/content/common/autofill_messages.h" 26 #include "components/autofill/content/common/autofill_messages.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 controller_common_(bounds, container_view, web_contents), 86 controller_common_(bounds, container_view, web_contents),
85 password_selected_(false), 87 password_selected_(false),
86 display_password_(false), 88 display_password_(false),
87 weak_ptr_factory_(this) { 89 weak_ptr_factory_(this) {
88 controller_common_.SetKeyPressCallback( 90 controller_common_.SetKeyPressCallback(
89 base::Bind(&PasswordGenerationPopupControllerImpl::HandleKeyPressEvent, 91 base::Bind(&PasswordGenerationPopupControllerImpl::HandleKeyPressEvent,
90 base::Unretained(this))); 92 base::Unretained(this)));
91 93
92 int link_id = IDS_MANAGE_PASSWORDS_LINK; 94 int link_id = IDS_MANAGE_PASSWORDS_LINK;
93 int help_text_id = IDS_PASSWORD_GENERATION_PROMPT; 95 int help_text_id = IDS_PASSWORD_GENERATION_PROMPT;
94 if (password_bubble_experiment::IsSmartLockBrandingEnabled( 96 const ProfileSyncService* sync_service =
95 Profile::FromBrowserContext(web_contents->GetBrowserContext()))) { 97 ProfileSyncServiceFactory::GetForProfile(
98 Profile::FromBrowserContext(web_contents->GetBrowserContext()));
99 if (password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service)) {
96 help_text_id = IDS_PASSWORD_GENERATION_SMART_LOCK_PROMPT; 100 help_text_id = IDS_PASSWORD_GENERATION_SMART_LOCK_PROMPT;
97 link_id = IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS; 101 link_id = IDS_PASSWORD_MANAGER_SMART_LOCK_FOR_PASSWORDS;
98 } 102 }
99 103
100 base::string16 link = l10n_util::GetStringUTF16(link_id); 104 base::string16 link = l10n_util::GetStringUTF16(link_id);
101 size_t offset; 105 size_t offset;
102 help_text_ = l10n_util::GetStringFUTF16(help_text_id, link, &offset); 106 help_text_ = l10n_util::GetStringFUTF16(help_text_id, link, &offset);
103 link_range_ = gfx::Range(offset, offset + link.length()); 107 link_range_ = gfx::Range(offset, offset + link.length());
104 } 108 }
105 109
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 289
286 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() { 290 const base::string16& PasswordGenerationPopupControllerImpl::HelpText() {
287 return help_text_; 291 return help_text_;
288 } 292 }
289 293
290 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() { 294 const gfx::Range& PasswordGenerationPopupControllerImpl::HelpTextLinkRange() {
291 return link_range_; 295 return link_range_;
292 } 296 }
293 297
294 } // namespace autofill 298 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698