| 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.h" | 5 #include "chrome/browser/extensions/extension_install_ui.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/extensions/bundle_installer.h" | 16 #include "chrome/browser/extensions/bundle_installer.h" |
| 17 #include "chrome/browser/extensions/extension_install_dialog.h" | 17 #include "chrome/browser/extensions/extension_install_dialog.h" |
| 18 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 18 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
| 19 #include "chrome/browser/infobars/infobar_tab_helper.h" | 19 #include "chrome/browser/infobars/infobar_tab_helper.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/themes/theme_service.h" | 21 #include "chrome/browser/themes/theme_service.h" |
| 22 #include "chrome/browser/themes/theme_service_factory.h" | 22 #include "chrome/browser/themes/theme_service_factory.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_dialogs.h" | 24 #include "chrome/browser/ui/browser_dialogs.h" |
| 25 #include "chrome/browser/ui/browser_finder.h" | 25 #include "chrome/browser/ui/browser_finder.h" |
| 26 #include "chrome/browser/ui/browser_navigator.h" | 26 #include "chrome/browser/ui/browser_navigator.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/simple_message_box.h" | 28 #include "chrome/browser/ui/simple_message_box.h" |
| 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 29 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 31 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 31 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 32 #include "chrome/common/chrome_notification_types.h" | 32 #include "chrome/common/chrome_notification_types.h" |
| 33 #include "chrome/common/chrome_switches.h" | 33 #include "chrome/common/chrome_switches.h" |
| 34 #include "chrome/common/extensions/extension.h" | 34 #include "chrome/common/extensions/extension.h" |
| 35 #include "chrome/common/extensions/extension_icon_set.h" | 35 #include "chrome/common/extensions/extension_icon_set.h" |
| 36 #include "chrome/common/extensions/extension_manifest_constants.h" | 36 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 37 #include "chrome/common/extensions/extension_resource.h" | 37 #include "chrome/common/extensions/extension_resource.h" |
| 38 #include "chrome/common/extensions/extension_switch_utils.h" | 38 #include "chrome/common/extensions/extension_switch_utils.h" |
| 39 #include "chrome/common/extensions/url_pattern.h" | 39 #include "chrome/common/extensions/url_pattern.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 const Extension* new_theme, | 468 const Extension* new_theme, |
| 469 Profile* profile) { | 469 Profile* profile) { |
| 470 if (!new_theme->is_theme()) | 470 if (!new_theme->is_theme()) |
| 471 return; | 471 return; |
| 472 | 472 |
| 473 // Get last active tabbed browser of profile. | 473 // Get last active tabbed browser of profile. |
| 474 Browser* browser = browser::FindTabbedBrowser(profile, true); | 474 Browser* browser = browser::FindTabbedBrowser(profile, true); |
| 475 if (!browser) | 475 if (!browser) |
| 476 return; | 476 return; |
| 477 | 477 |
| 478 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper(); | 478 TabContents* tab_contents = browser->GetActiveTabContents(); |
| 479 if (!tab_contents) | 479 if (!tab_contents) |
| 480 return; | 480 return; |
| 481 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); | 481 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); |
| 482 | 482 |
| 483 // First find any previous theme preview infobars. | 483 // First find any previous theme preview infobars. |
| 484 InfoBarDelegate* old_delegate = NULL; | 484 InfoBarDelegate* old_delegate = NULL; |
| 485 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { | 485 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { |
| 486 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i); | 486 InfoBarDelegate* delegate = infobar_helper->GetInfoBarDelegateAt(i); |
| 487 ThemeInstalledInfoBarDelegate* theme_infobar = | 487 ThemeInstalledInfoBarDelegate* theme_infobar = |
| 488 delegate->AsThemePreviewInfobarDelegate(); | 488 delegate->AsThemePreviewInfobarDelegate(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 ShowExtensionInstallDialog(profile_, delegate_, prompt_); | 542 ShowExtensionInstallDialog(profile_, delegate_, prompt_); |
| 543 break; | 543 break; |
| 544 } | 544 } |
| 545 default: | 545 default: |
| 546 NOTREACHED() << "Unknown message"; | 546 NOTREACHED() << "Unknown message"; |
| 547 break; | 547 break; |
| 548 } | 548 } |
| 549 } | 549 } |
| 550 | 550 |
| 551 InfoBarDelegate* ExtensionInstallUI::GetNewThemeInstalledInfoBarDelegate( | 551 InfoBarDelegate* ExtensionInstallUI::GetNewThemeInstalledInfoBarDelegate( |
| 552 TabContentsWrapper* tab_contents, | 552 TabContents* tab_contents, |
| 553 const Extension* new_theme, | 553 const Extension* new_theme, |
| 554 const std::string& previous_theme_id, | 554 const std::string& previous_theme_id, |
| 555 bool previous_using_native_theme) { | 555 bool previous_using_native_theme) { |
| 556 Profile* profile = tab_contents->profile(); | 556 Profile* profile = tab_contents->profile(); |
| 557 return new ThemeInstalledInfoBarDelegate( | 557 return new ThemeInstalledInfoBarDelegate( |
| 558 tab_contents->infobar_tab_helper(), | 558 tab_contents->infobar_tab_helper(), |
| 559 profile->GetExtensionService(), | 559 profile->GetExtensionService(), |
| 560 ThemeServiceFactory::GetForProfile(profile), | 560 ThemeServiceFactory::GetForProfile(profile), |
| 561 new_theme, | 561 new_theme, |
| 562 previous_theme_id, | 562 previous_theme_id, |
| 563 previous_using_native_theme); | 563 previous_using_native_theme); |
| 564 } | 564 } |
| OLD | NEW |