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_default.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
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/extensions/extension_install_ui_default.h" 5 #include "chrome/browser/extensions/extension_install_ui_default.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/extensions/extension_install_prompt.h" 9 #include "chrome/browser/extensions/extension_install_prompt.h"
10 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" 10 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
11 #include "chrome/browser/infobars/infobar_tab_helper.h" 11 #include "chrome/browser/infobars/infobar_tab_helper.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 13 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
14 #include "chrome/browser/themes/theme_service.h" 14 #include "chrome/browser/themes/theme_service.h"
15 #include "chrome/browser/themes/theme_service_factory.h" 15 #include "chrome/browser/themes/theme_service_factory.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_dialogs.h" 17 #include "chrome/browser/ui/browser_dialogs.h"
18 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
19 #include "chrome/browser/ui/browser_navigator.h" 19 #include "chrome/browser/ui/browser_navigator.h"
20 #include "chrome/browser/ui/browser_tabstrip.h"
20 #include "chrome/browser/ui/browser_window.h" 21 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/simple_message_box.h" 22 #include "chrome/browser/ui/simple_message_box.h"
22 #include "chrome/browser/ui/singleton_tabs.h" 23 #include "chrome/browser/ui/singleton_tabs.h"
23 #include "chrome/browser/ui/tab_contents/tab_contents.h" 24 #include "chrome/browser/ui/tab_contents/tab_contents.h"
24 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 25 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
25 #include "chrome/common/chrome_notification_types.h" 26 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/extensions/extension.h" 28 #include "chrome/common/extensions/extension.h"
28 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
29 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 browser::ShowExtensionInstalledBubble(extension, browser, *icon); 143 browser::ShowExtensionInstalledBubble(extension, browser, *icon);
143 } 144 }
144 145
145 void ExtensionInstallUIDefault::OnInstallFailure( 146 void ExtensionInstallUIDefault::OnInstallFailure(
146 const CrxInstallerError& error) { 147 const CrxInstallerError& error) {
147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
148 if (disable_failure_ui_for_tests || skip_post_install_ui_) 149 if (disable_failure_ui_for_tests || skip_post_install_ui_)
149 return; 150 return;
150 151
151 Browser* browser = browser::FindLastActiveWithProfile(browser_->profile()); 152 Browser* browser = browser::FindLastActiveWithProfile(browser_->profile());
152 TabContents* tab_contents = browser->GetActiveTabContents(); 153 TabContents* tab_contents = chrome::GetActiveTabContents(browser);
153 if (!tab_contents) 154 if (!tab_contents)
154 return; 155 return;
155 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); 156 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
156 infobar_helper->AddInfoBar( 157 infobar_helper->AddInfoBar(
157 new ErrorInfobarDelegate(infobar_helper, browser, error)); 158 new ErrorInfobarDelegate(infobar_helper, browser, error));
158 } 159 }
159 160
160 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) { 161 void ExtensionInstallUIDefault::SetSkipPostInstallUI(bool skip_ui) {
161 skip_post_install_ui_ = skip_ui; 162 skip_post_install_ui_ = skip_ui;
162 } 163 }
163 164
164 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) { 165 void ExtensionInstallUIDefault::SetUseAppInstalledBubble(bool use_bubble) {
165 use_app_installed_bubble_ = use_bubble; 166 use_app_installed_bubble_ = use_bubble;
166 } 167 }
167 168
168 // static 169 // static
169 void ExtensionInstallUIDefault::ShowThemeInfoBar( 170 void ExtensionInstallUIDefault::ShowThemeInfoBar(
170 const std::string& previous_theme_id, bool previous_using_native_theme, 171 const std::string& previous_theme_id, bool previous_using_native_theme,
171 const Extension* new_theme, Profile* profile) { 172 const Extension* new_theme, Profile* profile) {
172 if (!new_theme->is_theme()) 173 if (!new_theme->is_theme())
173 return; 174 return;
174 175
175 // Get last active tabbed browser of profile. 176 // Get last active tabbed browser of profile.
176 Browser* browser = browser::FindTabbedBrowser(profile, true); 177 Browser* browser = browser::FindTabbedBrowser(profile, true);
177 if (!browser) 178 if (!browser)
178 return; 179 return;
179 180
180 TabContents* tab_contents = browser->GetActiveTabContents(); 181 TabContents* tab_contents = chrome::GetActiveTabContents(browser);
181 if (!tab_contents) 182 if (!tab_contents)
182 return; 183 return;
183 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); 184 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper();
184 185
185 // First find any previous theme preview infobars. 186 // First find any previous theme preview infobars.
186 InfoBarDelegate* old_delegate = NULL; 187 InfoBarDelegate* old_delegate = NULL;
187 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { 188 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) {
188 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i); 189 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i);
189 ThemeInstalledInfoBarDelegate* theme_infobar = 190 ThemeInstalledInfoBarDelegate* theme_infobar =
190 delegate->AsThemePreviewInfobarDelegate(); 191 delegate->AsThemePreviewInfobarDelegate();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 #else 253 #else
253 NOTREACHED(); 254 NOTREACHED();
254 #endif 255 #endif
255 } 256 }
256 } 257 }
257 258
258 // static 259 // static
259 void ExtensionInstallUI::DisableFailureUIForTests() { 260 void ExtensionInstallUI::DisableFailureUIForTests() {
260 disable_failure_ui_for_tests = true; 261 disable_failure_ui_for_tests = true;
261 } 262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698