| 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/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "base/timer.h" | 11 #include "base/timer.h" |
| 12 #include "chrome/browser/sync/profile_sync_service_observer.h" | 12 #include "chrome/browser/sync/profile_sync_service_observer.h" |
| 13 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 13 #include "components/browser_context_keyed_service/browser_context_keyed_service
.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 | 16 |
| 17 class AppSyncUIStateObserver; | 17 class AppSyncUIStateObserver; |
| 18 class Profile; | 18 class Profile; |
| 19 class ProfileSyncService; | 19 class ProfileSyncService; |
| 20 | 20 |
| 21 // AppSyncUIState watches app sync and installation and change its state | 21 // AppSyncUIState watches app sync and installation and change its state |
| 22 // accordingly. Its status is for UI display only. It only watches for new | 22 // accordingly. Its status is for UI display only. It only watches for new |
| 23 // normal user profile (i.e. it does not watch for guest profile or exsiting | 23 // normal user profile (i.e. it does not watch for guest profile or exsiting |
| 24 // user profile) and lasts for at the most 1 minute. | 24 // user profile) and lasts for at the most 1 minute. |
| 25 class AppSyncUIState : public ProfileKeyedService, | 25 class AppSyncUIState : public BrowserContextKeyedService, |
| 26 public content::NotificationObserver, | 26 public content::NotificationObserver, |
| 27 public ProfileSyncServiceObserver { | 27 public ProfileSyncServiceObserver { |
| 28 public: | 28 public: |
| 29 enum Status { | 29 enum Status { |
| 30 STATUS_NORMAL, | 30 STATUS_NORMAL, |
| 31 STATUS_SYNCING, // Syncing apps or installing synced apps. | 31 STATUS_SYNCING, // Syncing apps or installing synced apps. |
| 32 STATUS_TIMED_OUT, // Timed out when waiting for sync to finish. | 32 STATUS_TIMED_OUT, // Timed out when waiting for sync to finish. |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Returns the instance for the given |profile|. It's a convenience wrapper | 35 // Returns the instance for the given |profile|. It's a convenience wrapper |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // Timer to limit how much time STATUS_SYNCING is allowed. | 78 // Timer to limit how much time STATUS_SYNCING is allowed. |
| 79 base::OneShotTimer<AppSyncUIState> max_syncing_status_timer_; | 79 base::OneShotTimer<AppSyncUIState> max_syncing_status_timer_; |
| 80 | 80 |
| 81 Status status_; | 81 Status status_; |
| 82 ObserverList<AppSyncUIStateObserver> observers_; | 82 ObserverList<AppSyncUIStateObserver> observers_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(AppSyncUIState); | 84 DISALLOW_COPY_AND_ASSIGN(AppSyncUIState); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 #endif // CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ | 87 #endif // CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ |
| OLD | NEW |