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

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

Issue 300853008: Refactor external_install_ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/scoped_observer.h"
11 #include "extensions/browser/extension_registry_observer.h"
12
13 class GlobalErrorService;
14
15 namespace content {
16 class BrowserContext;
17 }
18
19 namespace extensions {
20 class Extension;
21 class ExtensionRegistry;
22 class ExternalInstallError;
23
24 class ExternalInstallManager : public ExtensionRegistryObserver {
25 public:
26 explicit ExternalInstallManager(content::BrowserContext* browser_context);
27 virtual ~ExternalInstallManager();
28
29 // Adds a global error informing the user that an external extension was
30 // installed. If |is_new_profile| is true, then this error is from the first
31 // time our profile checked for new extensions.
32 void AddExternalInstallError(const Extension* extension, bool is_new_profile);
33
34 // Removes the global error, if one existed.
35 void RemoveExternalInstallError();
36
37 // Returns true if there is a global error for an external install.
38 bool HasExternalInstallError() const;
39
40 // Returns true if there is a global error with a bubble view for an external
41 // install. Used for testing.
42 bool HasExternalInstallBubble() const;
43
44 // Returns the current install error, if one exists.
45 const ExternalInstallError* error() { return error_.get(); }
46
47 private:
48 // ExtensionRegistryObserver implementation.
49 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
50 const Extension* extension) OVERRIDE;
51 virtual void OnExtensionUnloaded(
52 content::BrowserContext* browser_context,
53 const Extension* extension,
54 UnloadedExtensionInfo::Reason reason) OVERRIDE;
55
56 // The associated BrowserContext.
57 content::BrowserContext* browser_context_;
58
59 // The current ExternalInstallError, if one exists.
60 scoped_ptr<ExternalInstallError> error_;
61
62 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
63 extension_registry_observer_;
64
65 DISALLOW_COPY_AND_ASSIGN(ExternalInstallManager);
66 };
67
68 } // namespace extensions
69
70 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698