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

Unified Diff: chrome/browser/extensions/extension_global_error.cc

Issue 8176001: Warn user in case extension delays network traffic too much. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed Glen's comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_global_error.cc
diff --git a/chrome/browser/extensions/extension_global_error.cc b/chrome/browser/extensions/extension_global_error.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6e770df247a6c4072e2a3428ff3b04b48281ad15
--- /dev/null
+++ b/chrome/browser/extensions/extension_global_error.cc
@@ -0,0 +1,81 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_global_error.h"
+
+#include "base/logging.h"
+#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+
+ExtensionGlobalError::ExtensionGlobalError() {}
+
+ExtensionGlobalError::~ExtensionGlobalError() {}
+
+bool ExtensionGlobalError::HasBadge() {
+ return true;
+}
+
+bool ExtensionGlobalError::HasMenuItem() {
+ return true;
+}
+
+int ExtensionGlobalError::MenuItemCommandID() {
+ return IDC_EXTENSION_ERRORS;
+}
+
+string16 ExtensionGlobalError::MenuItemLabel() {
+ return l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_WRENCH_MENU_ITEM);
+}
+
+void ExtensionGlobalError::ExecuteMenuItem(Browser* browser) {
+ ExtensionService* extension_service =
+ browser->GetProfile()->GetExtensionService();
+
+ // Suppress all current warnings in the extension service from triggering
+ // a badge on the wrench menu in the future of this session.
+ ExtensionService::ExtensionWarningsType warnings =
+ extension_service->GetWarnings();
+ for (ExtensionService::ExtensionWarningsType::const_iterator i =
+ warnings.begin();
+ i != warnings.end(); ++i) {
+ extension_service->SuppressWarning(i->first);
+ }
+
+ browser->ExecuteCommand(IDC_MANAGE_EXTENSIONS);
+}
+
+bool ExtensionGlobalError::HasBubbleView() {
+ return false;
+}
+
+string16 ExtensionGlobalError::GetBubbleViewTitle() {
+ return string16();
+}
+
+string16 ExtensionGlobalError::GetBubbleViewMessage() {
+ return string16();
+}
+
+string16 ExtensionGlobalError::GetBubbleViewAcceptButtonLabel() {
+ return string16();
+}
+
+string16 ExtensionGlobalError::GetBubbleViewCancelButtonLabel() {
+ return string16();
+}
+
+void ExtensionGlobalError::BubbleViewDidClose() {
+}
+
+void ExtensionGlobalError::BubbleViewAcceptButtonPressed() {
+ NOTREACHED();
+}
+
+void ExtensionGlobalError::BubbleViewCancelButtonPressed() {
+ NOTREACHED();
+}

Powered by Google App Engine
This is Rietveld 408576698