summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 18:50:06 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 18:50:06 +0000
commit725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1 (patch)
tree7bbf267f3c5259bbe7caa3dda99b00821d239b5f
parent25888eae643f3e6ba01b694f75769e52ae8f9bff (diff)
downloadchromium_src-725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1.zip
chromium_src-725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1.tar.gz
chromium_src-725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1.tar.bz2
Reland 117210 - Show error message when download a plug-in installer fails.
Also, don't try to directly download Flash Player from http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe anymore. Original review URL: http://codereview.chromium.org/9149004 TBR=arv@chromium.org BUG=102987 TEST=Go to http://www/~bauerb/no_crawl/test/install_plugin.html, turn off your network and click on "Get Plug-in". You should see an error. Review URL: http://codereview.chromium.org/9148024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117661 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd3
-rw-r--r--chrome/browser/chrome_plugin_message_filter.cc13
-rw-r--r--chrome/browser/chrome_plugin_message_filter.h6
-rw-r--r--chrome/browser/plugin_download_helper.cc59
-rw-r--r--chrome/browser/plugin_download_helper.h14
-rw-r--r--chrome/browser/plugin_download_helper_unittest.cc122
-rw-r--r--chrome/browser/plugin_installer.cc7
-rw-r--r--chrome/browser/plugin_installer.h1
-rw-r--r--chrome/browser/plugin_installer_observer.cc2
-rw-r--r--chrome/browser/plugin_installer_observer.h3
-rw-r--r--chrome/browser/plugin_observer.cc4
-rw-r--r--chrome/browser/plugin_test.cc100
-rw-r--r--chrome/browser/resources/plugins_win.json3
-rw-r--r--chrome/chrome_tests.gypi2
-rw-r--r--chrome/common/render_messages.h5
-rw-r--r--chrome/renderer/plugins/missing_plugin.cc7
-rw-r--r--chrome/renderer/plugins/missing_plugin.h1
17 files changed, 220 insertions, 132 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 9879cc3..e8f2a02 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -5257,6 +5257,9 @@ Because search results are requested even while you're typing your query, your d
<message name="IDS_PLUGIN_DOWNLOADING" desc="The placeholder text when downloading a missing plug-in.">
Downloading plug-in...
</message>
+ <message name="IDS_PLUGIN_DOWNLOAD_ERROR" desc="The placeholder text when there was an error download a missing plug-in.">
+ There was an error downloading the plug-in (<ph name="ERROR">$1<ex>net::ERR_TOO_MANY_GOATS</ex></ph>). Sorry :-/
+ </message>
<message name="IDS_PLUGIN_INSTALLING" desc="The placeholder text when installing a missing plug-in.">
After installing the plug-in, reload the page.
</message>
diff --git a/chrome/browser/chrome_plugin_message_filter.cc b/chrome/browser/chrome_plugin_message_filter.cc
index dadb400..072cee3 100644
--- a/chrome/browser/chrome_plugin_message_filter.cc
+++ b/chrome/browser/chrome_plugin_message_filter.cc
@@ -85,12 +85,13 @@ void ChromePluginMessageFilter::OnDownloadUrlOnUIThread(
download_url_helper->InitiateDownload(
GURL(url),
host->GetBrowserContext()->GetRequestContext(),
- base::Bind(&ChromePluginMessageFilter::OnPluginDownloadFinished,
- caller_window));
+ base::Bind(&ChromePluginMessageFilter::PluginDownloadFinished,
+ caller_window),
+ base::Bind(&ChromePluginMessageFilter::PluginDownloadError));
}
// static
-void ChromePluginMessageFilter::OnPluginDownloadFinished(
+void ChromePluginMessageFilter::PluginDownloadFinished(
gfx::NativeWindow caller_window,
const FilePath& response_file) {
FilePath::StringType path = response_file.value();
@@ -106,6 +107,12 @@ void ChromePluginMessageFilter::OnPluginDownloadFinished(
reinterpret_cast<LPARAM>(&download_file_data));
}
}
+
+// static
+void ChromePluginMessageFilter::PluginDownloadError(
+ const std::string& error) {
+ NOTREACHED() << error;
+}
#endif // OS_WIN
void ChromePluginMessageFilter::OnGetPluginFinderUrl(
diff --git a/chrome/browser/chrome_plugin_message_filter.h b/chrome/browser/chrome_plugin_message_filter.h
index b0d50ab..99d5834 100644
--- a/chrome/browser/chrome_plugin_message_filter.h
+++ b/chrome/browser/chrome_plugin_message_filter.h
@@ -41,9 +41,11 @@ class ChromePluginMessageFilter : public IPC::ChannelProxy::MessageFilter,
static void OnDownloadUrlOnUIThread(const std::string& url,
gfx::NativeWindow caller_window,
int render_process_id);
- static void OnPluginDownloadFinished(gfx::NativeWindow caller_window,
- const FilePath& response_file);
+ static void PluginDownloadFinished(gfx::NativeWindow caller_window,
+ const FilePath& response_file);
+ static void PluginDownloadError(const std::string& error);
#endif
+
void OnGetPluginFinderUrl(std::string* plugin_finder_url);
void OnMissingPluginStatus(int status,
int render_process_id,
diff --git a/chrome/browser/plugin_download_helper.cc b/chrome/browser/plugin_download_helper.cc
index f153356..faf17dd 100644
--- a/chrome/browser/plugin_download_helper.cc
+++ b/chrome/browser/plugin_download_helper.cc
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/file_util.h"
+#include "base/stringprintf.h"
#include "base/message_loop_proxy.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/url_fetcher.h"
@@ -13,6 +14,7 @@
#include "net/url_request/url_request_status.h"
using content::BrowserThread;
+using content::URLFetcher;
PluginDownloadUrlHelper::PluginDownloadUrlHelper() {
}
@@ -23,34 +25,44 @@ PluginDownloadUrlHelper::~PluginDownloadUrlHelper() {
void PluginDownloadUrlHelper::InitiateDownload(
const GURL& download_url,
net::URLRequestContextGetter* request_context,
- const DownloadFinishedCallback& callback) {
+ const DownloadFinishedCallback& finished_callback,
+ const ErrorCallback& error_callback) {
download_url_ = download_url;
- callback_ = callback;
- download_file_fetcher_.reset(content::URLFetcher::Create(
- download_url_, content::URLFetcher::GET, this));
+ download_finished_callback_ = finished_callback;
+ error_callback_ = error_callback;
+ download_file_fetcher_.reset(URLFetcher::Create(
+ download_url_, URLFetcher::GET, this));
download_file_fetcher_->SetRequestContext(request_context);
download_file_fetcher_->SaveResponseToTemporaryFile(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
download_file_fetcher_->Start();
}
-void PluginDownloadUrlHelper::OnURLFetchComplete(
- const content::URLFetcher* source) {
+void PluginDownloadUrlHelper::OnURLFetchComplete(const URLFetcher* source) {
net::URLRequestStatus status = source->GetStatus();
- if (status.is_success()) {
- bool success = source->GetResponseAsFilePath(true, &downloaded_file_);
- DCHECK(success);
- BrowserThread::PostTaskAndReply(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&PluginDownloadUrlHelper::RenameDownloadedFile,
- base::Unretained(this)),
- base::Bind(&PluginDownloadUrlHelper::RunCallback,
- base::Unretained(this)));
- } else {
- NOTREACHED() << "Failed to download the plugin installer: "
- << net::ErrorToString(status.error());
- RunCallback();
+ if (!status.is_success()) {
+ RunErrorCallback(base::StringPrintf("Error %d: %s",
+ status.error(),
+ net::ErrorToString(status.error())));
+ return;
+ }
+ int response_code = source->GetResponseCode();
+ if (response_code != 200 &&
+ response_code != URLFetcher::RESPONSE_CODE_INVALID) {
+ // If we don't get a HTTP response code, the URL request either failed
+ // (which should be covered by the status check above) or the fetched URL
+ // was a file: URL (in unit tests for example), in which case it's fine.
+ RunErrorCallback(base::StringPrintf("HTTP status %d", response_code));
+ return;
}
+ bool success = source->GetResponseAsFilePath(true, &downloaded_file_);
+ DCHECK(success);
+ BrowserThread::PostTaskAndReply(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&PluginDownloadUrlHelper::RenameDownloadedFile,
+ base::Unretained(this)),
+ base::Bind(&PluginDownloadUrlHelper::RunFinishedCallback,
+ base::Unretained(this)));
}
void PluginDownloadUrlHelper::RenameDownloadedFile() {
@@ -71,7 +83,12 @@ void PluginDownloadUrlHelper::RenameDownloadedFile() {
}
}
-void PluginDownloadUrlHelper::RunCallback() {
- callback_.Run(downloaded_file_);
+void PluginDownloadUrlHelper::RunFinishedCallback() {
+ download_finished_callback_.Run(downloaded_file_);
+ delete this;
+}
+
+void PluginDownloadUrlHelper::RunErrorCallback(const std::string& msg) {
+ error_callback_.Run(msg);
delete this;
}
diff --git a/chrome/browser/plugin_download_helper.h b/chrome/browser/plugin_download_helper.h
index 83036a3..8340888 100644
--- a/chrome/browser/plugin_download_helper.h
+++ b/chrome/browser/plugin_download_helper.h
@@ -26,13 +26,15 @@ class URLRequestContextGetter;
class PluginDownloadUrlHelper : public content::URLFetcherDelegate {
public:
typedef base::Callback<void(const FilePath&)> DownloadFinishedCallback;
+ typedef base::Callback<void(const std::string&)> ErrorCallback;
PluginDownloadUrlHelper();
virtual ~PluginDownloadUrlHelper();
void InitiateDownload(const GURL& download_url,
net::URLRequestContextGetter* request_context,
- const DownloadFinishedCallback& callback);
+ const DownloadFinishedCallback& callback,
+ const ErrorCallback& error_callback);
// content::URLFetcherDelegate
virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE;
@@ -42,8 +44,11 @@ class PluginDownloadUrlHelper : public content::URLFetcherDelegate {
// of the download URL.
void RenameDownloadedFile();
- // Runs the callback and deletes itself.
- void RunCallback();
+ // Runs the success callback and deletes itself.
+ void RunFinishedCallback();
+
+ // Runs the error callback and deletes itself.
+ void RunErrorCallback(const std::string& error);
// The download file request initiated by the plugin.
scoped_ptr<content::URLFetcher> download_file_fetcher_;
@@ -51,7 +56,8 @@ class PluginDownloadUrlHelper : public content::URLFetcherDelegate {
GURL download_url_;
FilePath downloaded_file_;
- DownloadFinishedCallback callback_;
+ DownloadFinishedCallback download_finished_callback_;
+ ErrorCallback error_callback_;
DISALLOW_COPY_AND_ASSIGN(PluginDownloadUrlHelper);
};
diff --git a/chrome/browser/plugin_download_helper_unittest.cc b/chrome/browser/plugin_download_helper_unittest.cc
new file mode 100644
index 0000000..5615c5c
--- /dev/null
+++ b/chrome/browser/plugin_download_helper_unittest.cc
@@ -0,0 +1,122 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/plugin_download_helper.h"
+
+#include "base/bind.h"
+#include "base/file_path.h"
+#include "base/message_loop.h"
+#include "base/test/test_timeouts.h"
+#include "chrome/common/chrome_paths.h"
+#include "content/test/test_browser_thread.h"
+#include "net/base/net_util.h"
+#include "net/url_request/url_request_context.h"
+#include "net/url_request/url_request_context_getter.h"
+#include "net/url_request/url_request_test_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+class TestURLRequestContextGetter : public net::URLRequestContextGetter {
+ public:
+ TestURLRequestContextGetter()
+ : io_message_loop_proxy_(base::MessageLoopProxy::current()) {
+ }
+
+ virtual net::URLRequestContext* GetURLRequestContext() {
+ if (!context_)
+ context_ = new TestURLRequestContext();
+ return context_;
+ }
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
+ return io_message_loop_proxy_;
+ }
+
+ protected:
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
+
+ private:
+ virtual ~TestURLRequestContextGetter() {}
+
+ scoped_refptr<net::URLRequestContext> context_;
+};
+
+} // namespace
+
+// This class provides functionality to test the plugin installer download
+// file functionality.
+class PluginInstallerDownloadTest : public testing::Test {
+ public:
+ PluginInstallerDownloadTest()
+ : message_loop_(MessageLoop::TYPE_IO),
+ file_thread_(content::BrowserThread::FILE, &message_loop_),
+ download_helper_(NULL),
+ success_(false) {}
+ ~PluginInstallerDownloadTest() {}
+
+ void Start() {
+ FilePath path;
+ PathService::Get(chrome::DIR_TEST_DATA, &path);
+ initial_download_path_ = net::FilePathToFileURL(
+ path.AppendASCII("download-test1.lib"));
+ download_helper_ = new PluginDownloadUrlHelper();
+ TestURLRequestContextGetter* context_getter =
+ new TestURLRequestContextGetter;
+ download_helper_->InitiateDownload(
+ initial_download_path_,
+ context_getter,
+ base::Bind(&PluginInstallerDownloadTest::OnDownloadCompleted,
+ base::Unretained(this)),
+ base::Bind(&PluginInstallerDownloadTest::OnDownloadError,
+ base::Unretained(this)));
+
+ message_loop_.PostDelayedTask(
+ FROM_HERE, MessageLoop::QuitClosure(),
+ TestTimeouts::action_max_timeout_ms());
+ }
+
+ void OnDownloadCompleted(const FilePath& download_path) {
+ success_ = true;
+ final_download_path_ = download_path;
+ message_loop_.Quit();
+ download_helper_ = NULL;
+ }
+
+ void OnDownloadError(const std::string& error) {
+ ADD_FAILURE() << error;
+ message_loop_.Quit();
+ download_helper_ = NULL;
+ }
+
+ FilePath final_download_path() const {
+ return final_download_path_;
+ }
+
+ FilePath initial_download_path() const {
+ return final_download_path_;
+ }
+
+ bool success() const {
+ return success_;
+ }
+
+ private:
+ MessageLoop message_loop_;
+ content::TestBrowserThread file_thread_;
+ FilePath final_download_path_;
+ PluginDownloadUrlHelper* download_helper_;
+ bool success_;
+ GURL initial_download_path_;
+};
+
+// This test validates that the plugin downloader downloads the specified file
+// to a temporary path with the same file name.
+TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) {
+ Start();
+ MessageLoop::current()->Run();
+
+ ASSERT_TRUE(success());
+ EXPECT_TRUE(initial_download_path().BaseName().value() ==
+ final_download_path().BaseName().value());
+}
diff --git a/chrome/browser/plugin_installer.cc b/chrome/browser/plugin_installer.cc
index bbdfa6e..0316412 100644
--- a/chrome/browser/plugin_installer.cc
+++ b/chrome/browser/plugin_installer.cc
@@ -46,7 +46,8 @@ void PluginInstaller::StartInstalling(
downloader->InitiateDownload(
plugin_url_,
request_context,
- base::Bind(&PluginInstaller::DidFinishDownload, base::Unretained(this)));
+ base::Bind(&PluginInstaller::DidFinishDownload, base::Unretained(this)),
+ base::Bind(&PluginInstaller::DownloadError, base::Unretained(this)));
}
void PluginInstaller::DidFinishDownload(const FilePath& downloaded_file) {
@@ -56,3 +57,7 @@ void PluginInstaller::DidFinishDownload(const FilePath& downloaded_file) {
FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DidFinishDownload());
platform_util::OpenItem(downloaded_file);
}
+
+void PluginInstaller::DownloadError(const std::string& msg) {
+ FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg));
+}
diff --git a/chrome/browser/plugin_installer.h b/chrome/browser/plugin_installer.h
index eef0ca5..514d919 100644
--- a/chrome/browser/plugin_installer.h
+++ b/chrome/browser/plugin_installer.h
@@ -57,6 +57,7 @@ class PluginInstaller {
private:
void DidFinishDownload(const FilePath& downloaded_file);
+ void DownloadError(const std::string& msg);
State state_;
ObserverList<PluginInstallerObserver> observers_;
diff --git a/chrome/browser/plugin_installer_observer.cc b/chrome/browser/plugin_installer_observer.cc
index ed210ec..72284c7 100644
--- a/chrome/browser/plugin_installer_observer.cc
+++ b/chrome/browser/plugin_installer_observer.cc
@@ -23,3 +23,5 @@ void PluginInstallerObserver::DidStartDownload() {
void PluginInstallerObserver::DidFinishDownload() {
}
+void PluginInstallerObserver::DownloadError(const std::string& message) {
+}
diff --git a/chrome/browser/plugin_installer_observer.h b/chrome/browser/plugin_installer_observer.h
index ac5f881..1d95afd 100644
--- a/chrome/browser/plugin_installer_observer.h
+++ b/chrome/browser/plugin_installer_observer.h
@@ -6,6 +6,8 @@
#define CHROME_BROWSER_PLUGIN_INSTALLER_OBSERVER_H_
#pragma once
+#include <string>
+
class PluginInstaller;
class PluginInstallerObserver {
@@ -21,6 +23,7 @@ class PluginInstallerObserver {
virtual void DidStartDownload();
virtual void DidFinishDownload();
+ virtual void DownloadError(const std::string& message);
// Weak pointer; Owned by PluginFinder, which is a singleton.
PluginInstaller* installer_;
diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc
index 338c851..91f30f9 100644
--- a/chrome/browser/plugin_observer.cc
+++ b/chrome/browser/plugin_observer.cc
@@ -389,6 +389,10 @@ class PluginObserver::MissingPluginHost : public PluginInstallerObserver {
observer_->Send(new ChromeViewMsg_FinishedDownloadingPlugin(routing_id_));
}
+ virtual void DownloadError(const std::string& msg) OVERRIDE {
+ observer_->Send(new ChromeViewMsg_ErrorDownloadingPlugin(routing_id_, msg));
+ }
+
private:
// Weak pointer; owns us.
PluginObserver* observer_;
diff --git a/chrome/browser/plugin_test.cc b/chrome/browser/plugin_test.cc
index 711ef0d..d4639e1 100644
--- a/chrome/browser/plugin_test.cc
+++ b/chrome/browser/plugin_test.cc
@@ -27,9 +27,7 @@
#include <string>
-#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/test/test_timeouts.h"
#include "chrome/browser/plugin_download_helper.h"
@@ -40,10 +38,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/ui/ui_test.h"
#include "content/browser/net/url_request_mock_http_job.h"
-#include "content/test/test_browser_thread.h"
#include "net/base/net_util.h"
-#include "net/url_request/url_request_context_getter.h"
-#include "net/url_request/url_request_test_util.h"
#include "third_party/npapi/bindings/npapi.h"
#include "webkit/plugins/npapi/plugin_constants_win.h"
#include "webkit/plugins/npapi/plugin_list.h"
@@ -251,98 +246,3 @@ TEST_F(PluginTest, Silverlight) {
TestTimeouts::action_max_timeout_ms(), false);
}
#endif // defined(OS_WIN)
-
-#if !defined(OS_CHROMEOS)
-namespace {
-
-class TestURLRequestContextGetter : public net::URLRequestContextGetter {
- public:
- explicit TestURLRequestContextGetter() {
- io_message_loop_proxy_ = base::MessageLoopProxy::current();
- }
- virtual net::URLRequestContext* GetURLRequestContext() {
- if (!context_)
- context_ = new TestURLRequestContext();
- return context_;
- }
- virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
- return io_message_loop_proxy_;
- }
-
- protected:
- scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
-
- private:
- virtual ~TestURLRequestContextGetter() {}
-
- scoped_refptr<net::URLRequestContext> context_;
-};
-
-} // namespace
-
-// This class provides functionality to test the plugin installer download
-// file functionality.
-class PluginInstallerDownloadTest : public testing::Test {
- public:
- PluginInstallerDownloadTest()
- : message_loop_(MessageLoop::TYPE_IO),
- file_thread_(content::BrowserThread::FILE, &message_loop_),
- download_helper_(NULL),
- success_(false) {}
- ~PluginInstallerDownloadTest() {}
-
- void Start() {
- initial_download_path_ = PluginTest::GetTestUrl("flash.html", "", false);
- download_helper_ = new PluginDownloadUrlHelper();
- TestURLRequestContextGetter* context_getter =
- new TestURLRequestContextGetter;
- download_helper_->InitiateDownload(
- initial_download_path_,
- context_getter,
- base::Bind(&PluginInstallerDownloadTest::OnDownloadCompleted,
- base::Unretained(this)));
-
- message_loop_.PostDelayedTask(
- FROM_HERE, MessageLoop::QuitClosure(),
- TestTimeouts::action_max_timeout_ms());
- }
-
- void OnDownloadCompleted(const FilePath& download_path) {
- success_ = true;
- final_download_path_ = download_path;
- message_loop_.Quit();
- download_helper_ = NULL;
- }
-
- FilePath final_download_path() const {
- return final_download_path_;
- }
-
- FilePath initial_download_path() const {
- return final_download_path_;
- }
-
- bool success() const {
- return success_;
- }
-
- private:
- MessageLoop message_loop_;
- content::TestBrowserThread file_thread_;
- FilePath final_download_path_;
- PluginDownloadUrlHelper* download_helper_;
- bool success_;
- GURL initial_download_path_;
-};
-
-// This test validates that the plugin downloader downloads the specified file
-// to a temporary path with the same file name.
-TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) {
- Start();
- MessageLoop::current()->Run();
-
- EXPECT_TRUE(success());
- EXPECT_TRUE(initial_download_path().BaseName().value() ==
- final_download_path().BaseName().value());
-}
-#endif // !defined(OS_CHROMEOS)
diff --git a/chrome/browser/resources/plugins_win.json b/chrome/browser/resources/plugins_win.json
index 0aaf512..0bda3ae 100644
--- a/chrome/browser/resources/plugins_win.json
+++ b/chrome/browser/resources/plugins_win.json
@@ -63,7 +63,8 @@
"name": "Adobe Flash Player",
"identifier": "adobe-flash-player",
"help_url": "https://support.google.com/chrome/?p=plugin_flash",
- "url": "http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe"
+ "url": "http://get.adobe.com/flashplayer/",
+ "displayurl": true
},
{
"mime_types": [
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 323b1d4..3fb7c8d 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -1554,6 +1554,7 @@
'browser/password_manager/password_store_mac_unittest.cc',
'browser/password_manager/password_store_win_unittest.cc',
'browser/password_manager/password_store_x_unittest.cc',
+ 'browser/plugin_download_helper_unittest.cc',
'browser/plugin_finder_unittest.cc',
'browser/plugin_prefs_unittest.cc',
'browser/policy/asynchronous_policy_loader_unittest.cc',
@@ -2160,6 +2161,7 @@
'sources/': [
['exclude', '^browser/password_manager/native_backend_gnome_x_unittest.cc'],
['exclude', '^browser/password_manager/native_backend_kwallet_x_unittest.cc'],
+ ['exclude', '^browser/plugin_download_helper_unittest.cc'],
['exclude', '^browser/safe_browsing/download_protection_service_unittest.cc' ],
],
'conditions': [
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 5bf4518..98a1b8a 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -448,6 +448,11 @@ IPC_MESSAGE_ROUTED0(ChromeViewMsg_StartedDownloadingPlugin)
IPC_MESSAGE_ROUTED0(ChromeViewMsg_FinishedDownloadingPlugin)
#endif // defined(ENABLE_PLUGIN_INSTALLATION)
+// Notifies a missing plug-in placeholder that there was an error downloading
+// the plug-in.
+IPC_MESSAGE_ROUTED1(ChromeViewMsg_ErrorDownloadingPlugin,
+ std::string /* message */)
+
// Specifies the URL as the first parameter (a wstring) and thumbnail as
// binary data as the second parameter.
IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_Thumbnail,
diff --git a/chrome/renderer/plugins/missing_plugin.cc b/chrome/renderer/plugins/missing_plugin.cc
index 714d849..9a1a4b1 100644
--- a/chrome/renderer/plugins/missing_plugin.cc
+++ b/chrome/renderer/plugins/missing_plugin.cc
@@ -147,6 +147,8 @@ bool MissingPlugin::OnMessageReceived(const IPC::Message& message) {
OnStartedDownloadingPlugin)
IPC_MESSAGE_HANDLER(ChromeViewMsg_FinishedDownloadingPlugin,
OnFinishedDownloadingPlugin)
+ IPC_MESSAGE_HANDLER(ChromeViewMsg_ErrorDownloadingPlugin,
+ OnErrorDownloadingPlugin)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -170,6 +172,11 @@ void MissingPlugin::OnStartedDownloadingPlugin() {
void MissingPlugin::OnFinishedDownloadingPlugin() {
SetMessage(l10n_util::GetStringUTF16(IDS_PLUGIN_INSTALLING));
}
+
+void MissingPlugin::OnErrorDownloadingPlugin(const std::string& error) {
+ SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_ERROR,
+ UTF8ToUTF16(error)));
+}
#endif // defined(ENABLE_PLUGIN_INSTALLATION)
void MissingPlugin::PluginListChanged() {
diff --git a/chrome/renderer/plugins/missing_plugin.h b/chrome/renderer/plugins/missing_plugin.h
index 2d7c1f5..69936f2 100644
--- a/chrome/renderer/plugins/missing_plugin.h
+++ b/chrome/renderer/plugins/missing_plugin.h
@@ -54,6 +54,7 @@ class MissingPlugin : public PluginPlaceholder,
void OnFoundMissingPlugin(const string16& plugin_name);
void OnStartedDownloadingPlugin();
void OnFinishedDownloadingPlugin();
+ void OnErrorDownloadingPlugin(const std::string& error);
#endif
void SetMessage(const string16& message);