Chromium Code Reviews| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 : ConfirmInfoBarDelegate(), | 53 : ConfirmInfoBarDelegate(), |
| 54 identifier_(identifier) { | 54 identifier_(identifier) { |
| 55 } | 55 } |
| 56 | 56 |
| 57 PluginInfoBarDelegate::~PluginInfoBarDelegate() { | 57 PluginInfoBarDelegate::~PluginInfoBarDelegate() { |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 60 bool PluginInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
| 61 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 61 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
| 62 content::OpenURLParams( | 62 content::OpenURLParams( |
| 63 GURL(GetLearnMoreURL()), content::Referrer(), | 63 GetLinkURL(), content::Referrer(), |
| 64 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 64 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 65 ui::PAGE_TRANSITION_LINK, false)); | 65 ui::PAGE_TRANSITION_LINK, false)); |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void PluginInfoBarDelegate::LoadBlockedPlugins() { | 69 void PluginInfoBarDelegate::LoadBlockedPlugins() { |
| 70 content::WebContents* web_contents = | 70 content::WebContents* web_contents = |
| 71 InfoBarService::WebContentsFromInfoBar(infobar()); | 71 InfoBarService::WebContentsFromInfoBar(infobar()); |
| 72 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( | 72 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( |
| 73 web_contents, true, identifier_); | 73 web_contents, true, identifier_); |
| 74 } | 74 } |
| 75 | 75 |
| 76 int PluginInfoBarDelegate::GetIconId() const { | 76 int PluginInfoBarDelegate::GetIconId() const { |
| 77 return IDR_INFOBAR_PLUGIN_INSTALL; | 77 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 78 } | 78 } |
| 79 | 79 |
| 80 base::string16 PluginInfoBarDelegate::GetLinkText() const { | 80 base::string16 PluginInfoBarDelegate::GetLinkText() const { |
| 81 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 81 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 82 } | 82 } |
| 83 | 83 |
| 84 GURL PluginInfoBarDelegate::GetLinkURL() const { | |
| 85 return GURL(GetLearnMoreURL()); | |
|
Peter Kasting
2015/09/24 21:18:27
We should just eliminate GetLearnMoreURL() and eit
| |
| 86 } | |
| 87 | |
| 84 #if defined(ENABLE_PLUGIN_INSTALLATION) | 88 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 85 | 89 |
| 86 // OutdatedPluginInfoBarDelegate ---------------------------------------------- | 90 // OutdatedPluginInfoBarDelegate ---------------------------------------------- |
| 87 | 91 |
| 88 void OutdatedPluginInfoBarDelegate::Create( | 92 void OutdatedPluginInfoBarDelegate::Create( |
| 89 InfoBarService* infobar_service, | 93 InfoBarService* infobar_service, |
| 90 PluginInstaller* installer, | 94 PluginInstaller* installer, |
| 91 scoped_ptr<PluginMetadata> plugin_metadata) { | 95 scoped_ptr<PluginMetadata> plugin_metadata) { |
| 92 // Copy the name out of |plugin_metadata| now, since the Pass() call below | 96 // Copy the name out of |plugin_metadata| now, since the Pass() call below |
| 93 // will make it impossible to get at. | 97 // will make it impossible to get at. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 | 294 |
| 291 bool PluginMetroModeInfoBarDelegate::Accept() { | 295 bool PluginMetroModeInfoBarDelegate::Accept() { |
| 292 chrome::AttemptRestartToDesktopMode(); | 296 chrome::AttemptRestartToDesktopMode(); |
| 293 return true; | 297 return true; |
| 294 } | 298 } |
| 295 | 299 |
| 296 base::string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { | 300 base::string16 PluginMetroModeInfoBarDelegate::GetLinkText() const { |
| 297 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 301 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 298 } | 302 } |
| 299 | 303 |
| 304 GURL PluginMetroModeInfoBarDelegate::GetLinkURL() const { | |
| 305 return GURL((mode_ == MISSING_PLUGIN) ? | |
| 306 "https://support.google.com/chrome/?p=ib_display_in_desktop" : | |
| 307 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"); | |
| 308 } | |
| 309 | |
| 300 bool PluginMetroModeInfoBarDelegate::LinkClicked( | 310 bool PluginMetroModeInfoBarDelegate::LinkClicked( |
| 301 WindowOpenDisposition disposition) { | 311 WindowOpenDisposition disposition) { |
| 302 // TODO(shrikant): We may need to change language a little at following | 312 // TODO(shrikant): We may need to change language a little at following |
| 303 // support URLs. With new approach we will just restart for both missing | 313 // support URLs. With new approach we will just restart for both missing |
| 304 // and not missing mode. | 314 // and not missing mode. |
| 305 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 315 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
| 306 content::OpenURLParams( | 316 content::OpenURLParams( |
| 307 GURL((mode_ == MISSING_PLUGIN) ? | 317 GetLinkURL(), |
| 308 "https://support.google.com/chrome/?p=ib_display_in_desktop" : | |
| 309 "https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | |
| 310 content::Referrer(), | 318 content::Referrer(), |
| 311 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 319 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 312 ui::PAGE_TRANSITION_LINK, false)); | 320 ui::PAGE_TRANSITION_LINK, false)); |
| 313 return false; | 321 return false; |
| 314 } | 322 } |
| 315 | 323 |
| 316 #endif // defined(OS_WIN) | 324 #endif // defined(OS_WIN) |
| 317 | 325 |
| 318 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 326 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |