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

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

Issue 8202011: Notify users about certain changes in installed extensions. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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
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_EXTENSION_GLOBAL_ERROR_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_GLOBAL_ERROR_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/callback.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/ui/global_error.h"
13 #include "chrome/common/extensions/extension.h"
14
15 class ExtensionService;
16
17 // This class encapsulates the UI we want to show users when certain events
18 // occur related to installed extensions.
19 class ExtensionGlobalError : public GlobalError {
20 public:
21 // |extension_service| must live longer than us.
asargent_no_longer_on_chrome 2011/10/07 21:25:34 FYI, ExtensionService has a WeakPtrFactory member
miket_OOO 2011/10/07 22:38:22 Cool. Done!
22 explicit ExtensionGlobalError(ExtensionService* extension_service);
23 virtual ~ExtensionGlobalError();
24
25 // Inform us that a given extension is of a certain type that the user
26 // hasn't yet acknowledged.
27 void AddExternalExtension(const std::string& id);
28 void AddBlacklistedExtension(const std::string& id);
29 void AddOrphanedExtension(const std::string& id);
30
31 // Returns sets replaying the IDs that have been added with the
32 // Add[...]Extension methods.
33 const ExtensionIdSet* get_external_extension_ids() const;
34 const ExtensionIdSet* get_blacklisted_extension_ids() const;
35 const ExtensionIdSet* get_orphaned_extension_ids() const;
36
37 typedef base::Callback<void(const ExtensionGlobalError&)>
38 ExtensionGlobalErrorCallback;
39
40 // Called when the user presses the "Accept" button on the alert.
41 void set_accept_callback(ExtensionGlobalErrorCallback callback);
42
43 // Called when the user presses the "Cancel" button on the alert.
44 void set_cancel_callback(ExtensionGlobalErrorCallback callback);
45
46 // Called when the alert is dismissed with no direct user action
47 // (e.g., the browser exits).
48 void set_closed_callback(ExtensionGlobalErrorCallback callback);
49
50 // GlobalError methods.
51 virtual bool HasBadge() OVERRIDE;
52 virtual bool HasMenuItem() OVERRIDE;
53 virtual int MenuItemCommandID() OVERRIDE;
54 virtual string16 MenuItemLabel() OVERRIDE;
55 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
56 virtual bool HasBubbleView() OVERRIDE;
57 virtual string16 GetBubbleViewTitle() OVERRIDE;
58 virtual string16 GetBubbleViewMessage() OVERRIDE;
59 virtual string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
60 virtual string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
61 virtual void BubbleViewDidClose() OVERRIDE;
62 virtual void BubbleViewAcceptButtonPressed() OVERRIDE;
63 virtual void BubbleViewCancelButtonPressed() OVERRIDE;
64
65 private:
66 ExtensionService* extension_service_;
67 scoped_ptr<ExtensionIdSet> external_extension_ids_;
68 scoped_ptr<ExtensionIdSet> blacklisted_extension_ids_;
69 scoped_ptr<ExtensionIdSet> orphaned_extension_ids_;
70 ExtensionGlobalErrorCallback accept_callback_;
71 ExtensionGlobalErrorCallback cancel_callback_;
72 ExtensionGlobalErrorCallback closed_callback_;
73 string16 message_; // Displayed in the body of the alert.
74
75 // For a given set of extension IDs, generates appropriate text
76 // describing what the user needs to know about them.
77 string16 GenerateMessageSection(const ExtensionIdSet* extensions,
78 int template_message_id);
79
80 // Generates the message displayed in the body of the alert.
81 string16 GenerateMessage();
82
83 DISALLOW_COPY_AND_ASSIGN(ExtensionGlobalError);
84 };
85
86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GLOBAL_ERROR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698