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

Side by Side Diff: components/sync_sessions/session_data_type_controller.h

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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 #ifndef COMPONENTS_SYNC_SESSIONS_SESSION_DATA_TYPE_CONTROLLER_H_ 5 #ifndef COMPONENTS_SYNC_SESSIONS_SESSION_DATA_TYPE_CONTROLLER_H_
6 #define COMPONENTS_SYNC_SESSIONS_SESSION_DATA_TYPE_CONTROLLER_H_ 6 #define COMPONENTS_SYNC_SESSIONS_SESSION_DATA_TYPE_CONTROLLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/prefs/pref_change_registrar.h" 11 #include "components/prefs/pref_change_registrar.h"
12 #include "components/sync/device_info/local_device_info_provider.h" 12 #include "components/sync/device_info/local_device_info_provider.h"
13 #include "components/sync/driver/ui_data_type_controller.h" 13 #include "components/sync/driver/ui_data_type_controller.h"
14 14
15 namespace sync_sessions { 15 namespace sync_sessions {
16 16
17 // Overrides StartModels to avoid sync contention with sessions during 17 // Overrides StartModels to avoid sync contention with sessions during
18 // a session restore operation at startup and to wait for the local 18 // a session restore operation at startup and to wait for the local
19 // device info to become available. 19 // device info to become available.
20 class SessionDataTypeController : public syncer::UIDataTypeController { 20 class SessionDataTypeController : public sync_driver::UIDataTypeController {
21 public: 21 public:
22 // |dump_stack| is called when an unrecoverable error occurs. 22 // |dump_stack| is called when an unrecoverable error occurs.
23 SessionDataTypeController(const base::Closure& dump_stack, 23 SessionDataTypeController(const base::Closure& dump_stack,
24 syncer::SyncClient* sync_client, 24 sync_driver::SyncClient* sync_client,
25 syncer::LocalDeviceInfoProvider* local_device, 25 sync_driver::LocalDeviceInfoProvider* local_device,
26 const char* history_disabled_pref_name); 26 const char* history_disabled_pref_name);
27 ~SessionDataTypeController() override; 27 ~SessionDataTypeController() override;
28 28
29 // UIDataTypeController interface. 29 // UIDataTypeController interface.
30 bool StartModels() override; 30 bool StartModels() override;
31 void StopModels() override; 31 void StopModels() override;
32 bool ReadyForStart() const override; 32 bool ReadyForStart() const override;
33 33
34 // Called when asynchronous session restore has completed. 34 // Called when asynchronous session restore has completed.
35 void OnSessionRestoreComplete(); 35 void OnSessionRestoreComplete();
36 36
37 private: 37 private:
38 bool IsWaiting(); 38 bool IsWaiting();
39 void MaybeCompleteLoading(); 39 void MaybeCompleteLoading();
40 void OnLocalDeviceInfoInitialized(); 40 void OnLocalDeviceInfoInitialized();
41 void OnSavingBrowserHistoryPrefChanged(); 41 void OnSavingBrowserHistoryPrefChanged();
42 42
43 syncer::SyncClient* const sync_client_; 43 sync_driver::SyncClient* const sync_client_;
44 44
45 syncer::LocalDeviceInfoProvider* const local_device_; 45 sync_driver::LocalDeviceInfoProvider* const local_device_;
46 std::unique_ptr<syncer::LocalDeviceInfoProvider::Subscription> subscription_; 46 std::unique_ptr<sync_driver::LocalDeviceInfoProvider::Subscription>
47 subscription_;
47 48
48 // Name of the pref that indicates whether saving history is disabled. 49 // Name of the pref that indicates whether saving history is disabled.
49 const char* history_disabled_pref_name_; 50 const char* history_disabled_pref_name_;
50 51
51 // Flags that indicate the reason for pending loading models. 52 // Flags that indicate the reason for pending loading models.
52 bool waiting_on_session_restore_; 53 bool waiting_on_session_restore_;
53 bool waiting_on_local_device_info_; 54 bool waiting_on_local_device_info_;
54 55
55 PrefChangeRegistrar pref_registrar_; 56 PrefChangeRegistrar pref_registrar_;
56 57
57 DISALLOW_COPY_AND_ASSIGN(SessionDataTypeController); 58 DISALLOW_COPY_AND_ASSIGN(SessionDataTypeController);
58 }; 59 };
59 60
60 } // namespace sync_sessions 61 } // namespace sync_sessions
61 62
62 #endif // COMPONENTS_SYNC_SESSIONS_SESSION_DATA_TYPE_CONTROLLER_H_ 63 #endif // COMPONENTS_SYNC_SESSIONS_SESSION_DATA_TYPE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « components/sync_bookmarks/bookmark_model_associator.cc ('k') | components/sync_sessions/session_data_type_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698