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

Side by Side Diff: chrome/browser/ui/ash/app_sync_ui_state.h

Issue 403843005: Cleanup/ Use ExtensionRegistry from app_sync_ui_state.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DependsOn Created 6 years, 5 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 (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/timer.h" 11 #include "base/timer/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/keyed_service/core/keyed_service.h" 13 #include "components/keyed_service/core/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 #include "extensions/browser/extension_registry_observer.h"
16 17
17 class AppSyncUIStateObserver; 18 class AppSyncUIStateObserver;
18 class Profile; 19 class Profile;
19 class ProfileSyncService; 20 class ProfileSyncService;
20 21
22 namespace extensions {
23 class ExtensionRegistry;
24 }
25
21 // AppSyncUIState watches app sync and installation and change its state 26 // AppSyncUIState watches app sync and installation and change its state
22 // accordingly. Its status is for UI display only. It only watches for new 27 // 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 28 // 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. 29 // user profile) and lasts for at the most 1 minute.
25 class AppSyncUIState : public KeyedService, 30 class AppSyncUIState : public KeyedService,
26 public content::NotificationObserver, 31 public ProfileSyncServiceObserver,
27 public ProfileSyncServiceObserver { 32 public extensions::ExtensionRegistryObserver {
28 public: 33 public:
29 enum Status { 34 enum Status {
30 STATUS_NORMAL, 35 STATUS_NORMAL,
31 STATUS_SYNCING, // Syncing apps or installing synced apps. 36 STATUS_SYNCING, // Syncing apps or installing synced apps.
32 STATUS_TIMED_OUT, // Timed out when waiting for sync to finish. 37 STATUS_TIMED_OUT, // Timed out when waiting for sync to finish.
33 }; 38 };
34 39
35 // Returns the instance for the given |profile|. It's a convenience wrapper 40 // Returns the instance for the given |profile|. It's a convenience wrapper
36 // of AppSyncUIStateFactory::GetForProfile. Note this function returns 41 // of AppSyncUIStateFactory::GetForProfile. Note this function returns
37 // NULL if ShouldObserveAppSyncForProfile returns false for |profile|. 42 // NULL if ShouldObserveAppSyncForProfile returns false for |profile|.
(...skipping 17 matching lines...) Expand all
55 void SetStatus(Status status); 60 void SetStatus(Status status);
56 61
57 // Checks and sets app sync status. If sync has not setup, do nothing. If sync 62 // Checks and sets app sync status. If sync has not setup, do nothing. If sync
58 // is completed and there is no pending synced extension install, sets 63 // is completed and there is no pending synced extension install, sets
59 // STATUS_SYNCING. Otherwise, sets STATUS_NORMAL. 64 // STATUS_SYNCING. Otherwise, sets STATUS_NORMAL.
60 void CheckAppSync(); 65 void CheckAppSync();
61 66
62 // Invoked when |max_syncing_status_timer_| fires. 67 // Invoked when |max_syncing_status_timer_| fires.
63 void OnMaxSyncingTimer(); 68 void OnMaxSyncingTimer();
64 69
65 // content::NotificationObserver overrides: 70 // extensions::ExtensionRegistryObserver overrides:
James Cook 2014/07/22 16:29:24 nit: Change this to match the order of the interfa
limasdf 2014/07/22 16:38:10 Done.
66 virtual void Observe(int type, 71 virtual void OnExtensionLoaded(
67 const content::NotificationSource& source, 72 content::BrowserContext* browser_context,
68 const content::NotificationDetails& details) OVERRIDE; 73 const extensions::Extension* extension) OVERRIDE;
69 74
70 // ProfileSyncServiceObserver overrides: 75 // ProfileSyncServiceObserver overrides:
71 virtual void OnStateChanged() OVERRIDE; 76 virtual void OnStateChanged() OVERRIDE;
72 77
73 content::NotificationRegistrar registrar_;
74
75 Profile* profile_; 78 Profile* profile_;
76 ProfileSyncService* sync_service_; 79 ProfileSyncService* sync_service_;
77 80
78 // Timer to limit how much time STATUS_SYNCING is allowed. 81 // Timer to limit how much time STATUS_SYNCING is allowed.
79 base::OneShotTimer<AppSyncUIState> max_syncing_status_timer_; 82 base::OneShotTimer<AppSyncUIState> max_syncing_status_timer_;
80 83
81 Status status_; 84 Status status_;
82 ObserverList<AppSyncUIStateObserver> observers_; 85 ObserverList<AppSyncUIStateObserver> observers_;
83 86
87 extensions::ExtensionRegistry* extension_registry_;
88
84 DISALLOW_COPY_AND_ASSIGN(AppSyncUIState); 89 DISALLOW_COPY_AND_ASSIGN(AppSyncUIState);
85 }; 90 };
86 91
87 #endif // CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_ 92 #endif // CHROME_BROWSER_UI_ASH_APP_SYNC_UI_STATE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/app_sync_ui_state.cc » ('j') | chrome/browser/ui/ash/app_sync_ui_state.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698