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

Side by Side Diff: trunk/src/chrome/browser/ui/extensions/extension_install_ui_default.cc

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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) 2012 The Chromium Authors. All rights reserved. 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 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/ui/extensions/extension_install_ui_default.h" 5 #include "chrome/browser/ui/extensions/extension_install_ui_default.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/extensions/extension_install_prompt.h" 11 #include "chrome/browser/extensions/extension_install_prompt.h"
12 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 12 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
13 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 13 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
14 #include "chrome/browser/infobars/infobar.h"
15 #include "chrome/browser/infobars/infobar_service.h" 14 #include "chrome/browser/infobars/infobar_service.h"
16 #include "chrome/browser/prefs/incognito_mode_prefs.h" 15 #include "chrome/browser/prefs/incognito_mode_prefs.h"
17 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/search/search.h" 17 #include "chrome/browser/search/search.h"
19 #include "chrome/browser/themes/theme_service.h" 18 #include "chrome/browser/themes/theme_service.h"
20 #include "chrome/browser/themes/theme_service_factory.h" 19 #include "chrome/browser/themes/theme_service_factory.h"
21 #include "chrome/browser/ui/app_list/app_list_service.h" 20 #include "chrome/browser/ui/app_list/app_list_service.h"
22 #include "chrome/browser/ui/app_list/app_list_util.h" 21 #include "chrome/browser/ui/app_list/app_list_util.h"
23 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_dialogs.h" 23 #include "chrome/browser/ui/browser_dialogs.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (browser) 73 if (browser)
75 chrome::ShowExtensionInstalledBubble(extension, browser, icon); 74 chrome::ShowExtensionInstalledBubble(extension, browser, icon);
76 } 75 }
77 76
78 77
79 // ErrorInfoBarDelegate ------------------------------------------------------- 78 // ErrorInfoBarDelegate -------------------------------------------------------
80 79
81 // Helper class to put up an infobar when installation fails. 80 // Helper class to put up an infobar when installation fails.
82 class ErrorInfoBarDelegate : public ConfirmInfoBarDelegate { 81 class ErrorInfoBarDelegate : public ConfirmInfoBarDelegate {
83 public: 82 public:
84 // Creates an error infobar and delegate and adds the infobar to 83 // Creates an error infobar delegate and adds it to |infobar_service|.
85 // |infobar_service|.
86 static void Create(InfoBarService* infobar_service, 84 static void Create(InfoBarService* infobar_service,
87 const extensions::CrxInstallerError& error); 85 const extensions::CrxInstallerError& error);
88 86
89 private: 87 private:
90 explicit ErrorInfoBarDelegate(const extensions::CrxInstallerError& error); 88 ErrorInfoBarDelegate(InfoBarService* infobar_service,
89 const extensions::CrxInstallerError& error);
91 virtual ~ErrorInfoBarDelegate(); 90 virtual ~ErrorInfoBarDelegate();
92 91
93 // ConfirmInfoBarDelegate: 92 // ConfirmInfoBarDelegate:
94 virtual string16 GetMessageText() const OVERRIDE; 93 virtual string16 GetMessageText() const OVERRIDE;
95 virtual int GetButtons() const OVERRIDE; 94 virtual int GetButtons() const OVERRIDE;
96 virtual string16 GetLinkText() const OVERRIDE; 95 virtual string16 GetLinkText() const OVERRIDE;
97 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 96 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
98 97
99 extensions::CrxInstallerError error_; 98 extensions::CrxInstallerError error_;
100 99
101 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate); 100 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate);
102 }; 101 };
103 102
104 // static 103 // static
105 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service, 104 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service,
106 const extensions::CrxInstallerError& error) { 105 const extensions::CrxInstallerError& error) {
107 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( 106 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
108 scoped_ptr<ConfirmInfoBarDelegate>(new ErrorInfoBarDelegate(error)))); 107 new ErrorInfoBarDelegate(infobar_service, error)));
109 } 108 }
110 109
111 ErrorInfoBarDelegate::ErrorInfoBarDelegate( 110 ErrorInfoBarDelegate::ErrorInfoBarDelegate(
111 InfoBarService* infobar_service,
112 const extensions::CrxInstallerError& error) 112 const extensions::CrxInstallerError& error)
113 : ConfirmInfoBarDelegate(), 113 : ConfirmInfoBarDelegate(infobar_service),
114 error_(error) { 114 error_(error) {
115 } 115 }
116 116
117 ErrorInfoBarDelegate::~ErrorInfoBarDelegate() { 117 ErrorInfoBarDelegate::~ErrorInfoBarDelegate() {
118 } 118 }
119 119
120 string16 ErrorInfoBarDelegate::GetMessageText() const { 120 string16 ErrorInfoBarDelegate::GetMessageText() const {
121 return error_.message(); 121 return error_.message();
122 } 122 }
123 123
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 browser->tab_strip_model()->GetActiveWebContents(); 284 browser->tab_strip_model()->GetActiveWebContents();
285 if (!web_contents) 285 if (!web_contents)
286 return; 286 return;
287 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents), 287 ErrorInfoBarDelegate::Create(InfoBarService::FromWebContents(web_contents),
288 error); 288 error);
289 } 289 }
290 290
291 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { 291 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) {
292 use_app_installed_bubble_ = use_bubble; 292 use_app_installed_bubble_ = use_bubble;
293 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698