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/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 | 84 |
85 // OutdatedPluginInfoBarDelegate ---------------------------------------------- | 85 // OutdatedPluginInfoBarDelegate ---------------------------------------------- |
86 | 86 |
87 void OutdatedPluginInfoBarDelegate::Create( | 87 void OutdatedPluginInfoBarDelegate::Create( |
88 InfoBarService* infobar_service, | 88 InfoBarService* infobar_service, |
89 PluginInstaller* installer, | 89 PluginInstaller* installer, |
90 scoped_ptr<PluginMetadata> plugin_metadata) { | 90 scoped_ptr<PluginMetadata> plugin_metadata) { |
91 // Copy the name out of |plugin_metadata| now, since the Pass() call below | 91 // Copy the name out of |plugin_metadata| now, since the Pass() call below |
92 // will make it impossible to get at. | 92 // will make it impossible to get at. |
93 base::string16 name(plugin_metadata->name()); | 93 base::string16 name(plugin_metadata->name()); |
94 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 94 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
95 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( | 95 scoped_ptr<ConfirmInfoBarDelegate>(new OutdatedPluginInfoBarDelegate( |
96 installer, plugin_metadata.Pass(), l10n_util::GetStringFUTF16( | 96 installer, plugin_metadata.Pass(), |
97 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 97 l10n_util::GetStringFUTF16( |
98 IDS_PLUGIN_OUTDATED_PROMPT : IDS_PLUGIN_DOWNLOADING, | 98 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) |
99 ? IDS_PLUGIN_OUTDATED_PROMPT | |
100 : IDS_PLUGIN_DOWNLOADING, | |
Peter Kasting
2014/12/19 23:06:23
Nit: Don't rewrap ?: linebreaking (2 places)
sdefresne
2014/12/20 11:30:55
Sorry, I reformatted everything with clang-format
| |
99 name))))); | 101 name))))); |
100 } | 102 } |
101 | 103 |
102 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( | 104 OutdatedPluginInfoBarDelegate::OutdatedPluginInfoBarDelegate( |
103 PluginInstaller* installer, | 105 PluginInstaller* installer, |
104 scoped_ptr<PluginMetadata> plugin_metadata, | 106 scoped_ptr<PluginMetadata> plugin_metadata, |
105 const base::string16& message) | 107 const base::string16& message) |
106 : PluginInfoBarDelegate(plugin_metadata->identifier()), | 108 : PluginInfoBarDelegate(plugin_metadata->identifier()), |
107 WeakPluginInstallerObserver(installer), | 109 WeakPluginInstallerObserver(installer), |
108 plugin_metadata_(plugin_metadata.Pass()), | 110 plugin_metadata_(plugin_metadata.Pass()), |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 scoped_ptr<PluginMetadata> plugin_metadata, | 227 scoped_ptr<PluginMetadata> plugin_metadata, |
226 const InstallCallback& callback) { | 228 const InstallCallback& callback) { |
227 base::string16 name(plugin_metadata->name()); | 229 base::string16 name(plugin_metadata->name()); |
228 #if defined(OS_WIN) | 230 #if defined(OS_WIN) |
229 if (base::win::IsMetroProcess()) { | 231 if (base::win::IsMetroProcess()) { |
230 PluginMetroModeInfoBarDelegate::Create( | 232 PluginMetroModeInfoBarDelegate::Create( |
231 infobar_service, PluginMetroModeInfoBarDelegate::MISSING_PLUGIN, name); | 233 infobar_service, PluginMetroModeInfoBarDelegate::MISSING_PLUGIN, name); |
232 return; | 234 return; |
233 } | 235 } |
234 #endif | 236 #endif |
235 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 237 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
236 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( | 238 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( |
237 installer, plugin_metadata.Pass(), callback, true, | 239 installer, plugin_metadata.Pass(), callback, true, |
238 l10n_util::GetStringFUTF16( | 240 l10n_util::GetStringFUTF16( |
239 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? | 241 (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) |
240 IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT : | 242 ? IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT |
241 IDS_PLUGIN_DOWNLOADING, | 243 : IDS_PLUGIN_DOWNLOADING, |
242 name))))); | 244 name))))); |
243 } | 245 } |
244 | 246 |
245 void PluginInstallerInfoBarDelegate::Replace( | 247 void PluginInstallerInfoBarDelegate::Replace( |
246 infobars::InfoBar* infobar, | 248 infobars::InfoBar* infobar, |
247 PluginInstaller* installer, | 249 PluginInstaller* installer, |
248 scoped_ptr<PluginMetadata> plugin_metadata, | 250 scoped_ptr<PluginMetadata> plugin_metadata, |
249 bool new_install, | 251 bool new_install, |
250 const base::string16& message) { | 252 const base::string16& message) { |
251 DCHECK(infobar->owner()); | 253 DCHECK(infobar->owner()); |
252 infobar->owner()->ReplaceInfoBar(infobar, | 254 infobar->owner()->ReplaceInfoBar( |
253 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 255 infobar, |
254 new PluginInstallerInfoBarDelegate( | 256 infobar->owner()->CreateConfirmInfoBar( |
257 scoped_ptr<ConfirmInfoBarDelegate>(new PluginInstallerInfoBarDelegate( | |
255 installer, plugin_metadata.Pass(), | 258 installer, plugin_metadata.Pass(), |
256 PluginInstallerInfoBarDelegate::InstallCallback(), new_install, | 259 PluginInstallerInfoBarDelegate::InstallCallback(), new_install, |
257 message)))); | 260 message)))); |
258 } | 261 } |
259 | 262 |
260 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( | 263 PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate( |
261 PluginInstaller* installer, | 264 PluginInstaller* installer, |
262 scoped_ptr<PluginMetadata> plugin_metadata, | 265 scoped_ptr<PluginMetadata> plugin_metadata, |
263 const InstallCallback& callback, | 266 const InstallCallback& callback, |
264 bool new_install, | 267 bool new_install, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 | 361 |
359 #if defined(OS_WIN) | 362 #if defined(OS_WIN) |
360 | 363 |
361 // PluginMetroModeInfoBarDelegate --------------------------------------------- | 364 // PluginMetroModeInfoBarDelegate --------------------------------------------- |
362 | 365 |
363 // static | 366 // static |
364 void PluginMetroModeInfoBarDelegate::Create( | 367 void PluginMetroModeInfoBarDelegate::Create( |
365 InfoBarService* infobar_service, | 368 InfoBarService* infobar_service, |
366 PluginMetroModeInfoBarDelegate::Mode mode, | 369 PluginMetroModeInfoBarDelegate::Mode mode, |
367 const base::string16& name) { | 370 const base::string16& name) { |
368 infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 371 infobar_service->AddInfoBar( |
369 scoped_ptr<ConfirmInfoBarDelegate>( | 372 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
370 new PluginMetroModeInfoBarDelegate(mode, name)))); | 373 new PluginMetroModeInfoBarDelegate(mode, name)))); |
371 } | 374 } |
372 | 375 |
373 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( | 376 PluginMetroModeInfoBarDelegate::PluginMetroModeInfoBarDelegate( |
374 PluginMetroModeInfoBarDelegate::Mode mode, | 377 PluginMetroModeInfoBarDelegate::Mode mode, |
375 const base::string16& name) | 378 const base::string16& name) |
376 : ConfirmInfoBarDelegate(), | 379 : ConfirmInfoBarDelegate(), |
377 mode_(mode), | 380 mode_(mode), |
378 name_(name) { | 381 name_(name) { |
379 } | 382 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 437 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
435 content::Referrer(), | 438 content::Referrer(), |
436 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 439 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
437 ui::PAGE_TRANSITION_LINK, false)); | 440 ui::PAGE_TRANSITION_LINK, false)); |
438 return false; | 441 return false; |
439 } | 442 } |
440 | 443 |
441 #endif // defined(OS_WIN) | 444 #endif // defined(OS_WIN) |
442 | 445 |
443 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 446 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
OLD | NEW |