Index: chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerServiceFactory.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerServiceFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerServiceFactory.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..19ea5a57f9dc99a74e63419330c0e6ebeb706eb0 |
--- /dev/null |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerServiceFactory.java |
@@ -0,0 +1,36 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.chrome.browser.dom_distiller; |
+ |
+import java.util.HashMap; |
+ |
+import org.chromium.chrome.browser.profiles.Profile; |
+import org.chromium.components.dom_distiller.core.DomDistillerService; |
+ |
+/** |
+ * Returns Java DomDistillerService. |
robliao
2014/06/27 17:37:12
This comment should go with getDomDistillerService
sunangel
2014/06/27 18:00:08
Done.
|
+ */ |
+public class DomDistillerServiceFactory { |
+ |
+ static HashMap<Profile, DomDistillerService> profiles_to_DDS = |
+ new HashMap<Profile, DomDistillerService>(); |
+ |
+ public static DomDistillerService getDomDistillerServiceForProfile( |
+ Profile profile) { |
+ DomDistillerService mDDS; |
+ if (profiles_to_DDS.get(profile) == null) { |
+ mDDS = new DomDistillerService( |
+ nativeGetDomDistillerServiceForProfile(profile)); |
+ profiles_to_DDS.put(profile, mDDS); |
+ } |
+ else { |
+ mDDS = profiles_to_DDS.get(profile); |
+ } |
+ return mDDS; |
+ } |
+ |
+ private static native long nativeGetDomDistillerServiceForProfile( |
+ Profile profile); |
+} |