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

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

Issue 14241006: Eliminate InfoBarTabHelper. Make InfoBarService a concrete class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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/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/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 30 matching lines...) Expand all
41 41
42 content::WebContents* web_contents = 42 content::WebContents* web_contents =
43 browser->tab_strip_model()->GetActiveWebContents(); 43 browser->tab_strip_model()->GetActiveWebContents();
44 if (!web_contents) 44 if (!web_contents)
45 return; 45 return;
46 InfoBarService* infobar_service = 46 InfoBarService* infobar_service =
47 InfoBarService::FromWebContents(web_contents); 47 InfoBarService::FromWebContents(web_contents);
48 48
49 // First find any previous theme preview infobars. 49 // First find any previous theme preview infobars.
50 InfoBarDelegate* old_delegate = NULL; 50 InfoBarDelegate* old_delegate = NULL;
51 for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) { 51 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
52 InfoBarDelegate* delegate = infobar_service->GetInfoBarDelegateAt(i); 52 InfoBarDelegate* delegate = infobar_service->infobar_at(i);
53 ThemeInstalledInfoBarDelegate* theme_infobar = 53 ThemeInstalledInfoBarDelegate* theme_infobar =
54 delegate->AsThemePreviewInfobarDelegate(); 54 delegate->AsThemePreviewInfobarDelegate();
55 if (theme_infobar) { 55 if (theme_infobar) {
56 // If the user installed the same theme twice, ignore the second install 56 // If the user installed the same theme twice, ignore the second install
57 // and keep the first install info bar, so that they can easily undo to 57 // and keep the first install info bar, so that they can easily undo to
58 // get back the previous theme. 58 // get back the previous theme.
59 if (theme_infobar->theme_id_ == new_theme->id()) 59 if (theme_infobar->theme_id_ == new_theme->id())
60 return; 60 return;
61 old_delegate = delegate; 61 old_delegate = delegate;
62 break; 62 break;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 void ThemeInstalledInfoBarDelegate::Observe( 156 void ThemeInstalledInfoBarDelegate::Observe(
157 int type, 157 int type,
158 const content::NotificationSource& source, 158 const content::NotificationSource& source,
159 const content::NotificationDetails& details) { 159 const content::NotificationDetails& details) {
160 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); 160 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type);
161 // If the new theme is different from what this info bar is associated with, 161 // If the new theme is different from what this info bar is associated with,
162 // close this info bar since it is no longer relevant. 162 // close this info bar since it is no longer relevant.
163 if (theme_id_ != theme_service_->GetThemeID()) 163 if (theme_id_ != theme_service_->GetThemeID())
164 RemoveSelf(); 164 RemoveSelf();
165 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698