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 package org.chromium.chrome.browser.autofill; | 5 package org.chromium.chrome.browser.autofill; |
6 | 6 |
7 import org.chromium.base.VisibleForTesting; | 7 import org.chromium.base.VisibleForTesting; |
8 import org.chromium.base.annotations.CalledByNative; | 8 import org.chromium.base.annotations.CalledByNative; |
9 import org.chromium.base.annotations.JNINamespace; | 9 import org.chromium.base.annotations.JNINamespace; |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 /** | 39 /** |
40 * A logger interface. Uses LogItem instead of individual fields to allow | 40 * A logger interface. Uses LogItem instead of individual fields to allow |
41 * changing the items that are logged without breaking the embedder. | 41 * changing the items that are logged without breaking the embedder. |
42 */ | 42 */ |
43 public interface Logger { | 43 public interface Logger { |
44 public void didFillField(LogEntry logItem); | 44 public void didFillField(LogEntry logItem); |
45 } | 45 } |
46 | 46 |
47 private static Logger sLogger = null; | 47 private static Logger sLogger; |
48 private static Logger sLoggerForTest = null; | 48 private static Logger sLoggerForTest; |
49 | 49 |
50 @VisibleForTesting | 50 @VisibleForTesting |
51 public static void setLogger(Logger logger) { | 51 public static void setLogger(Logger logger) { |
52 sLogger = logger; | 52 sLogger = logger; |
53 } | 53 } |
54 | 54 |
55 @VisibleForTesting | 55 @VisibleForTesting |
56 public static void setLoggerForTesting(Logger logger) { | 56 public static void setLoggerForTesting(Logger logger) { |
57 sLoggerForTest = logger; | 57 sLoggerForTest = logger; |
58 } | 58 } |
59 | 59 |
60 @CalledByNative | 60 @CalledByNative |
61 private static void didFillField(String autofilledValue, String profileFullN
ame) { | 61 private static void didFillField(String autofilledValue, String profileFullN
ame) { |
62 if (sLogger != null) { | 62 if (sLogger != null) { |
63 sLogger.didFillField(new LogEntry(autofilledValue, profileFullName))
; | 63 sLogger.didFillField(new LogEntry(autofilledValue, profileFullName))
; |
64 } | 64 } |
65 | 65 |
66 if (sLoggerForTest != null) { | 66 if (sLoggerForTest != null) { |
67 sLoggerForTest.didFillField(new LogEntry(autofilledValue, profileFul
lName)); | 67 sLoggerForTest.didFillField(new LogEntry(autofilledValue, profileFul
lName)); |
68 } | 68 } |
69 } | 69 } |
70 } | 70 } |
OLD | NEW |