Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 10941042: Browser plugin: Implement loadStart and loadAbort events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed extra space Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index 8337c0a1183384c012b1f5c1d51972ced302a20a..aa85cd9c07c51b42531206aa550e03908effc705 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "base/string_util.h"
#include "content/browser/browser_plugin/browser_plugin_guest_helper.h"
#include "content/browser/browser_plugin/browser_plugin_host_factory.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
@@ -18,6 +19,7 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/common/result_codes.h"
#include "content/browser/browser_plugin/browser_plugin_host_factory.h"
+#include "net/base/net_errors.h"
#include "ui/surface/transport_dib.h"
namespace content {
@@ -74,6 +76,16 @@ void BrowserPluginGuest::Go(int relative_index) {
web_contents()->GetController().GoToOffset(relative_index);
}
+bool BrowserPluginGuest::CanDownload(RenderViewHost* render_view_host,
+ int request_id,
+ const std::string& request_method) {
+ // TODO(fsamuel): We disable downloads in guests for now, but we will later
+ // expose API to allow embedders to handle them.
+ // Note: it seems content_shell ignores this. This should be fixed
+ // for debugging and test purposes.
+ return false;
+}
+
void BrowserPluginGuest::RendererUnresponsive(WebContents* source) {
base::ProcessHandle process_handle =
web_contents()->GetRenderProcessHost()->GetHandle();
@@ -271,6 +283,37 @@ void BrowserPluginGuest::SetCursor(const WebCursor& cursor) {
cursor_ = cursor;
}
+void BrowserPluginGuest::DidStartProvisionalLoadForFrame(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ bool is_error_page,
+ RenderViewHost* render_view_host) {
+ // Inform the embedder of the loadStart.
+ SendMessageToEmbedder(
+ new BrowserPluginMsg_LoadStart(instance_id(),
+ validated_url,
+ is_main_frame));
+}
+
+void BrowserPluginGuest::DidFailProvisionalLoad(
+ int64 frame_id,
+ bool is_main_frame,
+ const GURL& validated_url,
+ int error_code,
+ const string16& error_description,
+ RenderViewHost* render_view_host) {
+ // Translate the |error_code| into an error string.
+ std::string error_type;
+ RemoveChars(net::ErrorToString(error_code), "net::", &error_type);
+ // Inform the embedder of the loadAbort.
+ SendMessageToEmbedder(
+ new BrowserPluginMsg_LoadAbort(instance_id(),
+ validated_url,
+ is_main_frame,
+ error_type));
+}
+
void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
int64 frame_id,
bool is_main_frame,

Powered by Google App Engine
This is Rietveld 408576698