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

Side by Side Diff: chrome/browser/sync/internal_api/js_mutation_event_observer.h

Issue 10147003: [Sync] Move 'syncapi_core' and 'sync_unit_tests' targets to sync/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win update errors Created 8 years, 8 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_
6 #define CHROME_BROWSER_SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/non_thread_safe.h"
15 #include "chrome/browser/sync/internal_api/sync_manager.h"
16 #include "sync/syncable/transaction_observer.h"
17 #include "sync/util/weak_handle.h"
18
19 namespace tracked_objects {
20 class Location;
21 } // namespace tracked_objects
22
23 namespace browser_sync {
24
25 class JsEventDetails;
26 class JsEventHandler;
27
28 // Observes all change- and transaction-related events and routes a
29 // summarized version to a JsEventHandler.
30 class JsMutationEventObserver
31 : public sync_api::SyncManager::ChangeObserver,
32 public syncable::TransactionObserver {
33 public:
34 JsMutationEventObserver();
35
36 virtual ~JsMutationEventObserver();
37
38 base::WeakPtr<JsMutationEventObserver> AsWeakPtr();
39
40 void InvalidateWeakPtrs();
41
42 void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler);
43
44 // sync_api::SyncManager::ChangeObserver implementation.
45 virtual void OnChangesApplied(
46 syncable::ModelType model_type,
47 int64 write_transaction_id,
48 const sync_api::ImmutableChangeRecordList& changes) OVERRIDE;
49 virtual void OnChangesComplete(syncable::ModelType model_type) OVERRIDE;
50
51 // syncable::TransactionObserver implementation.
52 virtual void OnTransactionWrite(
53 const syncable::ImmutableWriteTransactionInfo& write_transaction_info,
54 syncable::ModelTypeSet models_with_changes) OVERRIDE;
55
56 private:
57 base::NonThreadSafe non_thread_safe_;
58 base::WeakPtrFactory<JsMutationEventObserver> weak_ptr_factory_;
59 WeakHandle<JsEventHandler> event_handler_;
60
61 void HandleJsEvent(
62 const tracked_objects::Location& from_here,
63 const std::string& name, const JsEventDetails& details);
64
65 DISALLOW_COPY_AND_ASSIGN(JsMutationEventObserver);
66 };
67
68 } // namespace browser_sync
69
70 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_JS_MUTATION_EVENT_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698