| 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/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_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| 11 #include "chrome/browser/lifetime/application_lifetime.h" | 11 #include "chrome/browser/lifetime/application_lifetime.h" |
| 12 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 12 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 13 #include "chrome/browser/plugins/plugin_metadata.h" | 13 #include "chrome/browser/plugins/plugin_metadata.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
| 16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 17 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/browser/user_metrics.h" | 19 #include "content/public/browser/user_metrics.h" |
| 20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 21 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 22 #include "grit/locale_settings.h" | 22 #include "grit/locale_settings.h" |
| 23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | |
| 26 | 25 |
| 27 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
| 28 #include <shellapi.h> | 27 #include <shellapi.h> |
| 29 #include "ui/base/win/shell.h" | 28 #include "ui/base/win/shell.h" |
| 30 #endif | 29 #endif |
| 31 | 30 |
| 32 #if defined(ENABLE_PLUGIN_INSTALLATION) | 31 #if defined(ENABLE_PLUGIN_INSTALLATION) |
| 33 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 34 #include "base/win/metro.h" | 33 #include "base/win/metro.h" |
| 35 #endif | 34 #endif |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void PluginInfoBarDelegate::LoadBlockedPlugins() { | 66 void PluginInfoBarDelegate::LoadBlockedPlugins() { |
| 68 if (web_contents()) { | 67 if (web_contents()) { |
| 69 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); | 68 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); |
| 70 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( | 69 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( |
| 71 host->GetProcess()->GetID()); | 70 host->GetProcess()->GetID()); |
| 72 host->Send(new ChromeViewMsg_LoadBlockedPlugins( | 71 host->Send(new ChromeViewMsg_LoadBlockedPlugins( |
| 73 host->GetRoutingID(), identifier_)); | 72 host->GetRoutingID(), identifier_)); |
| 74 } | 73 } |
| 75 } | 74 } |
| 76 | 75 |
| 77 gfx::Image* PluginInfoBarDelegate::GetIcon() const { | 76 int PluginInfoBarDelegate::GetIconID() const { |
| 78 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 77 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 79 IDR_INFOBAR_PLUGIN_INSTALL); | |
| 80 } | 78 } |
| 81 | 79 |
| 82 string16 PluginInfoBarDelegate::GetLinkText() const { | 80 string16 PluginInfoBarDelegate::GetLinkText() const { |
| 83 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 81 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 84 } | 82 } |
| 85 | 83 |
| 86 | 84 |
| 87 // UnauthorizedPluginInfoBarDelegate ------------------------------------------ | 85 // UnauthorizedPluginInfoBarDelegate ------------------------------------------ |
| 88 | 86 |
| 89 // static | 87 // static |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 WeakPluginInstallerObserver(installer), | 382 WeakPluginInstallerObserver(installer), |
| 385 plugin_metadata_(plugin_metadata.Pass()), | 383 plugin_metadata_(plugin_metadata.Pass()), |
| 386 callback_(callback), | 384 callback_(callback), |
| 387 new_install_(new_install), | 385 new_install_(new_install), |
| 388 message_(message) { | 386 message_(message) { |
| 389 } | 387 } |
| 390 | 388 |
| 391 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { | 389 PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() { |
| 392 } | 390 } |
| 393 | 391 |
| 394 gfx::Image* PluginInstallerInfoBarDelegate::GetIcon() const { | 392 int PluginInstallerInfoBarDelegate::GetIconID() const { |
| 395 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 393 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 396 IDR_INFOBAR_PLUGIN_INSTALL); | |
| 397 } | 394 } |
| 398 | 395 |
| 399 string16 PluginInstallerInfoBarDelegate::GetMessageText() const { | 396 string16 PluginInstallerInfoBarDelegate::GetMessageText() const { |
| 400 return message_; | 397 return message_; |
| 401 } | 398 } |
| 402 | 399 |
| 403 int PluginInstallerInfoBarDelegate::GetButtons() const { | 400 int PluginInstallerInfoBarDelegate::GetButtons() const { |
| 404 return callback_.is_null() ? BUTTON_NONE : BUTTON_OK; | 401 return callback_.is_null() ? BUTTON_NONE : BUTTON_OK; |
| 405 } | 402 } |
| 406 | 403 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 PluginMetroModeInfoBarDelegate::Mode mode, | 492 PluginMetroModeInfoBarDelegate::Mode mode, |
| 496 const string16& name) | 493 const string16& name) |
| 497 : ConfirmInfoBarDelegate(infobar_service), | 494 : ConfirmInfoBarDelegate(infobar_service), |
| 498 mode_(mode), | 495 mode_(mode), |
| 499 name_(name) { | 496 name_(name) { |
| 500 } | 497 } |
| 501 | 498 |
| 502 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { | 499 PluginMetroModeInfoBarDelegate::~PluginMetroModeInfoBarDelegate() { |
| 503 } | 500 } |
| 504 | 501 |
| 505 gfx::Image* PluginMetroModeInfoBarDelegate::GetIcon() const { | 502 int PluginMetroModeInfoBarDelegate::GetIconID() const { |
| 506 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 503 return IDR_INFOBAR_PLUGIN_INSTALL; |
| 507 IDR_INFOBAR_PLUGIN_INSTALL); | |
| 508 } | 504 } |
| 509 | 505 |
| 510 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { | 506 string16 PluginMetroModeInfoBarDelegate::GetMessageText() const { |
| 511 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? | 507 return l10n_util::GetStringFUTF16((mode_ == MISSING_PLUGIN) ? |
| 512 IDS_METRO_MISSING_PLUGIN_PROMPT : IDS_METRO_NPAPI_PLUGIN_PROMPT, name_); | 508 IDS_METRO_MISSING_PLUGIN_PROMPT : IDS_METRO_NPAPI_PLUGIN_PROMPT, name_); |
| 513 } | 509 } |
| 514 | 510 |
| 515 int PluginMetroModeInfoBarDelegate::GetButtons() const { | 511 int PluginMetroModeInfoBarDelegate::GetButtons() const { |
| 516 return (mode_ == MISSING_PLUGIN) ? BUTTON_OK : (BUTTON_OK | BUTTON_CANCEL); | 512 return (mode_ == MISSING_PLUGIN) ? BUTTON_OK : (BUTTON_OK | BUTTON_CANCEL); |
| 517 } | 513 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 Referrer(), | 554 Referrer(), |
| 559 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 555 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 560 content::PAGE_TRANSITION_LINK, false); | 556 content::PAGE_TRANSITION_LINK, false); |
| 561 web_contents()->OpenURL(params); | 557 web_contents()->OpenURL(params); |
| 562 return false; | 558 return false; |
| 563 } | 559 } |
| 564 | 560 |
| 565 #endif // defined(OS_WIN) | 561 #endif // defined(OS_WIN) |
| 566 | 562 |
| 567 #endif // defined(ENABLE_PLUGIN_INSTALLATION) | 563 #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| OLD | NEW |