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/chrome_autofill_client.h" | 5 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 14 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
15 #include "chrome/browser/autofill/risk_util.h" | 15 #include "chrome/browser/autofill/risk_util.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
18 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 18 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/browser/signin/signin_promo.h" | |
22 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
23 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 24 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
24 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 25 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
25 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" | 26 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" |
26 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" | 27 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" |
27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
29 #include "chrome/browser/ui/browser_window.h" | 30 #include "chrome/browser/ui/browser_window.h" |
30 #include "chrome/browser/ui/chrome_pages.h" | 31 #include "chrome/browser/ui/chrome_pages.h" |
31 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 32 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
32 #include "chrome/browser/web_data_service_factory.h" | 33 #include "chrome/browser/web_data_service_factory.h" |
33 #include "chrome/common/features.h" | 34 #include "chrome/common/features.h" |
34 #include "chrome/common/url_constants.h" | 35 #include "chrome/common/url_constants.h" |
35 #include "components/autofill/content/browser/content_autofill_driver.h" | 36 #include "components/autofill/content/browser/content_autofill_driver.h" |
36 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 37 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
37 #include "components/autofill/content/common/autofill_messages.h" | 38 #include "components/autofill/content/common/autofill_messages.h" |
38 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" | 39 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" |
39 #include "components/autofill/core/common/autofill_pref_names.h" | 40 #include "components/autofill/core/common/autofill_pref_names.h" |
40 #include "components/autofill/core/common/autofill_switches.h" | 41 #include "components/autofill/core/common/autofill_switches.h" |
41 #include "components/browser_sync/browser/profile_sync_service.h" | 42 #include "components/browser_sync/browser/profile_sync_service.h" |
42 #include "components/password_manager/content/browser/content_password_manager_d river.h" | 43 #include "components/password_manager/content/browser/content_password_manager_d river.h" |
43 #include "components/prefs/pref_service.h" | 44 #include "components/prefs/pref_service.h" |
44 #include "components/signin/core/browser/profile_identity_provider.h" | 45 #include "components/signin/core/browser/profile_identity_provider.h" |
46 #include "components/signin/core/browser/signin_header_helper.h" | |
47 #include "components/signin/core/browser/signin_metrics.h" | |
45 #include "components/user_prefs/user_prefs.h" | 48 #include "components/user_prefs/user_prefs.h" |
46 #include "content/public/browser/navigation_entry.h" | 49 #include "content/public/browser/navigation_entry.h" |
47 #include "content/public/browser/render_frame_host.h" | 50 #include "content/public/browser/render_frame_host.h" |
48 #include "ui/gfx/geometry/rect.h" | 51 #include "ui/gfx/geometry/rect.h" |
49 | 52 |
50 #if BUILDFLAG(ANDROID_JAVA_UI) | 53 #if BUILDFLAG(ANDROID_JAVA_UI) |
51 #include "chrome/browser/android/chrome_application.h" | 54 #include "chrome/browser/android/chrome_application.h" |
52 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 55 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
53 #else | 56 #else |
54 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 57 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 return false; | 332 return false; |
330 | 333 |
331 ssl_status = navigation_entry->GetSSL(); | 334 ssl_status = navigation_entry->GetSSL(); |
332 // Note: If changing the implementation below, also change | 335 // Note: If changing the implementation below, also change |
333 // AwAutofillClient::IsContextSecure. See crbug.com/505388 | 336 // AwAutofillClient::IsContextSecure. See crbug.com/505388 |
334 return ssl_status.security_style == content::SECURITY_STYLE_AUTHENTICATED && | 337 return ssl_status.security_style == content::SECURITY_STYLE_AUTHENTICATED && |
335 !(ssl_status.content_status & | 338 !(ssl_status.content_status & |
336 content::SSLStatus::RAN_INSECURE_CONTENT); | 339 content::SSLStatus::RAN_INSECURE_CONTENT); |
337 } | 340 } |
338 | 341 |
342 bool ChromeAutofillClient::ShouldShowSigninPromo() { | |
343 #if defined(OS_ANDROID) || defined(OS_IOS) | |
344 // TODO(crbug.com/626383): Implement sign-in promo for Android and iOS by | |
345 // changing the logic of StartSigninFlow() below. | |
346 return false; | |
347 #else | |
348 Profile* profile = | |
349 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | |
350 if (!profile) | |
Evan Stade
2016/07/08 17:34:58
can this actually be null? many other places in th
Mathieu
2016/07/08 18:10:01
Done.
| |
351 return false; | |
352 | |
353 return signin::ShouldShowPromo(profile); | |
354 #endif | |
355 } | |
356 | |
357 void ChromeAutofillClient::StartSigninFlow() { | |
358 // See ShouldShowSigninPromo. | |
359 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
360 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | |
Evan Stade
2016/07/08 17:34:58
ditto -- can this validly be null? I think it coul
Mathieu
2016/07/08 18:10:01
Good point. I'll check for existence of Browser in
| |
361 if (browser) { | |
362 browser->window()->ShowAvatarBubbleFromAvatarButton( | |
363 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | |
364 signin::ManageAccountsParams(), | |
365 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | |
366 } | |
367 #endif | |
368 } | |
369 | |
339 } // namespace autofill | 370 } // namespace autofill |
OLD | NEW |