OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_UI_ASH_APP_SYNC_UI_STATE_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ |
6 #define CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ | 6 #define CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
12 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
13 #include "components/sync/driver/sync_service_observer.h" | 13 #include "components/sync/driver/sync_service_observer.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "extensions/browser/extension_registry_observer.h" | 16 #include "extensions/browser/extension_registry_observer.h" |
17 | 17 |
18 class AppSyncUIStateObserver; | 18 class AppSyncUIStateObserver; |
19 class Profile; | 19 class Profile; |
| 20 |
| 21 namespace browser_sync { |
20 class ProfileSyncService; | 22 class ProfileSyncService; |
| 23 } // namespace browser_sync |
21 | 24 |
22 namespace extensions { | 25 namespace extensions { |
23 class ExtensionRegistry; | 26 class ExtensionRegistry; |
24 } | 27 } // namespace extensions |
25 | 28 |
26 // AppSyncUIState watches app sync and installation and change its state | 29 // AppSyncUIState watches app sync and installation and change its state |
27 // accordingly. Its status is for UI display only. It only watches for new | 30 // accordingly. Its status is for UI display only. It only watches for new |
28 // normal user profile (i.e. it does not watch for guest profile or exsiting | 31 // normal user profile (i.e. it does not watch for guest profile or exsiting |
29 // user profile) and lasts for at the most 1 minute. | 32 // user profile) and lasts for at the most 1 minute. |
30 class AppSyncUIState : public KeyedService, | 33 class AppSyncUIState : public KeyedService, |
31 public sync_driver::SyncServiceObserver, | 34 public sync_driver::SyncServiceObserver, |
32 public extensions::ExtensionRegistryObserver { | 35 public extensions::ExtensionRegistryObserver { |
33 public: | 36 public: |
34 enum Status { | 37 enum Status { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void OnMaxSyncingTimer(); | 71 void OnMaxSyncingTimer(); |
69 | 72 |
70 // sync_driver::SyncServiceObserver overrides: | 73 // sync_driver::SyncServiceObserver overrides: |
71 void OnStateChanged() override; | 74 void OnStateChanged() override; |
72 | 75 |
73 // extensions::ExtensionRegistryObserver overrides: | 76 // extensions::ExtensionRegistryObserver overrides: |
74 void OnExtensionLoaded(content::BrowserContext* browser_context, | 77 void OnExtensionLoaded(content::BrowserContext* browser_context, |
75 const extensions::Extension* extension) override; | 78 const extensions::Extension* extension) override; |
76 | 79 |
77 Profile* profile_; | 80 Profile* profile_; |
78 ProfileSyncService* sync_service_; | 81 browser_sync::ProfileSyncService* sync_service_; |
79 | 82 |
80 // Timer to limit how much time STATUS_SYNCING is allowed. | 83 // Timer to limit how much time STATUS_SYNCING is allowed. |
81 base::OneShotTimer max_syncing_status_timer_; | 84 base::OneShotTimer max_syncing_status_timer_; |
82 | 85 |
83 Status status_; | 86 Status status_; |
84 base::ObserverList<AppSyncUIStateObserver> observers_; | 87 base::ObserverList<AppSyncUIStateObserver> observers_; |
85 | 88 |
86 extensions::ExtensionRegistry* extension_registry_; | 89 extensions::ExtensionRegistry* extension_registry_; |
87 | 90 |
88 DISALLOW_COPY_AND_ASSIGN(AppSyncUIState); | 91 DISALLOW_COPY_AND_ASSIGN(AppSyncUIState); |
89 }; | 92 }; |
90 | 93 |
91 #endif // CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ | 94 #endif // CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ |
OLD | NEW |