OLD | NEW |
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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
11 #include "chrome/browser/ui/global_error/global_error.h" | 11 #include "chrome/browser/ui/global_error/global_error.h" |
12 #include "chrome/browser/ui/global_error/global_error_service.h" | 12 #include "chrome/browser/ui/global_error/global_error_service.h" |
13 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 13 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
15 #include "extensions/browser/extension_system.h" | 15 #include "extensions/browser/extension_system.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 namespace { | 20 namespace { |
21 // Non-modal GlobalError implementation that warns the user if extensions | 21 // Non-modal GlobalError implementation that warns the user if extensions |
22 // 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 |
23 // is redirected to chrome://extensions to inspect the errors. | 23 // is redirected to chrome://extensions to inspect the errors. |
24 class ErrorBadge : public GlobalError { | 24 class ErrorBadge : public GlobalError { |
25 public: | 25 public: |
26 explicit ErrorBadge(ExtensionWarningBadgeService* badge_service); | 26 explicit ErrorBadge(ExtensionWarningBadgeService* badge_service); |
27 virtual ~ErrorBadge(); | 27 virtual ~ErrorBadge(); |
28 | 28 |
29 // Implementation for GlobalError: | 29 // Implementation for GlobalError: |
30 virtual bool HasMenuItem() OVERRIDE; | 30 virtual bool HasMenuItem() override; |
31 virtual int MenuItemCommandID() OVERRIDE; | 31 virtual int MenuItemCommandID() override; |
32 virtual base::string16 MenuItemLabel() OVERRIDE; | 32 virtual base::string16 MenuItemLabel() override; |
33 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE; | 33 virtual void ExecuteMenuItem(Browser* browser) override; |
34 | 34 |
35 virtual bool HasBubbleView() OVERRIDE; | 35 virtual bool HasBubbleView() override; |
36 virtual bool HasShownBubbleView() OVERRIDE; | 36 virtual bool HasShownBubbleView() override; |
37 virtual void ShowBubbleView(Browser* browser) OVERRIDE; | 37 virtual void ShowBubbleView(Browser* browser) override; |
38 virtual GlobalErrorBubbleViewBase* GetBubbleView() OVERRIDE; | 38 virtual GlobalErrorBubbleViewBase* GetBubbleView() override; |
39 | 39 |
40 static int GetMenuItemCommandID(); | 40 static int GetMenuItemCommandID(); |
41 | 41 |
42 private: | 42 private: |
43 ExtensionWarningBadgeService* badge_service_; | 43 ExtensionWarningBadgeService* badge_service_; |
44 | 44 |
45 DISALLOW_COPY_AND_ASSIGN(ErrorBadge); | 45 DISALLOW_COPY_AND_ASSIGN(ErrorBadge); |
46 }; | 46 }; |
47 | 47 |
48 ErrorBadge::ErrorBadge(ExtensionWarningBadgeService* badge_service) | 48 ErrorBadge::ErrorBadge(ExtensionWarningBadgeService* badge_service) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Activate or hide the warning badge in case the current state is incorrect. | 137 // Activate or hide the warning badge in case the current state is incorrect. |
138 if (error && !show) { | 138 if (error && !show) { |
139 service->RemoveGlobalError(error); | 139 service->RemoveGlobalError(error); |
140 delete error; | 140 delete error; |
141 } else if (!error && show) { | 141 } else if (!error && show) { |
142 service->AddGlobalError(new ErrorBadge(this)); | 142 service->AddGlobalError(new ErrorBadge(this)); |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 } // namespace extensions | 146 } // namespace extensions |
OLD | NEW |