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

Side by Side 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: Fixed clang build. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/extension_error_ui_default.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/chrome_pages.h"
12
13 ExtensionErrorUIDefault::ExtensionErrorUIDefault(
14 ExtensionService* extension_service)
15 : ExtensionErrorUI(extension_service),
16 browser_(NULL),
17 ALLOW_THIS_IN_INITIALIZER_LIST(global_error_(
18 new ExtensionGlobalError(this))) {
19 }
20
21 ExtensionErrorUIDefault::~ExtensionErrorUIDefault() {
22 }
23
24 bool ExtensionErrorUIDefault::ShowErrorInBubbleView() {
25 Browser* browser =
26 browser::FindLastActiveWithProfile(extension_service()->profile());
27 if (!browser)
28 return false;
29
30 global_error_->ShowBubbleView(browser);
Yoyo Zhou 2012/07/13 20:08:47 It certainly seems like browser_ should be able to
Jay Civelli 2012/07/16 17:54:29 As we discussed with IM, I kept the GlobalError cl
31 return true;
32 }
33
34 void ExtensionErrorUIDefault::ShowExtensions() {
35 DCHECK(browser_);
36 chrome::ShowExtensions(browser_);
37 }
38
39 ExtensionErrorUIDefault::ExtensionGlobalError::ExtensionGlobalError(
40 ExtensionErrorUIDefault* error_ui)
41 : error_ui_(error_ui) {
42 }
43
44 bool ExtensionErrorUIDefault::ExtensionGlobalError::HasBadge() {
45 return false;
46 }
47
48 bool ExtensionErrorUIDefault::ExtensionGlobalError::HasMenuItem() {
49 return false;
50 }
51
52 int ExtensionErrorUIDefault::ExtensionGlobalError::MenuItemCommandID() {
53 NOTREACHED();
54 return 0;
55 }
56
57 string16 ExtensionErrorUIDefault::ExtensionGlobalError::MenuItemLabel() {
58 NOTREACHED();
59 return NULL;
60 }
61
62 void ExtensionErrorUIDefault::ExtensionGlobalError::ExecuteMenuItem(
63 Browser* browser) {
64 NOTREACHED();
65 }
66
67 bool ExtensionErrorUIDefault::ExtensionGlobalError::HasBubbleView() {
68 return true;
69 }
70
71 string16 ExtensionErrorUIDefault::ExtensionGlobalError::GetBubbleViewTitle() {
72 return error_ui_->GetBubbleViewTitle();
73 }
74
75 string16 ExtensionErrorUIDefault::ExtensionGlobalError::GetBubbleViewMessage() {
76 return error_ui_->GetBubbleViewMessage();
77 }
78
79 string16 ExtensionErrorUIDefault::ExtensionGlobalError::
80 GetBubbleViewAcceptButtonLabel() {
81 return error_ui_->GetBubbleViewAcceptButtonLabel();
82 }
83
84 string16 ExtensionErrorUIDefault::ExtensionGlobalError::
85 GetBubbleViewCancelButtonLabel() {
86 return error_ui_->GetBubbleViewCancelButtonLabel();
87 }
88
89 void ExtensionErrorUIDefault::ExtensionGlobalError::
90 OnBubbleViewDidClose(Browser* browser) {
91 error_ui_->set_browser(browser);
92 error_ui_->BubbleViewDidClose();
93 error_ui_->set_browser(NULL);
94 }
95
96 void ExtensionErrorUIDefault::ExtensionGlobalError::
97 BubbleViewAcceptButtonPressed(Browser* browser) {
98 error_ui_->set_browser(browser);
99 error_ui_->BubbleViewAcceptButtonPressed();
100 error_ui_->set_browser(NULL);
101 }
102
103 void ExtensionErrorUIDefault::ExtensionGlobalError::
104 BubbleViewCancelButtonPressed(Browser* browser) {
105 error_ui_->set_browser(browser);
106 error_ui_->BubbleViewCancelButtonPressed();
107 error_ui_->set_browser(NULL);
108 }
109
110 // static
111 ExtensionErrorUI* ExtensionErrorUI::Create(
112 ExtensionService* extension_service) {
113 return new ExtensionErrorUIDefault(extension_service);
114 }
OLDNEW
« 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