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/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 bool PluginInfoBarDelegate::Cancel() { | 64 bool PluginInfoBarDelegate::Cancel() { |
65 owner()->Send(new ChromeViewMsg_LoadBlockedPlugins(owner()->routing_id())); | 65 owner()->Send(new ChromeViewMsg_LoadBlockedPlugins(owner()->routing_id())); |
66 return true; | 66 return true; |
67 } | 67 } |
68 | 68 |
69 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 69 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
70 owner()->tab_contents()->OpenURL( | 70 owner()->tab_contents()->OpenURL( |
71 google_util::AppendGoogleLocaleParam(GURL(GetLearnMoreURL())), GURL(), | 71 google_util::AppendGoogleLocaleParam(GURL(GetLearnMoreURL())), GURL(), |
72 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 72 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
73 PageTransition::LINK); | 73 content::PAGE_TRANSITION_LINK); |
74 return false; | 74 return false; |
75 } | 75 } |
76 | 76 |
77 gfx::Image* PluginInfoBarDelegate::GetIcon() const { | 77 gfx::Image* PluginInfoBarDelegate::GetIcon() const { |
78 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 78 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
79 IDR_INFOBAR_PLUGIN_INSTALL); | 79 IDR_INFOBAR_PLUGIN_INSTALL); |
80 } | 80 } |
81 | 81 |
82 string16 PluginInfoBarDelegate::GetLinkText() const { | 82 string16 PluginInfoBarDelegate::GetLinkText() const { |
83 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 83 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 string16 OutdatedPluginInfoBarDelegate::GetButtonLabel( | 249 string16 OutdatedPluginInfoBarDelegate::GetButtonLabel( |
250 InfoBarButton button) const { | 250 InfoBarButton button) const { |
251 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? | 251 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? |
252 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); | 252 IDS_PLUGIN_UPDATE : IDS_PLUGIN_ENABLE_TEMPORARILY); |
253 } | 253 } |
254 | 254 |
255 bool OutdatedPluginInfoBarDelegate::Accept() { | 255 bool OutdatedPluginInfoBarDelegate::Accept() { |
256 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); | 256 UserMetrics::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Update")); |
257 owner()->tab_contents()->OpenURL(update_url_, GURL(), NEW_FOREGROUND_TAB, | 257 owner()->tab_contents()->OpenURL(update_url_, GURL(), NEW_FOREGROUND_TAB, |
258 PageTransition::LINK); | 258 content::PAGE_TRANSITION_LINK); |
259 return false; | 259 return false; |
260 } | 260 } |
261 | 261 |
262 bool OutdatedPluginInfoBarDelegate::Cancel() { | 262 bool OutdatedPluginInfoBarDelegate::Cancel() { |
263 UserMetrics::RecordAction( | 263 UserMetrics::RecordAction( |
264 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); | 264 UserMetricsAction("OutdatedPluginInfobar.AllowThisTime")); |
265 return PluginInfoBarDelegate::Cancel(); | 265 return PluginInfoBarDelegate::Cancel(); |
266 } | 266 } |
267 | 267 |
268 void OutdatedPluginInfoBarDelegate::InfoBarDismissed() { | 268 void OutdatedPluginInfoBarDelegate::InfoBarDismissed() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 void PluginObserver::OnBlockedOutdatedPlugin(const string16& name, | 303 void PluginObserver::OnBlockedOutdatedPlugin(const string16& name, |
304 const GURL& update_url) { | 304 const GURL& update_url) { |
305 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); | 305 InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); |
306 infobar_helper->AddInfoBar(update_url.is_empty() ? | 306 infobar_helper->AddInfoBar(update_url.is_empty() ? |
307 static_cast<InfoBarDelegate*>(new BlockedPluginInfoBarDelegate( | 307 static_cast<InfoBarDelegate*>(new BlockedPluginInfoBarDelegate( |
308 infobar_helper, | 308 infobar_helper, |
309 tab_contents_->profile()->GetHostContentSettingsMap(), | 309 tab_contents_->profile()->GetHostContentSettingsMap(), |
310 name)) : | 310 name)) : |
311 new OutdatedPluginInfoBarDelegate(infobar_helper, name, update_url)); | 311 new OutdatedPluginInfoBarDelegate(infobar_helper, name, update_url)); |
312 } | 312 } |
OLD | NEW |