OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/personal_data_manager.h" | 5 #include "components/autofill/core/browser/personal_data_manager.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #import <AddressBook/AddressBook.h> | 9 #import <AddressBook/AddressBook.h> |
10 | 10 |
11 #include "base/format_macros.h" | 11 #include "base/format_macros.h" |
12 #include "base/guid.h" | 12 #include "base/guid.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #import "base/mac/scoped_nsexception_enabler.h" | |
15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
17 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
18 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
19 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
20 #include "base/strings/sys_string_conversions.h" | 19 #include "base/strings/sys_string_conversions.h" |
21 #include "base/time/time.h" | 20 #include "base/time/time.h" |
22 #include "components/autofill/core/browser/autofill_country.h" | 21 #include "components/autofill/core/browser/autofill_country.h" |
23 #include "components/autofill/core/browser/autofill_profile.h" | 22 #include "components/autofill/core/browser/autofill_profile.h" |
24 #include "components/autofill/core/browser/autofill_type.h" | 23 #include "components/autofill/core/browser/autofill_type.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 // weeks, and there are no major problems, rip out all the code. Expected | 114 // weeks, and there are no major problems, rip out all the code. Expected |
116 // removal date: 07/15/2015. http://crbug.com/488146. | 115 // removal date: 07/15/2015. http://crbug.com/488146. |
117 return nil; | 116 return nil; |
118 | 117 |
119 bool first_access = !HasQueriedMacAddressBook(pref_service); | 118 bool first_access = !HasQueriedMacAddressBook(pref_service); |
120 | 119 |
121 base::Time start_time = base::Time::Now(); | 120 base::Time start_time = base::Time::Now(); |
122 // +[ABAddressBook sharedAddressBook] throws an exception internally in | 121 // +[ABAddressBook sharedAddressBook] throws an exception internally in |
123 // circumstances that aren't clear. The exceptions are only observed in crash | 122 // circumstances that aren't clear. The exceptions are only observed in crash |
124 // reports, so it is unknown whether they would be caught by AppKit and nil | 123 // reports, so it is unknown whether they would be caught by AppKit and nil |
125 // returned, or if they would take down the app. In either case, avoid | 124 // returned, or if they would take down the app. |
126 // crashing. http://crbug.com/129022 | 125 // TODO(rsesek): If a crash is observed here, then the exception is not being |
127 ABAddressBook* addressBook = base::mac::RunBlockIgnoringExceptions( | 126 // caught by AppKit and it should be swallowed. http://crbug.com/129022 |
Avi (use Gerrit)
2015/07/28 13:23:17
I believe that exceptions actually do leak from he
Scott Hess - ex-Googler
2015/07/28 19:29:14
Looking at the crash server, I think it will be in
| |
128 ^{ return [ABAddressBook sharedAddressBook]; }); | 127 ABAddressBook* addressBook = [ABAddressBook sharedAddressBook]; |
129 UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailable", addressBook != nil); | 128 UMA_HISTOGRAM_BOOLEAN("Autofill.AddressBookAvailable", addressBook != nil); |
130 | 129 |
131 if (!g_accessed_address_book) { | 130 if (!g_accessed_address_book) { |
132 // The amount of time that the access takes gives a good indication as to | 131 // The amount of time that the access takes gives a good indication as to |
133 // whether the user was shown a prompt. | 132 // whether the user was shown a prompt. |
134 UMA_HISTOGRAM_TIMES("Autofill.MacAddressBook.AccessTime", | 133 UMA_HISTOGRAM_TIMES("Autofill.MacAddressBook.AccessTime", |
135 base::Time::Now() - start_time); | 134 base::Time::Now() - start_time); |
136 } | 135 } |
137 | 136 |
138 if (first_access) { | 137 if (first_access) { |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
495 | 494 |
496 int PersonalDataManager::AccessAddressBookPromptCount() { | 495 int PersonalDataManager::AccessAddressBookPromptCount() { |
497 return pref_service_->GetInteger(prefs::kAutofillMacAddressBookShowedCount); | 496 return pref_service_->GetInteger(prefs::kAutofillMacAddressBookShowedCount); |
498 } | 497 } |
499 | 498 |
500 void PersonalDataManager::BinaryChanging() { | 499 void PersonalDataManager::BinaryChanging() { |
501 g_binary_changed = true; | 500 g_binary_changed = true; |
502 } | 501 } |
503 | 502 |
504 } // namespace autofill | 503 } // namespace autofill |
OLD | NEW |