Index: content/browser/web_contents/web_contents_impl.cc |
=================================================================== |
--- content/browser/web_contents/web_contents_impl.cc (revision 212906) |
+++ content/browser/web_contents/web_contents_impl.cc (working copy) |
@@ -72,7 +72,6 @@ |
#include "content/public/browser/web_contents_view.h" |
#include "content/public/common/bindings_policy.h" |
#include "content/public/common/content_constants.h" |
-#include "content/public/common/content_restriction.h" |
#include "content/public/common/content_switches.h" |
#include "content/public/common/url_constants.h" |
#include "net/base/mime_util.h" |
@@ -356,7 +355,6 @@ |
minimum_zoom_percent_(static_cast<int>(kMinimumZoomFactor * 100)), |
maximum_zoom_percent_(static_cast<int>(kMaximumZoomFactor * 100)), |
temporary_zoom_settings_(false), |
- content_restrictions_(0), |
color_chooser_identifier_(0), |
message_source_(NULL), |
fullscreen_widget_routing_id_(MSG_ROUTING_NONE) { |
@@ -692,11 +690,8 @@ |
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad) |
IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailLoadWithError, |
OnDidFailLoadWithError) |
- IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateContentRestrictions, |
- OnUpdateContentRestrictions) |
IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset) |
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits) |
- IPC_MESSAGE_HANDLER(ViewHostMsg_SaveURLAs, OnSaveURL) |
IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory) |
IPC_MESSAGE_HANDLER(ViewHostMsg_JSOutOfMemory, OnJSOutOfMemory) |
IPC_MESSAGE_HANDLER(ViewHostMsg_RegisterProtocolHandler, |
@@ -1883,7 +1878,7 @@ |
// If we can not save the page, try to download it. |
if (!IsSavable()) { |
RecordDownloadSource(INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML); |
- SaveURL(GetURL(), Referrer(), true); |
+ SaveFrame(GetURL(), Referrer()); |
return; |
} |
@@ -1909,6 +1904,33 @@ |
return save_package_->Init(SavePackageDownloadCreatedCallback()); |
} |
+void WebContentsImpl::SaveFrame(const GURL& url, |
+ const Referrer& referrer) { |
+ if (!GetURL().is_valid()) |
+ return; |
+ bool is_main_frame = (url == GetURL()); |
+ |
+ DownloadManager* dlm = |
+ BrowserContext::GetDownloadManager(GetBrowserContext()); |
+ if (!dlm) |
+ return; |
+ int64 post_id = -1; |
+ if (is_main_frame) { |
+ const NavigationEntry* entry = controller_.GetActiveEntry(); |
+ if (entry) |
+ post_id = entry->GetPostID(); |
+ } |
+ scoped_ptr<DownloadUrlParameters> params( |
+ DownloadUrlParameters::FromWebContents(this, url)); |
+ params->set_referrer(referrer); |
+ params->set_post_id(post_id); |
+ params->set_prefer_cache(true); |
+ if (post_id >= 0) |
+ params->set_method("POST"); |
+ params->set_prompt(true); |
+ dlm->DownloadUrl(params.Pass()); |
+} |
+ |
void WebContentsImpl::GenerateMHTML( |
const base::FilePath& file, |
const base::Callback<void(const base::FilePath&, int64)>& callback) { |
@@ -2055,10 +2077,6 @@ |
return preferred_size_; |
} |
-int WebContentsImpl::GetContentRestrictions() const { |
- return content_restrictions_; |
-} |
- |
bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
return GetRenderViewHost() ? |
GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; |
@@ -2315,12 +2333,6 @@ |
message_source_)); |
} |
-void WebContentsImpl::OnUpdateContentRestrictions(int restrictions) { |
- content_restrictions_ = restrictions; |
- if (delegate_) |
- delegate_->ContentRestrictionsChanged(this); |
-} |
- |
void WebContentsImpl::OnGoToEntryAtOffset(int offset) { |
if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) { |
NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( |
@@ -2354,19 +2366,6 @@ |
temporary_zoom_settings_ = !remember; |
} |
-void WebContentsImpl::OnSaveURL(const GURL& url, |
- const Referrer& referrer) { |
- RecordDownloadSource(INITIATED_BY_PEPPER_SAVE); |
- // Check if the URL to save matches the URL of the main frame. Since this |
- // message originates from Pepper plugins, it may not be the case if the |
- // plugin is an embedded element. |
- GURL main_frame_url = GetURL(); |
- if (!main_frame_url.is_valid()) |
- return; |
- bool is_main_frame = (url == main_frame_url); |
- SaveURL(url, referrer, is_main_frame); |
-} |
- |
void WebContentsImpl::OnEnumerateDirectory(int request_id, |
const base::FilePath& path) { |
if (!delegate_) |
@@ -3134,9 +3133,6 @@ |
void WebContentsImpl::DidStartLoading(RenderViewHost* render_view_host) { |
SetIsLoading(true, NULL); |
- if (delegate_ && content_restrictions_) |
- OnUpdateContentRestrictions(0); |
- |
// Notify observers about navigation. |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
DidStartLoading(render_view_host)); |
@@ -3680,30 +3676,6 @@ |
GetCanonicalEncodingNameByAliasName(encoding); |
} |
-void WebContentsImpl::SaveURL(const GURL& url, |
- const Referrer& referrer, |
- bool is_main_frame) { |
- DownloadManager* dlm = |
- BrowserContext::GetDownloadManager(GetBrowserContext()); |
- if (!dlm) |
- return; |
- int64 post_id = -1; |
- if (is_main_frame) { |
- const NavigationEntry* entry = controller_.GetActiveEntry(); |
- if (entry) |
- post_id = entry->GetPostID(); |
- } |
- scoped_ptr<DownloadUrlParameters> params( |
- DownloadUrlParameters::FromWebContents(this, url)); |
- params->set_referrer(referrer); |
- params->set_post_id(post_id); |
- params->set_prefer_cache(true); |
- if (post_id >= 0) |
- params->set_method("POST"); |
- params->set_prompt(true); |
- dlm->DownloadUrl(params.Pass()); |
-} |
- |
void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
RenderWidgetHostView* rwh_view = view_->CreateViewForWidget(rvh); |
// Can be NULL during tests. |