OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/themes/theme_service.h" | 12 #include "chrome/browser/themes/theme_service.h" |
13 #include "chrome/browser/themes/theme_service_factory.h" | 13 #include "chrome/browser/themes/theme_service_factory.h" |
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "content/common/notification_service.h" | 17 #include "content/common/notification_service.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources_standard.h" | 19 #include "grit/theme_resources_standard.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
22 | 22 |
23 ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( | 23 ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( |
24 TabContents* tab_contents, | 24 TabContents* tab_contents, |
25 const Extension* new_theme, | 25 const Extension* new_theme, |
26 const std::string& previous_theme_id, | 26 const std::string& previous_theme_id, |
27 bool previous_using_native_theme) | 27 bool previous_using_native_theme) |
28 : ConfirmInfoBarDelegate(tab_contents), | 28 : ConfirmInfoBarDelegate(tab_contents), |
29 profile_(tab_contents->profile()), | 29 profile_(static_cast<Profile*>(tab_contents->context())), |
30 theme_service_(ThemeServiceFactory::GetForProfile(profile_)), | 30 theme_service_(ThemeServiceFactory::GetForProfile(profile_)), |
31 name_(new_theme->name()), | 31 name_(new_theme->name()), |
32 theme_id_(new_theme->id()), | 32 theme_id_(new_theme->id()), |
33 previous_theme_id_(previous_theme_id), | 33 previous_theme_id_(previous_theme_id), |
34 previous_using_native_theme_(previous_using_native_theme), | 34 previous_using_native_theme_(previous_using_native_theme), |
35 tab_contents_(tab_contents) { | 35 tab_contents_(tab_contents) { |
36 theme_service_->OnInfobarDisplayed(); | 36 theme_service_->OnInfobarDisplayed(); |
37 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 37 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
38 Source<ThemeService>(theme_service_)); | 38 Source<ThemeService>(theme_service_)); |
39 } | 39 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 tab_contents_ = NULL; | 115 tab_contents_ = NULL; |
116 // Although it's not being used anymore, this delegate is never deleted. | 116 // Although it's not being used anymore, this delegate is never deleted. |
117 // It can not be deleted now because it is still needed if we | 117 // It can not be deleted now because it is still needed if we |
118 // "undo" the theme change that triggered this notification | 118 // "undo" the theme change that triggered this notification |
119 // (when InfoBar::OnBackgroundExpose() is called). This will likely | 119 // (when InfoBar::OnBackgroundExpose() is called). This will likely |
120 // be fixed when infobar delegate deletion is cleaned up for | 120 // be fixed when infobar delegate deletion is cleaned up for |
121 // http://crbug.com/62154. | 121 // http://crbug.com/62154. |
122 } | 122 } |
123 } | 123 } |
124 } | 124 } |
OLD | NEW |