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/plugin_observer.h" | 5 #include "chrome/browser/plugin_observer.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/browser/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
10 #include "chrome/browser/plugin_installer_infobar_delegate.h" | 10 #include "chrome/browser/plugin_installer_infobar_delegate.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 bool BlockedPluginInfoBarDelegate::Accept() { | 154 bool BlockedPluginInfoBarDelegate::Accept() { |
155 UserMetrics::RecordAction( | 155 UserMetrics::RecordAction( |
156 UserMetricsAction("BlockedPluginInfobar.AllowThisTime")); | 156 UserMetricsAction("BlockedPluginInfobar.AllowThisTime")); |
157 return PluginInfoBarDelegate::Cancel(); | 157 return PluginInfoBarDelegate::Cancel(); |
158 } | 158 } |
159 | 159 |
160 bool BlockedPluginInfoBarDelegate::Cancel() { | 160 bool BlockedPluginInfoBarDelegate::Cancel() { |
161 UserMetrics::RecordAction( | 161 UserMetrics::RecordAction( |
162 UserMetricsAction("BlockedPluginInfobar.AlwaysAllow")); | 162 UserMetricsAction("BlockedPluginInfobar.AlwaysAllow")); |
163 tab_contents_->profile()->GetHostContentSettingsMap()->AddExceptionForURL( | 163 Profile* profile = static_cast<Profile*>(tab_contents_->context()); |
| 164 profile->GetHostContentSettingsMap()->AddExceptionForURL( |
164 tab_contents_->GetURL(), | 165 tab_contents_->GetURL(), |
165 tab_contents_->GetURL(), | 166 tab_contents_->GetURL(), |
166 CONTENT_SETTINGS_TYPE_PLUGINS, | 167 CONTENT_SETTINGS_TYPE_PLUGINS, |
167 std::string(), | 168 std::string(), |
168 CONTENT_SETTING_ALLOW); | 169 CONTENT_SETTING_ALLOW); |
169 return PluginInfoBarDelegate::Cancel(); | 170 return PluginInfoBarDelegate::Cancel(); |
170 } | 171 } |
171 | 172 |
172 void BlockedPluginInfoBarDelegate::InfoBarDismissed() { | 173 void BlockedPluginInfoBarDelegate::InfoBarDismissed() { |
173 UserMetrics::RecordAction( | 174 UserMetrics::RecordAction( |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 true)); | 355 true)); |
355 } | 356 } |
356 | 357 |
357 void PluginObserver::OnBlockedOutdatedPlugin(const string16& name, | 358 void PluginObserver::OnBlockedOutdatedPlugin(const string16& name, |
358 const GURL& update_url) { | 359 const GURL& update_url) { |
359 tab_contents_->AddInfoBar(update_url.is_empty() ? | 360 tab_contents_->AddInfoBar(update_url.is_empty() ? |
360 static_cast<InfoBarDelegate*>(new BlockedPluginInfoBarDelegate( | 361 static_cast<InfoBarDelegate*>(new BlockedPluginInfoBarDelegate( |
361 tab_contents(), name)) : | 362 tab_contents(), name)) : |
362 new OutdatedPluginInfoBarDelegate(tab_contents(), name, update_url)); | 363 new OutdatedPluginInfoBarDelegate(tab_contents(), name, update_url)); |
363 } | 364 } |
OLD | NEW |