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

Side by Side Diff: chrome/browser/extensions/extension_disabled_infobar_delegate.cc

Issue 275011: Make the multiple download request dialog an infobar.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_disabled_infobar_delegate.h" 5 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/chrome_thread.h" 8 #include "chrome/browser/chrome_thread.h"
9 #include "chrome/browser/extensions/crx_installer.h" 9 #include "chrome/browser/extensions/crx_installer.h"
10 #include "chrome/browser/extensions/extension_file_util.h" 10 #include "chrome/browser/extensions/extension_file_util.h"
(...skipping 19 matching lines...) Expand all
30 AddRef(); // balanced in ContinueInstall or AbortInstall. 30 AddRef(); // balanced in ContinueInstall or AbortInstall.
31 31
32 // Do this now because we can't touch extension on the file loop. 32 // Do this now because we can't touch extension on the file loop.
33 install_icon_resource_ = 33 install_icon_resource_ =
34 extension_->GetIconPath(Extension::EXTENSION_ICON_LARGE); 34 extension_->GetIconPath(Extension::EXTENSION_ICON_LARGE);
35 35
36 ChromeThread::GetMessageLoop(ChromeThread::FILE)->PostTask(FROM_HERE, 36 ChromeThread::GetMessageLoop(ChromeThread::FILE)->PostTask(FROM_HERE,
37 NewRunnableMethod(this, &ExtensionDisabledDialogDelegate::Start)); 37 NewRunnableMethod(this, &ExtensionDisabledDialogDelegate::Start));
38 } 38 }
39 39
40 virtual ~ExtensionDisabledDialogDelegate() {
41 }
42
40 // ExtensionInstallUI::Delegate 43 // ExtensionInstallUI::Delegate
41 virtual void ContinueInstall() { 44 virtual void ContinueInstall() {
42 service_->EnableExtension(extension_->id()); 45 service_->EnableExtension(extension_->id());
43 Release(); 46 Release();
44 } 47 }
45 virtual void AbortInstall() { 48 virtual void AbortInstall() {
46 // Do nothing. The extension will remain disabled. 49 // Do nothing. The extension will remain disabled.
47 Release(); 50 Release();
48 } 51 }
49 52
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 : ConfirmInfoBarDelegate(tab_contents), 85 : ConfirmInfoBarDelegate(tab_contents),
83 tab_contents_(tab_contents), 86 tab_contents_(tab_contents),
84 service_(service), 87 service_(service),
85 extension_(extension) { 88 extension_(extension) {
86 // The user might re-enable the extension in other ways, so watch for that. 89 // The user might re-enable the extension in other ways, so watch for that.
87 registrar_.Add(this, NotificationType::EXTENSION_LOADED, 90 registrar_.Add(this, NotificationType::EXTENSION_LOADED,
88 Source<ExtensionsService>(service)); 91 Source<ExtensionsService>(service));
89 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED, 92 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED_DISABLED,
90 Source<ExtensionsService>(service)); 93 Source<ExtensionsService>(service));
91 } 94 }
92 virtual void InfoBarClosed() { 95 virtual ~ExtensionDisabledInfobarDelegate() {
93 delete this;
94 } 96 }
95 virtual std::wstring GetMessageText() const { 97 virtual std::wstring GetMessageText() const {
96 return l10n_util::GetStringF(IDS_EXTENSION_DISABLED_INFOBAR_LABEL, 98 return l10n_util::GetStringF(IDS_EXTENSION_DISABLED_INFOBAR_LABEL,
97 UTF8ToWide(extension_->name())); 99 UTF8ToWide(extension_->name()));
98 } 100 }
99 virtual SkBitmap* GetIcon() const { 101 virtual SkBitmap* GetIcon() const {
100 return NULL; 102 return NULL;
101 } 103 }
102 virtual int GetButtons() const { 104 virtual int GetButtons() const {
103 return BUTTON_OK; 105 return BUTTON_OK;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (!browser) 146 if (!browser)
145 return; 147 return;
146 148
147 TabContents* tab_contents = browser->GetSelectedTabContents(); 149 TabContents* tab_contents = browser->GetSelectedTabContents();
148 if (!tab_contents) 150 if (!tab_contents)
149 return; 151 return;
150 152
151 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate( 153 tab_contents->AddInfoBar(new ExtensionDisabledInfobarDelegate(
152 tab_contents, service, extension)); 154 tab_contents, service, extension));
153 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_manager.cc ('k') | chrome/browser/gtk/download_request_dialog_delegate_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698