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

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

Issue 309643007: Resubmit: Refactor external_install_ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix 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 "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h"
13 #include "extensions/browser/extension_registry_observer.h"
14
15 class GlobalErrorService;
16
17 namespace content {
18 class BrowserContext;
19 class NotificationDetails;
20 class NotificationSource;
21 }
22
23 namespace extensions {
24 class Extension;
25 class ExtensionRegistry;
26 class ExternalInstallError;
27
28 class ExternalInstallManager : public ExtensionRegistryObserver,
29 public content::NotificationObserver {
30 public:
31 explicit ExternalInstallManager(content::BrowserContext* browser_context);
32 virtual ~ExternalInstallManager();
33
34 // Adds a global error informing the user that an external extension was
35 // installed. If |is_new_profile| is true, then this error is from the first
36 // time our profile checked for new extensions.
37 void AddExternalInstallError(const Extension* extension, bool is_new_profile);
38
39 // Removes the global error, if one existed.
40 void RemoveExternalInstallError();
41
42 // Returns true if there is a global error for an external install.
43 bool HasExternalInstallError() const;
44
45 // Returns true if there is a global error with a bubble view for an external
46 // install. Used for testing.
47 bool HasExternalInstallBubble() const;
48
49 // Returns the current install error, if one exists.
50 const ExternalInstallError* error() { return error_.get(); }
51
52 // Returns a mutable copy of the error for testing purposes.
53 ExternalInstallError* error_for_testing() { return error_.get(); }
54
55 private:
56 // ExtensionRegistryObserver implementation.
57 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
58 const Extension* extension) OVERRIDE;
59
60 // content::NotificationObserver implementation.
61 virtual void Observe(int type,
62 const content::NotificationSource& source,
63 const content::NotificationDetails& details) OVERRIDE;
64
65 // The associated BrowserContext.
66 content::BrowserContext* browser_context_;
67
68 // The current ExternalInstallError, if one exists.
69 scoped_ptr<ExternalInstallError> error_;
70
71 content::NotificationRegistrar registrar_;
72
73 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
74 extension_registry_observer_;
75
76 DISALLOW_COPY_AND_ASSIGN(ExternalInstallManager);
77 };
78
79 } // namespace extensions
80
81 #endif // CHROME_BROWSER_EXTENSIONS_EXTERNAL_INSTALL_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_install_error.cc ('k') | chrome/browser/extensions/external_install_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698