| 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/theme_installed_infobar_delegate.h" | 5 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 
| 6 | 6 | 
| 7 #include <string> | 7 #include <string> | 
| 8 | 8 | 
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" | 
| 10 #include "chrome/browser/api/infobars/infobar_service.h" | 10 #include "chrome/browser/api/infobars/infobar_service.h" | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 26 // static | 26 // static | 
| 27 void ThemeInstalledInfoBarDelegate::Create( | 27 void ThemeInstalledInfoBarDelegate::Create( | 
| 28     const extensions::Extension* new_theme, | 28     const extensions::Extension* new_theme, | 
| 29     Profile* profile, | 29     Profile* profile, | 
| 30     const std::string& previous_theme_id, | 30     const std::string& previous_theme_id, | 
| 31     bool previous_using_native_theme) { | 31     bool previous_using_native_theme) { | 
| 32   if (!new_theme->is_theme()) | 32   if (!new_theme->is_theme()) | 
| 33     return; | 33     return; | 
| 34 | 34 | 
| 35   // Get last active tabbed browser of profile. | 35   // Get last active tabbed browser of profile. | 
| 36   Browser* browser = browser::FindTabbedBrowser(profile, | 36   Browser* browser = chrome::FindTabbedBrowser(profile, | 
| 37                                                 true, | 37                                                true, | 
| 38                                                 chrome::GetActiveDesktop()); | 38                                                chrome::GetActiveDesktop()); | 
| 39   if (!browser) | 39   if (!browser) | 
| 40     return; | 40     return; | 
| 41 | 41 | 
| 42   content::WebContents* web_contents = chrome::GetActiveWebContents(browser); | 42   content::WebContents* web_contents = chrome::GetActiveWebContents(browser); | 
| 43   if (!web_contents) | 43   if (!web_contents) | 
| 44     return; | 44     return; | 
| 45   InfoBarService* infobar_service = | 45   InfoBarService* infobar_service = | 
| 46       InfoBarService::FromWebContents(web_contents); | 46       InfoBarService::FromWebContents(web_contents); | 
| 47 | 47 | 
| 48   // First find any previous theme preview infobars. | 48   // First find any previous theme preview infobars. | 
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 155 void ThemeInstalledInfoBarDelegate::Observe( | 155 void ThemeInstalledInfoBarDelegate::Observe( | 
| 156     int type, | 156     int type, | 
| 157     const content::NotificationSource& source, | 157     const content::NotificationSource& source, | 
| 158     const content::NotificationDetails& details) { | 158     const content::NotificationDetails& details) { | 
| 159   DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); | 159   DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); | 
| 160   // If the new theme is different from what this info bar is associated with, | 160   // If the new theme is different from what this info bar is associated with, | 
| 161   // close this info bar since it is no longer relevant. | 161   // close this info bar since it is no longer relevant. | 
| 162   if (theme_id_ != theme_service_->GetThemeID()) | 162   if (theme_id_ != theme_service_->GetThemeID()) | 
| 163     RemoveSelf(); | 163     RemoveSelf(); | 
| 164 } | 164 } | 
| OLD | NEW | 
|---|