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" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 profile_->GetThemeProvider()->OnInfobarDestroyed(); | 44 profile_->GetThemeProvider()->OnInfobarDestroyed(); |
45 } | 45 } |
46 | 46 |
47 bool ThemeInstalledInfoBarDelegate::Cancel() { | 47 bool ThemeInstalledInfoBarDelegate::Cancel() { |
48 if (!previous_theme_id_.empty()) { | 48 if (!previous_theme_id_.empty()) { |
49 ExtensionService* service = profile_->GetExtensionService(); | 49 ExtensionService* service = profile_->GetExtensionService(); |
50 if (service) { | 50 if (service) { |
51 const Extension* previous_theme = | 51 const Extension* previous_theme = |
52 service->GetExtensionById(previous_theme_id_, true); | 52 service->GetExtensionById(previous_theme_id_, true); |
53 if (previous_theme) { | 53 if (previous_theme) { |
54 profile_->SetTheme(previous_theme); | 54 service->EnableExtension(previous_theme_id_); |
55 return true; | 55 return true; |
56 } | 56 } |
57 } | 57 } |
58 } | 58 } |
59 | 59 |
60 profile_->ClearTheme(); | 60 profile_->ClearTheme(); |
61 return true; | 61 return true; |
62 } | 62 } |
63 | 63 |
64 void ThemeInstalledInfoBarDelegate::InfoBarClosed() { | 64 void ThemeInstalledInfoBarDelegate::InfoBarClosed() { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 tab_contents_ = NULL; | 109 tab_contents_ = NULL; |
110 // Although it's not being used anymore, this delegate is never deleted. | 110 // Although it's not being used anymore, this delegate is never deleted. |
111 // It can not be deleted now because it is still needed if we | 111 // It can not be deleted now because it is still needed if we |
112 // "undo" the theme change that triggered this notification | 112 // "undo" the theme change that triggered this notification |
113 // (when InfoBar::OnBackgroundExpose() is called). This will likely | 113 // (when InfoBar::OnBackgroundExpose() is called). This will likely |
114 // be fixed when infobar delegate deletion is cleaned up for | 114 // be fixed when infobar delegate deletion is cleaned up for |
115 // http://crbug.com/62154. | 115 // http://crbug.com/62154. |
116 } | 116 } |
117 } | 117 } |
118 } | 118 } |
OLD | NEW |