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

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

Issue 376014: Reland Extension Installed InfoBubble (Closed)
Patch Set: Created 11 years, 1 month 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
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_install_ui.h" 5 #include "chrome/browser/extensions/extension_install_ui.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/browser_list.h" 14 #include "chrome/browser/browser_list.h"
15 #include "chrome/browser/browser_window.h" 15 #include "chrome/browser/browser_window.h"
16 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 16 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
17 #include "chrome/browser/profile.h" 17 #include "chrome/browser/profile.h"
18 #include "chrome/browser/tab_contents/tab_contents.h" 18 #include "chrome/browser/tab_contents/tab_contents.h"
19 #if defined(TOOLKIT_VIEWS) // TODO(port)
20 #include "chrome/browser/views/extensions/extension_installed_bubble.h"
21 #endif // TOOLKIT_VIEWS
19 #include "chrome/common/extensions/extension.h" 22 #include "chrome/common/extensions/extension.h"
20 #include "chrome/common/notification_service.h" 23 #include "chrome/common/notification_service.h"
21 #include "grit/browser_resources.h" 24 #include "grit/browser_resources.h"
22 #include "grit/chromium_strings.h" 25 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 26 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 27 #include "grit/theme_resources.h"
25 28
26 #if defined(TOOLKIT_GTK) 29 #if defined(TOOLKIT_GTK)
27 #include "chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h" 30 #include "chrome/browser/extensions/gtk_theme_installed_infobar_delegate.h"
28 #include "chrome/browser/gtk/gtk_theme_provider.h" 31 #include "chrome/browser/gtk/gtk_theme_provider.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #endif 109 #endif
107 110
108 delegate->ContinueInstall(); 111 delegate->ContinueInstall();
109 return; 112 return;
110 } 113 }
111 114
112 if (!install_icon) { 115 if (!install_icon) {
113 install_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( 116 install_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed(
114 IDR_EXTENSIONS_SECTION); 117 IDR_EXTENSIONS_SECTION);
115 } 118 }
119 icon_ = *install_icon;
116 120
117 NotificationService* service = NotificationService::current(); 121 NotificationService* service = NotificationService::current();
118 service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG, 122 service->Notify(NotificationType::EXTENSION_WILL_SHOW_CONFIRM_DIALOG,
119 Source<ExtensionInstallUI>(this), 123 Source<ExtensionInstallUI>(this),
120 NotificationService::NoDetails()); 124 NotificationService::NoDetails());
121 125
122 ShowExtensionInstallPrompt(profile_, delegate, extension, install_icon, 126 ShowExtensionInstallPrompt(profile_, delegate, extension, &icon_,
123 GetInstallWarning(extension)); 127 GetInstallWarning(extension));
124
125 } 128 }
126 129
127 void ExtensionInstallUI::OnInstallSuccess(Extension* extension) { 130 void ExtensionInstallUI::OnInstallSuccess(Extension* extension) {
128 ShowThemeInfoBar(extension); 131 if (extension->IsTheme()) {
132 ShowThemeInfoBar(extension);
133 return;
134 }
135
136 #if defined(TOOLKIT_VIEWS)
137 // GetLastActiveWithProfile will fail on the build bots. This needs to
138 // implemented differently if any test is created which depends on
139 // ExtensionInstalledBubble showing.
140 Browser* browser = BrowserList::GetLastActiveWithProfile(profile_);
141 if (!browser)
142 return;
143
144 ExtensionInstalledBubble::Show(extension, browser, icon_);
145 #else
146 // TODO(port) crbug.com/26973 (linux) crbug.com/26974 (mac)
147 #endif // TOOLKIT_VIEWS
129 } 148 }
130 149
131 void ExtensionInstallUI::OnInstallFailure(const std::string& error) { 150 void ExtensionInstallUI::OnInstallFailure(const std::string& error) {
132 DCHECK(ui_loop_ == MessageLoop::current()); 151 DCHECK(ui_loop_ == MessageLoop::current());
133 152
134 ShowExtensionInstallError(error); 153 ShowExtensionInstallError(error);
135 } 154 }
136 155
137 void ExtensionInstallUI::OnOverinstallAttempted(Extension* extension) { 156 void ExtensionInstallUI::OnOverinstallAttempted(Extension* extension) {
138 ShowThemeInfoBar(extension); 157 ShowThemeInfoBar(extension);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 InfoBarDelegate* ExtensionInstallUI::GetNewInfoBarDelegate( 192 InfoBarDelegate* ExtensionInstallUI::GetNewInfoBarDelegate(
174 Extension* new_theme, TabContents* tab_contents) { 193 Extension* new_theme, TabContents* tab_contents) {
175 #if defined(TOOLKIT_GTK) 194 #if defined(TOOLKIT_GTK)
176 return new GtkThemeInstalledInfoBarDelegate(tab_contents, new_theme, 195 return new GtkThemeInstalledInfoBarDelegate(tab_contents, new_theme,
177 previous_theme_id_, previous_use_gtk_theme_); 196 previous_theme_id_, previous_use_gtk_theme_);
178 #else 197 #else
179 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme, 198 return new ThemeInstalledInfoBarDelegate(tab_contents, new_theme,
180 previous_theme_id_); 199 previous_theme_id_);
181 #endif 200 #endif
182 } 201 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_install_ui.h ('k') | chrome/browser/views/browser_actions_container.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698