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

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

Issue 10696210: Making ExtensionService less dependent on Browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update based on discussion with Yoyo Created 8 years, 5 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
« no previous file with comments | « chrome/browser/extensions/extension_global_error.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index 995c5a898774ca16a8f0ddc65b9ea9ea1de62206..0000000000000000000000000000000000000000
--- a/chrome/browser/extensions/extension_global_error.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (c) 2012 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 "base/string16.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/ui/global_error/global_error.h"
-#include "grit/chromium_strings.h"
-#include "grit/generated_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-
-using extensions::ExtensionIdSet;
-
-ExtensionGlobalError::ExtensionGlobalError(ExtensionService* extension_service)
- : extension_service_(extension_service),
- external_extension_ids_(new ExtensionIdSet),
- blacklisted_extension_ids_(new ExtensionIdSet),
- orphaned_extension_ids_(new ExtensionIdSet) {
- DCHECK(extension_service_);
-}
-
-ExtensionGlobalError::~ExtensionGlobalError() {
-}
-
-void ExtensionGlobalError::AddExternalExtension(const std::string& id) {
- external_extension_ids_->insert(id);
-}
-
-void ExtensionGlobalError::AddBlacklistedExtension(const std::string& id) {
- blacklisted_extension_ids_->insert(id);
-}
-
-void ExtensionGlobalError::AddOrphanedExtension(const std::string& id) {
- orphaned_extension_ids_->insert(id);
-}
-
-bool ExtensionGlobalError::HasBadge() {
- return false;
-}
-
-bool ExtensionGlobalError::HasMenuItem() {
- return false;
-}
-
-int ExtensionGlobalError::MenuItemCommandID() {
- NOTREACHED();
- return 0;
-}
-
-string16 ExtensionGlobalError::MenuItemLabel() {
- NOTREACHED();
- return NULL;
-}
-
-void ExtensionGlobalError::ExecuteMenuItem(Browser* browser) {
- NOTREACHED();
-}
-
-bool ExtensionGlobalError::HasBubbleView() {
- return true;
-}
-
-string16 ExtensionGlobalError::GetBubbleViewTitle() {
- return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_TITLE);
-}
-
-string16 ExtensionGlobalError::GenerateMessageSection(
- const ExtensionIdSet* extensions,
- int template_message_id) {
- CHECK(extensions);
- CHECK(template_message_id);
- string16 message;
-
- for (ExtensionIdSet::const_iterator iter = extensions->begin();
- iter != extensions->end(); ++iter) {
- const extensions::Extension* e = extension_service_->GetExtensionById(*iter,
- true);
- message += l10n_util::GetStringFUTF16(template_message_id,
- string16(ASCIIToUTF16(e->name())));
- }
- return message;
-}
-
-string16 ExtensionGlobalError::GenerateMessage() {
- return GenerateMessageSection(external_extension_ids_.get(),
- IDS_EXTENSION_ALERT_ITEM_EXTERNAL) +
- GenerateMessageSection(blacklisted_extension_ids_.get(),
- IDS_EXTENSION_ALERT_ITEM_BLACKLISTED) +
- GenerateMessageSection(orphaned_extension_ids_.get(),
- IDS_EXTENSION_ALERT_ITEM_ORPHANED);
-}
-
-string16 ExtensionGlobalError::GetBubbleViewMessage() {
- if (message_.empty()) {
- message_ = GenerateMessage();
- if (message_[message_.size()-1] == '\n')
- message_.resize(message_.size()-1);
- }
- return message_;
-}
-
-string16 ExtensionGlobalError::GetBubbleViewAcceptButtonLabel() {
- return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_OK);
-}
-
-string16 ExtensionGlobalError::GetBubbleViewCancelButtonLabel() {
- return l10n_util::GetStringUTF16(IDS_EXTENSION_ALERT_ITEM_DETAILS);
-}
-
-void ExtensionGlobalError::OnBubbleViewDidClose(Browser* browser) {
- extension_service_->HandleExtensionAlertClosed();
-}
-
-void ExtensionGlobalError::BubbleViewAcceptButtonPressed(Browser* browser) {
- extension_service_->HandleExtensionAlertAccept();
-}
-
-void ExtensionGlobalError::BubbleViewCancelButtonPressed(Browser* browser) {
- extension_service_->HandleExtensionAlertDetails(browser);
-}
« no previous file with comments | « chrome/browser/extensions/extension_global_error.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698