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

Unified Diff: chrome/browser/extensions/extension_error_ui_default.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
Index: chrome/browser/extensions/extension_error_ui_default.cc
diff --git a/chrome/browser/extensions/extension_error_ui_default.cc b/chrome/browser/extensions/extension_error_ui_default.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bc0fd68f7e1ab602dee89beed1c2cd5692b11883
--- /dev/null
+++ b/chrome/browser/extensions/extension_error_ui_default.cc
@@ -0,0 +1,110 @@
+// 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_error_ui_default.h"
+
+#include "base/logging.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/chrome_pages.h"
+
+ExtensionErrorUIDefault::ExtensionErrorUIDefault(
+ ExtensionService* extension_service)
+ : ExtensionErrorUI(extension_service),
+ browser_(NULL),
+ ALLOW_THIS_IN_INITIALIZER_LIST(global_error_(
+ new ExtensionGlobalError(this))) {
+}
+
+ExtensionErrorUIDefault::~ExtensionErrorUIDefault() {
+}
+
+bool ExtensionErrorUIDefault::ShowErrorInBubbleView() {
+ Browser* browser =
+ browser::FindLastActiveWithProfile(extension_service()->profile());
+ if (!browser)
+ return false;
+
+ browser_ = browser;
+ global_error_->ShowBubbleView(browser);
+ return true;
+}
+
+void ExtensionErrorUIDefault::ShowExtensions() {
+ DCHECK(browser_);
+ chrome::ShowExtensions(browser_);
+}
+
+ExtensionErrorUIDefault::ExtensionGlobalError::ExtensionGlobalError(
+ ExtensionErrorUIDefault* error_ui)
+ : error_ui_(error_ui) {
+}
+
+bool ExtensionErrorUIDefault::ExtensionGlobalError::HasBadge() {
+ return false;
+}
+
+bool ExtensionErrorUIDefault::ExtensionGlobalError::HasMenuItem() {
+ return false;
+}
+
+int ExtensionErrorUIDefault::ExtensionGlobalError::MenuItemCommandID() {
+ NOTREACHED();
+ return 0;
+}
+
+string16 ExtensionErrorUIDefault::ExtensionGlobalError::MenuItemLabel() {
+ NOTREACHED();
+ return NULL;
+}
+
+void ExtensionErrorUIDefault::ExtensionGlobalError::ExecuteMenuItem(
+ Browser* browser) {
+ NOTREACHED();
+}
+
+bool ExtensionErrorUIDefault::ExtensionGlobalError::HasBubbleView() {
+ return true;
+}
+
+string16 ExtensionErrorUIDefault::ExtensionGlobalError::GetBubbleViewTitle() {
+ return error_ui_->GetBubbleViewTitle();
+}
+
+string16 ExtensionErrorUIDefault::ExtensionGlobalError::GetBubbleViewMessage() {
+ return error_ui_->GetBubbleViewMessage();
+}
+
+string16 ExtensionErrorUIDefault::ExtensionGlobalError::
+ GetBubbleViewAcceptButtonLabel() {
+ return error_ui_->GetBubbleViewAcceptButtonLabel();
+}
+
+string16 ExtensionErrorUIDefault::ExtensionGlobalError::
+ GetBubbleViewCancelButtonLabel() {
+ return error_ui_->GetBubbleViewCancelButtonLabel();
+}
+
+void ExtensionErrorUIDefault::ExtensionGlobalError::
+ OnBubbleViewDidClose(Browser* browser) {
+ error_ui_->BubbleViewDidClose();
+ error_ui_->browser_ = NULL;
+}
+
+void ExtensionErrorUIDefault::ExtensionGlobalError::
+ BubbleViewAcceptButtonPressed(Browser* browser) {
+ error_ui_->BubbleViewAcceptButtonPressed();
+}
+
+void ExtensionErrorUIDefault::ExtensionGlobalError::
+ BubbleViewCancelButtonPressed(Browser* browser) {
+ error_ui_->BubbleViewCancelButtonPressed();
+}
+
+// static
+ExtensionErrorUI* ExtensionErrorUI::Create(
+ ExtensionService* extension_service) {
+ return new ExtensionErrorUIDefault(extension_service);
+}
« no previous file with comments | « chrome/browser/extensions/extension_error_ui_default.h ('k') | chrome/browser/extensions/extension_global_error.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698