| OLD | NEW |
| 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/api/infobars/confirm_infobar_delegate.h" | 9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h" |
| 10 #include "chrome/browser/extensions/extension_install_prompt.h" | 10 #include "chrome/browser/extensions/extension_install_prompt.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (!browser) | 179 if (!browser) |
| 180 return; | 180 return; |
| 181 | 181 |
| 182 TabContents* tab_contents = chrome::GetActiveTabContents(browser); | 182 TabContents* tab_contents = chrome::GetActiveTabContents(browser); |
| 183 if (!tab_contents) | 183 if (!tab_contents) |
| 184 return; | 184 return; |
| 185 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); | 185 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); |
| 186 | 186 |
| 187 // First find any previous theme preview infobars. | 187 // First find any previous theme preview infobars. |
| 188 InfoBarDelegate* old_delegate = NULL; | 188 InfoBarDelegate* old_delegate = NULL; |
| 189 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { | 189 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { |
| 190 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i); | 190 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i); |
| 191 ThemeInstalledInfoBarDelegate* theme_infobar = | 191 ThemeInstalledInfoBarDelegate* theme_infobar = |
| 192 delegate->AsThemePreviewInfobarDelegate(); | 192 delegate->AsThemePreviewInfobarDelegate(); |
| 193 if (theme_infobar) { | 193 if (theme_infobar) { |
| 194 // If the user installed the same theme twice, ignore the second install | 194 // If the user installed the same theme twice, ignore the second install |
| 195 // and keep the first install info bar, so that they can easily undo to | 195 // and keep the first install info bar, so that they can easily undo to |
| 196 // get back the previous theme. | 196 // get back the previous theme. |
| 197 if (theme_infobar->MatchesTheme(new_theme)) | 197 if (theme_infobar->MatchesTheme(new_theme)) |
| 198 return; | 198 return; |
| 199 old_delegate = delegate; | 199 old_delegate = delegate; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 Browser* browser = browser::FindBrowserWithWebContents(web_contents); | 268 Browser* browser = browser::FindBrowserWithWebContents(web_contents); |
| 269 return chrome::CreateExtensionInstallPromptWithBrowser(browser); | 269 return chrome::CreateExtensionInstallPromptWithBrowser(browser); |
| 270 } | 270 } |
| 271 | 271 |
| 272 // static | 272 // static |
| 273 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( | 273 ExtensionInstallPrompt* ExtensionInstallUI::CreateInstallPromptWithProfile( |
| 274 Profile* profile) { | 274 Profile* profile) { |
| 275 Browser* browser = browser::FindLastActiveWithProfile(profile); | 275 Browser* browser = browser::FindLastActiveWithProfile(profile); |
| 276 return chrome::CreateExtensionInstallPromptWithBrowser(browser); | 276 return chrome::CreateExtensionInstallPromptWithBrowser(browser); |
| 277 } | 277 } |
| OLD | NEW |