| OLD | NEW |
| 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/plugins/plugin_infobar_delegates.h" | 5 #include "chrome/browser/plugins/plugin_infobar_delegates.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 11 #include "chrome/browser/google/google_util.h" | 11 #include "chrome/browser/google/google_util.h" |
| 12 #include "chrome/browser/infobars/infobar.h" | 12 #include "chrome/browser/infobars/infobar.h" |
| 13 #include "chrome/browser/infobars/infobar_service.h" | 13 #include "chrome/browser/infobars/infobar_service.h" |
| 14 #include "chrome/browser/lifetime/application_lifetime.h" | 14 #include "chrome/browser/lifetime/application_lifetime.h" |
| 15 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 15 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 16 #include "chrome/browser/plugins/plugin_metadata.h" | 16 #include "chrome/browser/plugins/plugin_metadata.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/shell_integration.h" | 18 #include "chrome/browser/shell_integration.h" |
| 19 #include "chrome/browser/ui/browser_commands.h" | 19 #include "chrome/browser/ui/browser_commands.h" |
| 20 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 21 #include "content/public/browser/navigation_entry.h" |
| 21 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 22 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 23 #include "content/public/browser/user_metrics.h" | 24 #include "content/public/browser/user_metrics.h" |
| 24 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 26 #include "grit/locale_settings.h" | 27 #include "grit/locale_settings.h" |
| 27 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 29 | 30 |
| 30 #if defined(ENABLE_PLUGIN_INSTALLATION) | 31 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 #if defined(USE_AURA) | 42 #if defined(USE_AURA) |
| 42 #include "ui/aura/remote_window_tree_host_win.h" | 43 #include "ui/aura/remote_window_tree_host_win.h" |
| 43 #endif | 44 #endif |
| 44 #endif | 45 #endif |
| 45 | 46 |
| 46 using base::UserMetricsAction; | 47 using base::UserMetricsAction; |
| 47 | 48 |
| 48 | 49 |
| 49 // PluginInfoBarDelegate ------------------------------------------------------ | 50 // PluginInfoBarDelegate ------------------------------------------------------ |
| 50 | 51 |
| 51 PluginInfoBarDelegate::PluginInfoBarDelegate(const std::string& identifier) | 52 PluginInfoBarDelegate::PluginInfoBarDelegate(content::WebContents* web_contents, |
| 52 : ConfirmInfoBarDelegate(), | 53 const std::string& identifier) |
| 53 identifier_(identifier) { | 54 : ContentConfirmInfoBarDelegate(web_contents), identifier_(identifier) {} |
| 54 } | |
| 55 | 55 |
| 56 PluginInfoBarDelegate::~PluginInfoBarDelegate() { | 56 PluginInfoBarDelegate::~PluginInfoBarDelegate() { |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 59 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
| 60 web_contents()->OpenURL(content::OpenURLParams( | 60 web_contents()->OpenURL(content::OpenURLParams( |
| 61 GURL(GetLearnMoreURL()), content::Referrer(), | 61 GURL(GetLearnMoreURL()), content::Referrer(), |
| 62 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 62 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 63 content::PAGE_TRANSITION_LINK, false)); | 63 content::PAGE_TRANSITION_LINK, false)); |
| 64 return false; | 64 return false; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 79 | 79 |
| 80 | 80 |
| 81 // UnauthorizedPluginInfoBarDelegate ------------------------------------------ | 81 // UnauthorizedPluginInfoBarDelegate ------------------------------------------ |
| 82 | 82 |
| 83 // static | 83 // static |
| 84 void UnauthorizedPluginInfoBarDelegate::Create( | 84 void UnauthorizedPluginInfoBarDelegate::Create( |
| 85 InfoBarService* infobar_service, | 85 InfoBarService* infobar_service, |
| 86 HostContentSettingsMap* content_settings, | 86 HostContentSettingsMap* content_settings, |
| 87 const base::string16& name, | 87 const base::string16& name, |
| 88 const std::string& identifier) { | 88 const std::string& identifier) { |
| 89 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 89 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr< |
| 90 scoped_ptr<ConfirmInfoBarDelegate>(new UnauthorizedPluginInfoBarDelegate( | 90 ConfirmInfoBarDelegate>(new UnauthorizedPluginInfoBarDelegate( |
| 91 content_settings, name, identifier)))); | 91 infobar_service->web_contents(), content_settings, name, identifier)))); |
| 92 | 92 |
| 93 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown")); | 93 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown")); |
| 94 std::string utf8_name(base::UTF16ToUTF8(name)); | 94 std::string utf8_name(base::UTF16ToUTF8(name)); |
| 95 if (utf8_name == PluginMetadata::kJavaGroupName) { | 95 if (utf8_name == PluginMetadata::kJavaGroupName) { |
| 96 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown.Java")); | 96 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Shown.Java")); |
| 97 } else if (utf8_name == PluginMetadata::kQuickTimeGroupName) { | 97 } else if (utf8_name == PluginMetadata::kQuickTimeGroupName) { |
| 98 content::RecordAction( | 98 content::RecordAction( |
| 99 UserMetricsAction("BlockedPluginInfobar.Shown.QuickTime")); | 99 UserMetricsAction("BlockedPluginInfobar.Shown.QuickTime")); |
| 100 } else if (utf8_name == PluginMetadata::kShockwaveGroupName) { | 100 } else if (utf8_name == PluginMetadata::kShockwaveGroupName) { |
| 101 content::RecordAction( | 101 content::RecordAction( |
| 102 UserMetricsAction("BlockedPluginInfobar.Shown.Shockwave")); | 102 UserMetricsAction("BlockedPluginInfobar.Shown.Shockwave")); |
| 103 } else if (utf8_name == PluginMetadata::kRealPlayerGroupName) { | 103 } else if (utf8_name == PluginMetadata::kRealPlayerGroupName) { |
| 104 content::RecordAction( | 104 content::RecordAction( |
| 105 UserMetricsAction("BlockedPluginInfobar.Shown.RealPlayer")); | 105 UserMetricsAction("BlockedPluginInfobar.Shown.RealPlayer")); |
| 106 } else if (utf8_name == PluginMetadata::kWindowsMediaPlayerGroupName) { | 106 } else if (utf8_name == PluginMetadata::kWindowsMediaPlayerGroupName) { |
| 107 content::RecordAction( | 107 content::RecordAction( |
| 108 UserMetricsAction("BlockedPluginInfobar.Shown.WindowsMediaPlayer")); | 108 UserMetricsAction("BlockedPluginInfobar.Shown.WindowsMediaPlayer")); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 UnauthorizedPluginInfoBarDelegate::UnauthorizedPluginInfoBarDelegate( | 112 UnauthorizedPluginInfoBarDelegate::UnauthorizedPluginInfoBarDelegate( |
| 113 content::WebContents* web_contents, |
| 113 HostContentSettingsMap* content_settings, | 114 HostContentSettingsMap* content_settings, |
| 114 const base::string16& name, | 115 const base::string16& name, |
| 115 const std::string& identifier) | 116 const std::string& identifier) |
| 116 : PluginInfoBarDelegate(identifier), | 117 : PluginInfoBarDelegate(web_contents, identifier), |
| 117 content_settings_(content_settings), | 118 content_settings_(content_settings), |
| 118 name_(name) { | 119 name_(name) {} |
| 119 } | |
| 120 | 120 |
| 121 UnauthorizedPluginInfoBarDelegate::~UnauthorizedPluginInfoBarDelegate() { | 121 UnauthorizedPluginInfoBarDelegate::~UnauthorizedPluginInfoBarDelegate() { |
| 122 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Closed")); | 122 content::RecordAction(UserMetricsAction("BlockedPluginInfobar.Closed")); |
| 123 } | 123 } |
| 124 | 124 |
| 125 std::string UnauthorizedPluginInfoBarDelegate::GetLearnMoreURL() const { | 125 std::string UnauthorizedPluginInfoBarDelegate::GetLearnMoreURL() const { |
| 126 return chrome::kBlockedPluginLearnMoreURL; | 126 return chrome::kBlockedPluginLearnMoreURL; |
| 127 } | 127 } |
| 128 | 128 |
| 129 base::string16 UnauthorizedPluginInfoBarDelegate::GetMessageText() const { | 129 base::string16 UnauthorizedPluginInfoBarDelegate::GetMessageText() const { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 void OutdatedPluginInfoBarDelegate::Create( | 170 void OutdatedPluginInfoBarDelegate::Create( |
| 171 InfoBarService* infobar_service, | 171 InfoBarService* infobar_service, |
| 172 PluginInstaller* installer, | 172 PluginInstaller* installer, |
| 173 scoped_ptr<PluginMetadata> plugin_metadata) { | 173 scoped_ptr<PluginMetadata> plugin_metadata) { |
| 174 // Copy the name out of |plugin_metadata| now, since the Pass() call below | 174 // Copy the name out of |plugin_metadata| now, since the Pass() call below |
| 175 // will make it impossible to get at. | 175 // will make it impossible to get at. |
| 176 base::string16 name(plugin_metadata->name()); | 176 base::string16 name(plugin_metadata->name()); |
| 177 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 177 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 178 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( | 178 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( |
| 179 installer, plugin_metadata.Pass(), l10n_util::GetStringFUTF16( | 179 infobar_service->web_contents(), |
| 180 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 180 installer, |
| 181 IDS_PLUGIN_OUTDATED_PROMPT : IDS_PLUGIN_DOWNLOADING, | 181 plugin_metadata.Pass(), |
| 182 l10n_util::GetStringFUTF16( |
| 183 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) |
| 184 ? IDS_PLUGIN_OUTDATED_PROMPT |
| 185 : IDS_PLUGIN_DOWNLOADING, |
| 182 name))))); | 186 name))))); |
| 183 } | 187 } |
| 184 | 188 |
| 185 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( | 189 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( |
| 190 content::WebContents* web_contents, |
| 186 PluginInstaller* installer, | 191 PluginInstaller* installer, |
| 187 scoped_ptr<PluginMetadata> plugin_metadata, | 192 scoped_ptr<PluginMetadata> plugin_metadata, |
| 188 const base::string16& message) | 193 const base::string16& message) |
| 189 : PluginInfoBarDelegate(plugin_metadata->identifier()), | 194 : PluginInfoBarDelegate(web_contents, plugin_metadata->identifier()), |
| 190 WeakPluginInstallerObserver(installer), | 195 WeakPluginInstallerObserver(installer), |
| 191 plugin_metadata_(plugin_metadata.Pass()), | 196 plugin_metadata_(plugin_metadata.Pass()), |
| 192 message_(message) { | 197 message_(message) { |
| 193 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); | 198 content::RecordAction(UserMetricsAction("OutdatedPluginInfobar.Shown")); |
| 194 std::string name = base::UTF16ToUTF8(plugin_metadata_->name()); | 199 std::string name = base::UTF16ToUTF8(plugin_metadata_->name()); |
| 195 if (name == PluginMetadata::kJavaGroupName) { | 200 if (name == PluginMetadata::kJavaGroupName) { |
| 196 content::RecordAction( | 201 content::RecordAction( |
| 197 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); | 202 UserMetricsAction("OutdatedPluginInfobar.Shown.Java")); |
| 198 } else if (name == PluginMetadata::kQuickTimeGroupName) { | 203 } else if (name == PluginMetadata::kQuickTimeGroupName) { |
| 199 content::RecordAction( | 204 content::RecordAction( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 infobar()->RemoveSelf(); | 291 infobar()->RemoveSelf(); |
| 287 } | 292 } |
| 288 | 293 |
| 289 void OutdatedPluginInfoBarDelegate::ReplaceWithInfoBar( | 294 void OutdatedPluginInfoBarDelegate::ReplaceWithInfoBar( |
| 290 const base::string16& message) { | 295 const base::string16& message) { |
| 291 // Return early if the message doesn't change. This is important in case the | 296 // Return early if the message doesn't change. This is important in case the |
| 292 // PluginInstaller is still iterating over its observers (otherwise we would | 297 // PluginInstaller is still iterating over its observers (otherwise we would |
| 293 // keep replacing infobar delegates infinitely). | 298 // keep replacing infobar delegates infinitely). |
| 294 if ((message_ == message) || !infobar()->owner()) | 299 if ((message_ == message) || !infobar()->owner()) |
| 295 return; | 300 return; |
| 296 PluginInstallerInfoBarDelegate::Replace( | 301 PluginInstallerInfoBarDelegate::Replace(web_contents(), |
| 297 infobar(), installer(), plugin_metadata_->Clone(), false, message); | 302 infobar(), |
| 303 installer(), |
| 304 plugin_metadata_->Clone(), |
| 305 false, |
| 306 message); |
| 298 } | 307 } |
| 299 | 308 |
| 300 | 309 |
| 301 // PluginInstallerInfoBarDelegate --------------------------------------------- | 310 // PluginInstallerInfoBarDelegate --------------------------------------------- |
| 302 | 311 |
| 303 void PluginInstallerInfoBarDelegate::Create( | 312 void PluginInstallerInfoBarDelegate::Create( |
| 304 InfoBarService* infobar_service, | 313 InfoBarService* infobar_service, |
| 305 PluginInstaller* installer, | 314 PluginInstaller* installer, |
| 306 scoped_ptr<PluginMetadata> plugin_metadata, | 315 scoped_ptr<PluginMetadata> plugin_metadata, |
| 307 const InstallCallback& callback) { | 316 const InstallCallback& callback) { |
| 308 base::string16 name(plugin_metadata->name()); | 317 base::string16 name(plugin_metadata->name()); |
| 309 #if defined(OS_WIN) | 318 #if defined(OS_WIN) |
| 310 if (base::win::IsMetroProcess()) { | 319 if (base::win::IsMetroProcess()) { |
| 311 PluginMetroModeInfoBarDelegate::Create( | 320 PluginMetroModeInfoBarDelegate::Create( |
| 312 infobar_service, PluginMetroModeInfoBarDelegate::MISSING_PLUGIN, name); | 321 infobar_service, PluginMetroModeInfoBarDelegate::MISSING_PLUGIN, name); |
| 313 return; | 322 return; |
| 314 } | 323 } |
| 315 #endif | 324 #endif |
| 316 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 325 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 317 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( | 326 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( |
| 318 installer, plugin_metadata.Pass(), callback, true, | 327 infobar_service->web_contents(), |
| 328 installer, |
| 329 plugin_metadata.Pass(), |
| 330 callback, |
| 331 true, |
| 319 l10n_util::GetStringFUTF16( | 332 l10n_util::GetStringFUTF16( |
| 320 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 333 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) |
| 321 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT : | 334 ? IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT |
| 322 IDS_PLUGIN_DOWNLOADING, | 335 : IDS_PLUGIN_DOWNLOADING, |
| 323 name))))); | 336 name))))); |
| 324 } | 337 } |
| 325 | 338 |
| 326 | |
| 327 void PluginInstallerInfoBarDelegate::Replace( | 339 void PluginInstallerInfoBarDelegate::Replace( |
| 340 content::WebContents* web_contents, |
| 328 InfoBar* infobar, | 341 InfoBar* infobar, |
| 329 PluginInstaller* installer, | 342 PluginInstaller* installer, |
| 330 scoped_ptr<PluginMetadata> plugin_metadata, | 343 scoped_ptr<PluginMetadata> plugin_metadata, |
| 331 bool new_install, | 344 bool new_install, |
| 332 const base::string16& message) { | 345 const base::string16& message) { |
| 346 |
| 333 DCHECK(infobar->owner()); | 347 DCHECK(infobar->owner()); |
| 334 infobar->owner()->ReplaceInfoBar(infobar, | 348 infobar->owner()->ReplaceInfoBar( |
| 335 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 349 infobar, |
| 336 new PluginInstallerInfoBarDelegate( | 350 ConfirmInfoBarDelegate::CreateInfoBar( |
| 337 installer, plugin_metadata.Pass(), | 351 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( |
| 338 PluginInstallerInfoBarDelegate::InstallCallback(), new_install, | 352 web_contents, |
| 339 message)))); | 353 installer, |
| 354 plugin_metadata.Pass(), |
| 355 PluginInstallerInfoBarDelegate::InstallCallback(), |
| 356 new_install, |
| 357 message))), |
| 358 InfoBarService::GetActiveEntryID(web_contents)); |
| 340 } | 359 } |
| 341 | 360 |
| 342 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( | 361 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( |
| 362 content::WebContents* web_contents, |
| 343 PluginInstaller* installer, | 363 PluginInstaller* installer, |
| 344 scoped_ptr<PluginMetadata> plugin_metadata, | 364 scoped_ptr<PluginMetadata> plugin_metadata, |
| 345 const InstallCallback& callback, | 365 const InstallCallback& callback, |
| 346 bool new_install, | 366 bool new_install, |
| 347 const base::string16& message) | 367 const base::string16& message) |
| 348 : ConfirmInfoBarDelegate(), | 368 : ContentConfirmInfoBarDelegate(web_contents), |
| 349 WeakPluginInstallerObserver(installer), | 369 WeakPluginInstallerObserver(installer), |
| 350 plugin_metadata_(plugin_metadata.Pass()), | 370 plugin_metadata_(plugin_metadata.Pass()), |
| 351 callback_(callback), | 371 callback_(callback), |
| 352 new_install_(new_install), | 372 new_install_(new_install), |
| 353 message_(message) { | 373 message_(message) {} |
| 354 } | |
| 355 | 374 |
| 356 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { | 375 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { |
| 357 } | 376 } |
| 358 | 377 |
| 359 int PluginInstallerInfoBarDelegate::GetIconID() const { | 378 int PluginInstallerInfoBarDelegate::GetIconID() const { |
| 360 return IDR_INFOBAR_PLUGIN_INSTALL; | 379 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 361 } | 380 } |
| 362 | 381 |
| 363 base::string16 PluginInstallerInfoBarDelegate::GetMessageText() const { | 382 base::string16 PluginInstallerInfoBarDelegate::GetMessageText() const { |
| 364 return message_; | 383 return message_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 infobar()->RemoveSelf(); | 444 infobar()->RemoveSelf(); |
| 426 } | 445 } |
| 427 | 446 |
| 428 void PluginInstallerInfoBarDelegate::ReplaceWithInfoBar( | 447 void PluginInstallerInfoBarDelegate::ReplaceWithInfoBar( |
| 429 const base::string16& message) { | 448 const base::string16& message) { |
| 430 // Return early if the message doesn't change. This is important in case the | 449 // Return early if the message doesn't change. This is important in case the |
| 431 // PluginInstaller is still iterating over its observers (otherwise we would | 450 // PluginInstaller is still iterating over its observers (otherwise we would |
| 432 // keep replacing infobar delegates infinitely). | 451 // keep replacing infobar delegates infinitely). |
| 433 if ((message_ == message) || !infobar()->owner()) | 452 if ((message_ == message) || !infobar()->owner()) |
| 434 return; | 453 return; |
| 435 Replace(infobar(), installer(), plugin_metadata_->Clone(), new_install_, | 454 Replace(web_contents(), |
| 455 infobar(), |
| 456 installer(), |
| 457 plugin_metadata_->Clone(), |
| 458 new_install_, |
| 436 message); | 459 message); |
| 437 } | 460 } |
| 438 | 461 |
| 439 | 462 |
| 440 #if defined(OS_WIN) | 463 #if defined(OS_WIN) |
| 441 | 464 |
| 442 // PluginMetroModeInfoBarDelegate --------------------------------------------- | 465 // PluginMetroModeInfoBarDelegate --------------------------------------------- |
| 443 | 466 |
| 444 // static | 467 // static |
| 445 void PluginMetroModeInfoBarDelegate::Create( | 468 void PluginMetroModeInfoBarDelegate::Create( |
| 446 InfoBarService* infobar_service, | 469 InfoBarService* infobar_service, |
| 447 PluginMetroModeInfoBarDelegate::Mode mode, | 470 PluginMetroModeInfoBarDelegate::Mode mode, |
| 448 const base::string16& name) { | 471 const base::string16& name) { |
| 449 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 472 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
| 450 scoped_ptr<ConfirmInfoBarDelegate>( | 473 scoped_ptr<ConfirmInfoBarDelegate>(new PluginMetroModeInfoBarDelegate( |
| 451 new PluginMetroModeInfoBarDelegate(mode, name)))); | 474 infobar_service->web_contents(), mode, name)))); |
| 452 } | 475 } |
| 453 | 476 |
| 454 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( | 477 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( |
| 478 content::WebContents* web_contents, |
| 455 PluginMetroModeInfoBarDelegate::Mode mode, | 479 PluginMetroModeInfoBarDelegate::Mode mode, |
| 456 const base::string16& name) | 480 const base::string16& name) |
| 457 : ConfirmInfoBarDelegate(), | 481 : ContentConfirmInfoBarDelegate(web_contents), mode_(mode), name_(name) {} |
| 458 mode_(mode), | |
| 459 name_(name) { | |
| 460 } | |
| 461 | 482 |
| 462 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { | 483 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { |
| 463 } | 484 } |
| 464 | 485 |
| 465 int PluginMetroModeInfoBarDelegate::GetIconID() const { | 486 int PluginMetroModeInfoBarDelegate::GetIconID() const { |
| 466 return IDR_INFOBAR_PLUGIN_INSTALL; | 487 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 467 } | 488 } |
| 468 | 489 |
| 469 base::string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { | 490 base::string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { |
| 470 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? | 491 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 542 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
| 522 content::Referrer(), | 543 content::Referrer(), |
| 523 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 544 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 524 content::PAGE_TRANSITION_LINK, false)); | 545 content::PAGE_TRANSITION_LINK, false)); |
| 525 return false; | 546 return false; |
| 526 } | 547 } |
| 527 | 548 |
| 528 #endif // defined(OS_WIN) | 549 #endif // defined(OS_WIN) |
| 529 | 550 |
| 530 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 551 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |