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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 30 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
31 #endif | 31 #endif |
32 | 32 |
33 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 33 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
34 | 34 |
35 namespace autofill { | 35 namespace autofill { |
36 | 36 |
37 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 37 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
38 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { | 38 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { |
39 DCHECK(web_contents); | 39 DCHECK(web_contents); |
| 40 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 41 RegisterForKeystoneNotifications(); |
| 42 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
40 } | 43 } |
41 | 44 |
42 ChromeAutofillClient::~ChromeAutofillClient() { | 45 ChromeAutofillClient::~ChromeAutofillClient() { |
43 // NOTE: It is too late to clean up the autofill popup; that cleanup process | 46 // NOTE: It is too late to clean up the autofill popup; that cleanup process |
44 // requires that the WebContents instance still be valid and it is not at | 47 // requires that the WebContents instance still be valid and it is not at |
45 // this point (in particular, the WebContentsImpl destructor has already | 48 // this point (in particular, the WebContentsImpl destructor has already |
46 // finished running and we are now in the base class destructor). | 49 // finished running and we are now in the base class destructor). |
47 DCHECK(!popup_controller_); | 50 DCHECK(!popup_controller_); |
| 51 |
| 52 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 53 UnregisterFromKeystoneNotifications(); |
| 54 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
48 } | 55 } |
49 | 56 |
50 void ChromeAutofillClient::TabActivated() { | 57 void ChromeAutofillClient::TabActivated() { |
51 if (dialog_controller_.get()) | 58 if (dialog_controller_.get()) |
52 dialog_controller_->TabActivated(); | 59 dialog_controller_->TabActivated(); |
53 } | 60 } |
54 | 61 |
55 PersonalDataManager* ChromeAutofillClient::GetPersonalDataManager() { | 62 PersonalDataManager* ChromeAutofillClient::GetPersonalDataManager() { |
56 Profile* profile = | 63 Profile* profile = |
57 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 64 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void ChromeAutofillClient::DidFillOrPreviewField( | 185 void ChromeAutofillClient::DidFillOrPreviewField( |
179 const base::string16& autofilled_value, | 186 const base::string16& autofilled_value, |
180 const base::string16& profile_full_name) { | 187 const base::string16& profile_full_name) { |
181 #if defined(OS_ANDROID) | 188 #if defined(OS_ANDROID) |
182 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, | 189 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, |
183 profile_full_name); | 190 profile_full_name); |
184 #endif // defined(OS_ANDROID) | 191 #endif // defined(OS_ANDROID) |
185 } | 192 } |
186 | 193 |
187 } // namespace autofill | 194 } // namespace autofill |
OLD | NEW |