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

Side by Side Diff: chrome/browser/extensions/extension_warning_badge_service.cc

Issue 15745022: Add custom icon support to GlobalError. Show extension icon in permissions increase bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no icon ok Created 7 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_warning_badge_service.h" 5 #include "chrome/browser/extensions/extension_warning_badge_service.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/ui/global_error/global_error.h" 10 #include "chrome/browser/ui/global_error/global_error.h"
11 #include "chrome/browser/ui/global_error/global_error_service.h" 11 #include "chrome/browser/ui/global_error/global_error_service.h"
12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 12 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
13 #include "chrome/browser/ui/browser_commands.h" 13 #include "chrome/browser/ui/browser_commands.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/gfx/image/image.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 19
19 namespace { 20 namespace {
20 // Non-modal GlobalError implementation that warns the user if extensions 21 // Non-modal GlobalError implementation that warns the user if extensions
21 // created warnings or errors. If the user clicks on the wrench menu, the user 22 // created warnings or errors. If the user clicks on the wrench menu, the user
22 // is redirected to chrome://extensions to inspect the errors. 23 // is redirected to chrome://extensions to inspect the errors.
23 class ErrorBadge : public GlobalError { 24 class ErrorBadge : public GlobalError {
24 public: 25 public:
25 explicit ErrorBadge(ExtensionWarningBadgeService* badge_service); 26 explicit ErrorBadge(ExtensionWarningBadgeService* badge_service);
26 virtual ~ErrorBadge(); 27 virtual ~ErrorBadge();
27 28
28 // Implementation for GlobalError: 29 // Implementation for GlobalError:
29 virtual bool HasMenuItem() OVERRIDE; 30 virtual bool HasMenuItem() OVERRIDE;
30 virtual int MenuItemCommandID() OVERRIDE; 31 virtual int MenuItemCommandID() OVERRIDE;
31 virtual string16 MenuItemLabel() OVERRIDE; 32 virtual string16 MenuItemLabel() OVERRIDE;
32 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; 33 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE;
33 34
34 virtual bool HasBubbleView() OVERRIDE; 35 virtual bool HasBubbleView() OVERRIDE;
36 virtual gfx::Image GetBubbleViewIcon() OVERRIDE;
35 virtual string16 GetBubbleViewTitle() OVERRIDE; 37 virtual string16 GetBubbleViewTitle() OVERRIDE;
36 virtual std::vector<string16> GetBubbleViewMessages() OVERRIDE; 38 virtual std::vector<string16> GetBubbleViewMessages() OVERRIDE;
37 virtual string16 GetBubbleViewAcceptButtonLabel() OVERRIDE; 39 virtual string16 GetBubbleViewAcceptButtonLabel() OVERRIDE;
38 virtual string16 GetBubbleViewCancelButtonLabel() OVERRIDE; 40 virtual string16 GetBubbleViewCancelButtonLabel() OVERRIDE;
39 virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE; 41 virtual void OnBubbleViewDidClose(Browser* browser) OVERRIDE;
40 virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE; 42 virtual void BubbleViewAcceptButtonPressed(Browser* browser) OVERRIDE;
41 virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE; 43 virtual void BubbleViewCancelButtonPressed(Browser* browser) OVERRIDE;
42 44
43 static int GetMenuItemCommandID(); 45 static int GetMenuItemCommandID();
44 46
(...skipping 25 matching lines...) Expand all
70 // a badge on the wrench menu in the future of this session. 72 // a badge on the wrench menu in the future of this session.
71 badge_service_->SuppressCurrentWarnings(); 73 badge_service_->SuppressCurrentWarnings();
72 74
73 chrome::ExecuteCommand(browser, IDC_MANAGE_EXTENSIONS); 75 chrome::ExecuteCommand(browser, IDC_MANAGE_EXTENSIONS);
74 } 76 }
75 77
76 bool ErrorBadge::HasBubbleView() { 78 bool ErrorBadge::HasBubbleView() {
77 return false; 79 return false;
78 } 80 }
79 81
82 gfx::Image ErrorBadge::GetBubbleViewIcon() {
83 return gfx::Image();
84 }
85
80 string16 ErrorBadge::GetBubbleViewTitle() { 86 string16 ErrorBadge::GetBubbleViewTitle() {
81 return string16(); 87 return string16();
82 } 88 }
83 89
84 std::vector<string16> ErrorBadge::GetBubbleViewMessages() { 90 std::vector<string16> ErrorBadge::GetBubbleViewMessages() {
85 return std::vector<string16>(); 91 return std::vector<string16>();
86 } 92 }
87 93
88 string16 ErrorBadge::GetBubbleViewAcceptButtonLabel() { 94 string16 ErrorBadge::GetBubbleViewAcceptButtonLabel() {
89 return string16(); 95 return string16();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Activate or hide the warning badge in case the current state is incorrect. 168 // Activate or hide the warning badge in case the current state is incorrect.
163 if (error && !show) { 169 if (error && !show) {
164 service->RemoveGlobalError(error); 170 service->RemoveGlobalError(error);
165 delete error; 171 delete error;
166 } else if (!error && show) { 172 } else if (!error && show) {
167 service->AddGlobalError(new ErrorBadge(this)); 173 service->AddGlobalError(new ErrorBadge(this));
168 } 174 }
169 } 175 }
170 176
171 } // extensions 177 } // extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698