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

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: Change #if false to #if 0 for win compiler. 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_global_error.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/memory/weak_ptr.h"
13 #include "chrome/browser/ui/global_error.h"
14 #include "chrome/common/extensions/extension.h"
15
16 class ExtensionService;
17
18 // This class encapsulates the UI we want to show users when certain events
19 // occur related to installed extensions.
20 class ExtensionGlobalError : public GlobalError {
21 public:
22 explicit ExtensionGlobalError(
23 base::WeakPtr<ExtensionService> extension_service);
24 virtual ~ExtensionGlobalError();
25
26 // Inform us that a given extension is of a certain type that the user
27 // hasn't yet acknowledged.
28 void AddExternalExtension(const std::string& id);
29 void AddBlacklistedExtension(const std::string& id);
30 void AddOrphanedExtension(const std::string& id);
31
32 // Returns sets replaying the IDs that have been added with the
33 // Add[...]Extension methods.
34 const ExtensionIdSet* get_external_extension_ids() const {
35 return external_extension_ids_.get();
36 }
37
38 const ExtensionIdSet* get_blacklisted_extension_ids() const {
39 return blacklisted_extension_ids_.get();
40 }
41
42 const ExtensionIdSet* get_orphaned_extension_ids() const {
43 return orphaned_extension_ids_.get();
44 }
45
46 typedef base::Callback<void(const ExtensionGlobalError&)>
47 ExtensionGlobalErrorCallback;
48
49 // Called when the user presses the "Accept" button on the alert.
50 void set_accept_callback(ExtensionGlobalErrorCallback callback);
51
52 // Called when the user presses the "Cancel" button on the alert.
53 void set_cancel_callback(ExtensionGlobalErrorCallback callback);
54
55 // Called when the alert is dismissed with no direct user action
56 // (e.g., the browser exits).
57 void set_closed_callback(ExtensionGlobalErrorCallback callback);
58
59 // GlobalError methods.
60 virtual bool HasBadge() OVERRIDE;
61 virtual bool HasMenuItem() OVERRIDE;
62 virtual int MenuItemCommandID() OVERRIDE;
63 virtual string16 MenuItemLabel() OVERRIDE;
64 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
65 virtual bool HasBubbleView() OVERRIDE;
66 virtual string16 GetBubbleViewTitle() OVERRIDE;
67 virtual string16 GetBubbleViewMessage() OVERRIDE;
68 virtual string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
69 virtual string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
70 virtual void BubbleViewDidClose() OVERRIDE;
71 virtual void BubbleViewAcceptButtonPressed() OVERRIDE;
72 virtual void BubbleViewCancelButtonPressed() OVERRIDE;
73
74 private:
75 base::WeakPtr<ExtensionService> extension_service_;
76 scoped_ptr<ExtensionIdSet> external_extension_ids_;
77 scoped_ptr<ExtensionIdSet> blacklisted_extension_ids_;
78 scoped_ptr<ExtensionIdSet> orphaned_extension_ids_;
79 ExtensionGlobalErrorCallback accept_callback_;
80 ExtensionGlobalErrorCallback cancel_callback_;
81 ExtensionGlobalErrorCallback closed_callback_;
82 string16 message_; // Displayed in the body of the alert.
83
84 // For a given set of extension IDs, generates appropriate text
85 // describing what the user needs to know about them.
86 string16 GenerateMessageSection(const ExtensionIdSet* extensions,
87 int template_message_id);
88
89 // Generates the message displayed in the body of the alert.
90 string16 GenerateMessage();
91
92 DISALLOW_COPY_AND_ASSIGN(ExtensionGlobalError);
93 };
94
95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_GLOBAL_ERROR_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_global_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698