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

Side by Side Diff: chrome/browser/extensions/default_apps_provider.h

Issue 8245018: Remove race condition when installing default apps into a new profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing review comments Created 9 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_EXTENSIONS_DEFAULT_APPS_PROVIDER_H_
6 #define CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_PROVIDER_H_
7 #pragma once
8
9 #include "chrome/browser/extensions/external_extension_provider_impl.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12
13 class ExternalExtensionLoader;
14 class PrefService;
15 class Profile;
16
17 namespace base {
18 class DictionaryValue;
19 }
20
21 // A provider of apps that are installed by default into all new profiles.
22 class DefaultAppsProvider : public ExternalExtensionProviderImpl,
23 public content::NotificationObserver {
24 public:
25 // These values are persisted in the user preferences so values should not
26 // be changed.
27 enum InstallState {
28 kInstallNotStarted,
29 kInstalling,
30 kInstallDone
31 };
32
33 DefaultAppsProvider(VisitorInterface* service,
34 ExternalExtensionLoader* loader,
35 Profile* profile);
36 virtual ~DefaultAppsProvider();
37
38 // Register preference properties used by DefaultAppsProvider to maintain
39 // install state.
40 static void RegisterUserPrefs(PrefService* prefs);
41
42 // Determines whether default apps should be installed into the specified
43 // profile. If true, then an instance of DefaultAppsProvider should be
44 // added to the external providers list.
45 static bool ShouldRegister(Profile* profile);
46
47 // ExternalExtensionProviderImpl overrides:
48 virtual void SetPrefs(base::DictionaryValue* prefs) OVERRIDE;
49 virtual void ServiceShutdown() OVERRIDE;
50 virtual void VisitRegisteredExtension() const OVERRIDE;
51
52 // Implementation of NotificationObserver:
53 virtual void Observe(int type,
54 const content::NotificationSource& source,
55 const content::NotificationDetails& details) OVERRIDE;
56
57 // Used only for testing.
58 const std::set<std::string>& install_error_extensions() const {
59 return install_error_extensions_;
60 }
61
62 private:
63 Profile* profile_;
64 content::NotificationRegistrar registrar_;
65
66 // Set of extensions that failed to install for some reason.
67 std::set<std::string> install_error_extensions_;
68
69 DISALLOW_COPY_AND_ASSIGN(DefaultAppsProvider);
70 };
71
72 #endif // CHROME_BROWSER_EXTENSIONS_DEFAULT_APPS_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/default_apps_provider.cc » ('j') | chrome/browser/extensions/default_apps_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698