Chromium Code Reviews| 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/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "components/password_manager/sync/browser/sync_store_result_filter.h" | 43 #include "components/password_manager/sync/browser/sync_store_result_filter.h" |
| 44 #include "components/version_info/version_info.h" | 44 #include "components/version_info/version_info.h" |
| 45 #include "content/public/browser/navigation_entry.h" | 45 #include "content/public/browser/navigation_entry.h" |
| 46 #include "content/public/browser/render_view_host.h" | 46 #include "content/public/browser/render_view_host.h" |
| 47 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
| 48 #include "google_apis/gaia/gaia_urls.h" | 48 #include "google_apis/gaia/gaia_urls.h" |
| 49 #include "net/base/url_util.h" | 49 #include "net/base/url_util.h" |
| 50 #include "third_party/re2/re2/re2.h" | 50 #include "third_party/re2/re2/re2.h" |
| 51 | 51 |
| 52 #if defined(OS_ANDROID) | 52 #if defined(OS_ANDROID) |
| 53 #include "chrome/browser/android/tab_android.h" | |
| 53 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" | 54 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" |
| 55 #include "chrome/browser/ui/android/snackbars/auto_signin_snackbar_controller_he lper.h" | |
| 54 #endif | 56 #endif |
| 55 | 57 |
| 56 using password_manager::ContentPasswordManagerDriverFactory; | 58 using password_manager::ContentPasswordManagerDriverFactory; |
| 57 using password_manager::PasswordManagerInternalsService; | 59 using password_manager::PasswordManagerInternalsService; |
| 58 using password_manager::PasswordManagerInternalsServiceFactory; | 60 using password_manager::PasswordManagerInternalsServiceFactory; |
| 59 | 61 |
| 60 // Shorten the name to spare line breaks. The code provides enough context | 62 // Shorten the name to spare line breaks. The code provides enough context |
| 61 // already. | 63 // already. |
| 62 typedef autofill::SavePasswordProgressLogger Logger; | 64 typedef autofill::SavePasswordProgressLogger Logger; |
| 63 | 65 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 | 234 |
| 233 void ChromePasswordManagerClient::ForceSavePassword() { | 235 void ChromePasswordManagerClient::ForceSavePassword() { |
| 234 password_manager::ContentPasswordManagerDriver* driver = | 236 password_manager::ContentPasswordManagerDriver* driver = |
| 235 driver_factory_->GetDriverForFrame(web_contents()->GetFocusedFrame()); | 237 driver_factory_->GetDriverForFrame(web_contents()->GetFocusedFrame()); |
| 236 driver->ForceSavePassword(); | 238 driver->ForceSavePassword(); |
| 237 } | 239 } |
| 238 | 240 |
| 239 void ChromePasswordManagerClient::NotifyUserAutoSignin( | 241 void ChromePasswordManagerClient::NotifyUserAutoSignin( |
| 240 ScopedVector<autofill::PasswordForm> local_forms) { | 242 ScopedVector<autofill::PasswordForm> local_forms) { |
| 241 DCHECK(!local_forms.empty()); | 243 DCHECK(!local_forms.empty()); |
| 244 #if defined(OS_ANDROID) | |
| 245 TabAndroid *tab = TabAndroid::FromWebContents(web_contents()); | |
| 246 ShowAutoSigninSnackbar(tab, local_forms[0]->username_value); | |
|
newt (away)
2015/08/21 16:47:32
Looks like you're no longer showing this snackbar
melandory
2015/08/21 19:04:09
Previously it was called it different place, where
| |
| 247 #else | |
| 242 ManagePasswordsUIController::FromWebContents(web_contents())-> | 248 ManagePasswordsUIController::FromWebContents(web_contents())-> |
| 243 OnAutoSignin(local_forms.Pass()); | 249 OnAutoSignin(local_forms.Pass()); |
| 250 | |
| 251 #endif | |
| 244 } | 252 } |
| 245 | 253 |
| 246 void ChromePasswordManagerClient::AutomaticPasswordSave( | 254 void ChromePasswordManagerClient::AutomaticPasswordSave( |
| 247 scoped_ptr<password_manager::PasswordFormManager> saved_form) { | 255 scoped_ptr<password_manager::PasswordFormManager> saved_form) { |
| 248 #if defined(OS_ANDROID) | 256 #if defined(OS_ANDROID) |
| 249 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); | 257 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); |
| 250 #else | 258 #else |
| 251 if (IsTheHotNewBubbleUIEnabled()) { | 259 if (IsTheHotNewBubbleUIEnabled()) { |
| 252 ManagePasswordsUIController* manage_passwords_ui_controller = | 260 ManagePasswordsUIController* manage_passwords_ui_controller = |
| 253 ManagePasswordsUIController::FromWebContents(web_contents()); | 261 ManagePasswordsUIController::FromWebContents(web_contents()); |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 if (!entry) | 547 if (!entry) |
| 540 return GURL::EmptyGURL(); | 548 return GURL::EmptyGURL(); |
| 541 | 549 |
| 542 return entry->GetURL(); | 550 return entry->GetURL(); |
| 543 } | 551 } |
| 544 | 552 |
| 545 scoped_ptr<password_manager::CredentialsFilter> | 553 scoped_ptr<password_manager::CredentialsFilter> |
| 546 ChromePasswordManagerClient::CreateStoreResultFilter() const { | 554 ChromePasswordManagerClient::CreateStoreResultFilter() const { |
| 547 return make_scoped_ptr(new password_manager::SyncStoreResultFilter(this)); | 555 return make_scoped_ptr(new password_manager::SyncStoreResultFilter(this)); |
| 548 } | 556 } |
| OLD | NEW |