| 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_global_error_badge.h" | 5 #include "chrome/browser/extensions/extension_global_error_badge.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
| 10 #include "chrome/browser/extensions/extension_warning_set.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_commands.h" | 13 #include "chrome/browser/ui/browser_commands.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 | 16 |
| 16 ExtensionGlobalErrorBadge::ExtensionGlobalErrorBadge() {} | 17 ExtensionGlobalErrorBadge::ExtensionGlobalErrorBadge() {} |
| 17 | 18 |
| 18 ExtensionGlobalErrorBadge::~ExtensionGlobalErrorBadge() {} | 19 ExtensionGlobalErrorBadge::~ExtensionGlobalErrorBadge() {} |
| 19 | 20 |
| 20 bool ExtensionGlobalErrorBadge::HasBadge() { | 21 bool ExtensionGlobalErrorBadge::HasBadge() { |
| 21 return true; | 22 return true; |
| 22 } | 23 } |
| 23 | 24 |
| 24 bool ExtensionGlobalErrorBadge::HasMenuItem() { | 25 bool ExtensionGlobalErrorBadge::HasMenuItem() { |
| 25 return true; | 26 return true; |
| 26 } | 27 } |
| 27 | 28 |
| 28 int ExtensionGlobalErrorBadge::MenuItemCommandID() { | 29 int ExtensionGlobalErrorBadge::MenuItemCommandID() { |
| 29 return GetMenuItemCommandID(); | 30 return GetMenuItemCommandID(); |
| 30 } | 31 } |
| 31 | 32 |
| 32 string16 ExtensionGlobalErrorBadge::MenuItemLabel() { | 33 string16 ExtensionGlobalErrorBadge::MenuItemLabel() { |
| 33 return l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_WRENCH_MENU_ITEM); | 34 return l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_WRENCH_MENU_ITEM); |
| 34 } | 35 } |
| 35 | 36 |
| 36 void ExtensionGlobalErrorBadge::ExecuteMenuItem(Browser* browser) { | 37 void ExtensionGlobalErrorBadge::ExecuteMenuItem(Browser* browser) { |
| 37 ExtensionService* extension_service = | 38 extensions::ExtensionWarningService* warning_service = |
| 38 browser->profile()->GetExtensionService(); | 39 extensions::ExtensionSystem::Get(browser->profile())->warning_service(); |
| 39 | 40 |
| 40 // Suppress all current warnings in the extension service from triggering | 41 // Suppress all current warnings in the extension service from triggering |
| 41 // a badge on the wrench menu in the future of this session. | 42 // a badge on the wrench menu in the future of this session. |
| 42 extension_service->extension_warnings()->SuppressBadgeForCurrentWarnings(); | 43 warning_service->SuppressBadgeForCurrentWarnings(); |
| 43 | 44 |
| 44 chrome::ExecuteCommand(browser, IDC_MANAGE_EXTENSIONS); | 45 chrome::ExecuteCommand(browser, IDC_MANAGE_EXTENSIONS); |
| 45 } | 46 } |
| 46 | 47 |
| 47 bool ExtensionGlobalErrorBadge::HasBubbleView() { | 48 bool ExtensionGlobalErrorBadge::HasBubbleView() { |
| 48 return false; | 49 return false; |
| 49 } | 50 } |
| 50 | 51 |
| 51 string16 ExtensionGlobalErrorBadge::GetBubbleViewTitle() { | 52 string16 ExtensionGlobalErrorBadge::GetBubbleViewTitle() { |
| 52 return string16(); | 53 return string16(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 74 | 75 |
| 75 void ExtensionGlobalErrorBadge::BubbleViewCancelButtonPressed( | 76 void ExtensionGlobalErrorBadge::BubbleViewCancelButtonPressed( |
| 76 Browser* browser) { | 77 Browser* browser) { |
| 77 NOTREACHED(); | 78 NOTREACHED(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 // static | 81 // static |
| 81 int ExtensionGlobalErrorBadge::GetMenuItemCommandID() { | 82 int ExtensionGlobalErrorBadge::GetMenuItemCommandID() { |
| 82 return IDC_EXTENSION_ERRORS; | 83 return IDC_EXTENSION_ERRORS; |
| 83 } | 84 } |
| OLD | NEW |