Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_error_controller.h
blob06c061383f097759fa33ee3f39243785e129c679
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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_CONTROLLER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_CONTROLLER_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/extensions/extension_error_ui.h"
10 #include "extensions/common/extension_set.h"
12 namespace content {
13 class BrowserContext;
16 namespace extensions {
18 // The controller for the ExtensionErrorUI. This examines extensions for any
19 // blacklisted or external extensions in order to notify the user with an error.
20 // On acceptance, this will acknowledge the extensions.
21 class ExtensionErrorController : public ExtensionErrorUI::Delegate {
22 public:
23 typedef ExtensionErrorUI* (*UICreateMethod)(ExtensionErrorUI::Delegate*);
25 ExtensionErrorController(content::BrowserContext* context, bool is_first_run);
26 virtual ~ExtensionErrorController();
28 void ShowErrorIfNeeded();
30 // Set the factory method for creating a new ExtensionErrorUI.
31 static void SetUICreateMethodForTesting(UICreateMethod method);
33 private:
34 // ExtensionErrorUI::Delegate implementation:
35 content::BrowserContext* GetContext() override;
36 const ExtensionSet& GetExternalExtensions() override;
37 const ExtensionSet& GetBlacklistedExtensions() override;
38 void OnAlertDetails() override;
39 void OnAlertAccept() override;
40 void OnAlertClosed() override;
42 // Find any extensions that the user should be alerted about (like blacklisted
43 // extensions).
44 void IdentifyAlertableExtensions();
46 // TODO(rdevlin.cronin): We never seem to use |external_extensions_| here,
47 // but we do warn about them. Investigate more.
48 ExtensionSet external_extensions_;
50 // The extensions that are blacklisted and need user approval.
51 ExtensionSet blacklisted_extensions_;
53 // The UI component of this controller.
54 scoped_ptr<ExtensionErrorUI> error_ui_;
56 // The BrowserContext with which we are associated.
57 content::BrowserContext* browser_context_;
59 // Whether or not this is the first run. If it is, we avoid noisy errors, and
60 // silently acknowledge blacklisted extensions.
61 bool is_first_run_;
63 DISALLOW_COPY_AND_ASSIGN(ExtensionErrorController);
66 } // namespace extensions
68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ERROR_CONTROLLER_H_