Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.h

Issue 2529603004: [Offline Pages] Expanding event logger to be used by harness. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATION_ BRIDGE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATION_ BRIDGE_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATION_ BRIDGE_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATION_ BRIDGE_H_
7 7
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_weak_ref.h" 9 #include "base/android/jni_weak_ref.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "components/offline_pages/background/request_coordinator.h" 12 #include "components/offline_pages/background/request_coordinator.h"
13 #include "components/offline_pages/background/request_notifier.h" 13 #include "components/offline_pages/background/request_notifier.h"
14 #include "components/offline_pages/offline_event_logger.h"
14 #include "components/offline_pages/offline_page_model.h" 15 #include "components/offline_pages/offline_page_model.h"
15 16
16 namespace content { 17 namespace content {
17 class BrowserContext; 18 class BrowserContext;
18 } 19 }
19 20
20 namespace offline_pages { 21 namespace offline_pages {
21 22
22 struct OfflinePageItem; 23 struct OfflinePageItem;
23 24
24 namespace android { 25 namespace android {
25 26
26 /** 27 /**
27 * Bridge for exposing native implementation which are used by evaluation. 28 * Bridge for exposing native implementation which are used by evaluation.
28 */ 29 */
29 class OfflinePageEvaluationBridge : public OfflinePageModel::Observer, 30 class OfflinePageEvaluationBridge : public OfflinePageModel::Observer,
30 public RequestCoordinator::Observer { 31 public RequestCoordinator::Observer,
32 public OfflineEventLogger::Client {
31 public: 33 public:
32 static bool Register(JNIEnv* env); 34 static bool Register(JNIEnv* env);
33 static std::unique_ptr<KeyedService> GetTestingRequestCoordinator( 35 static std::unique_ptr<KeyedService> GetTestingRequestCoordinator(
34 content::BrowserContext* context); 36 content::BrowserContext* context);
35 37
36 OfflinePageEvaluationBridge(JNIEnv* env, 38 OfflinePageEvaluationBridge(JNIEnv* env,
37 content::BrowserContext* browser_context, 39 content::BrowserContext* browser_context,
38 OfflinePageModel* offline_page_model, 40 OfflinePageModel* offline_page_model,
39 RequestCoordinator* request_coordinator); 41 RequestCoordinator* request_coordinator);
40 42
41 ~OfflinePageEvaluationBridge() override; 43 ~OfflinePageEvaluationBridge() override;
42 44
43 // OfflinePageModel::Observer implementation. 45 // OfflinePageModel::Observer implementation.
44 void OfflinePageModelLoaded(OfflinePageModel* model) override; 46 void OfflinePageModelLoaded(OfflinePageModel* model) override;
45 void OfflinePageModelChanged(OfflinePageModel* model) override; 47 void OfflinePageModelChanged(OfflinePageModel* model) override;
46 void OfflinePageDeleted(int64_t offline_id, 48 void OfflinePageDeleted(int64_t offline_id,
47 const ClientId& client_id) override; 49 const ClientId& client_id) override;
48 50
49 // RequestCoordinator::Observer implementation. 51 // RequestCoordinator::Observer implementation.
50 void OnAdded(const SavePageRequest& request) override; 52 void OnAdded(const SavePageRequest& request) override;
51 void OnCompleted(const SavePageRequest& request, 53 void OnCompleted(const SavePageRequest& request,
52 RequestNotifier::BackgroundSavePageResult status) override; 54 RequestNotifier::BackgroundSavePageResult status) override;
53 void OnChanged(const SavePageRequest& request) override; 55 void OnChanged(const SavePageRequest& request) override;
54 56
57 // OfflineEventLogger::Client implementation.
58 void CustomLog(const std::string& message) override;
59
60 // Gets all pages in offline page model.
55 void GetAllPages(JNIEnv* env, 61 void GetAllPages(JNIEnv* env,
56 const base::android::JavaParamRef<jobject>& obj, 62 const base::android::JavaParamRef<jobject>& obj,
57 const base::android::JavaParamRef<jobject>& j_result_obj, 63 const base::android::JavaParamRef<jobject>& j_result_obj,
58 const base::android::JavaParamRef<jobject>& j_callback_obj); 64 const base::android::JavaParamRef<jobject>& j_callback_obj);
59 65
60 // Return true if processing starts and callback is expected to be called. 66 // Return true if processing starts and callback is expected to be called.
61 // False otherwise. 67 // False otherwise.
62 bool PushRequestProcessing( 68 bool PushRequestProcessing(
63 JNIEnv* env, 69 JNIEnv* env,
64 const base::android::JavaParamRef<jobject>& obj, 70 const base::android::JavaParamRef<jobject>& obj,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // Not owned. 107 // Not owned.
102 RequestCoordinator* request_coordinator_; 108 RequestCoordinator* request_coordinator_;
103 109
104 DISALLOW_COPY_AND_ASSIGN(OfflinePageEvaluationBridge); 110 DISALLOW_COPY_AND_ASSIGN(OfflinePageEvaluationBridge);
105 }; 111 };
106 112
107 } // namespace android 113 } // namespace android
108 } // namespace offline_pages 114 } // namespace offline_pages
109 115
110 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATI ON_BRIDGE_H_ 116 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_EVALUATION_OFFLINE_PAGE_EVALUATI ON_BRIDGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698