summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/download/mhtml_generation_browsertest.cc4
-rw-r--r--content/browser/download/mhtml_generation_manager.cc12
-rw-r--r--content/browser/download/mhtml_generation_manager.h11
-rw-r--r--content/browser/renderer_host/browser_render_process_host.cc4
-rw-r--r--content/browser/renderer_host/browser_render_process_host.h2
5 files changed, 18 insertions, 15 deletions
diff --git a/content/browser/download/mhtml_generation_browsertest.cc b/content/browser/download/mhtml_generation_browsertest.cc
index b0589a8..2d5e378 100644
--- a/content/browser/download/mhtml_generation_browsertest.cc
+++ b/content/browser/download/mhtml_generation_browsertest.cc
@@ -55,9 +55,9 @@ IN_PROC_BROWSER_TEST_F(MHTMLGenerationTest, GenerateMHTML) {
MHTMLGenerationManager::NotificationDetails details;
ASSERT_TRUE(signal.GetDetailsFor(source.map_key(), &details));
- ASSERT_TRUE(details.success);
+ ASSERT_GT(details.file_size, 0);
- // Make sure the generated file has some contents.
+ // Make sure the actual generated file has some contents.
int64 file_size;
ASSERT_TRUE(file_util::GetFileSize(path, &file_size));
EXPECT_GT(file_size, 100);
diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc
index fe60ed1..1448569 100644
--- a/content/browser/download/mhtml_generation_manager.cc
+++ b/content/browser/download/mhtml_generation_manager.cc
@@ -45,8 +45,8 @@ void MHTMLGenerationManager::GenerateMHTML(TabContents* tab_contents,
job_id, file, renderer_process));
}
-void MHTMLGenerationManager::MHTMLGenerated(int job_id, bool success) {
- JobFinished(job_id, success);
+void MHTMLGenerationManager::MHTMLGenerated(int job_id, int64 mhtml_data_size) {
+ JobFinished(job_id, mhtml_data_size);
}
void MHTMLGenerationManager::CreateFile(int job_id, const FilePath& file_path,
@@ -74,7 +74,7 @@ void MHTMLGenerationManager::FileCreated(int job_id,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (browser_file == base::kInvalidPlatformFileValue) {
LOG(ERROR) << "Failed to create file";
- JobFinished(job_id, false);
+ JobFinished(job_id, -1);
return;
}
@@ -91,7 +91,7 @@ void MHTMLGenerationManager::FileCreated(int job_id,
RenderViewHost* rvh = RenderViewHost::FromID(job.process_id, job.routing_id);
if (!rvh) {
// The tab went away.
- JobFinished(job_id, false);
+ JobFinished(job_id, -1);
return;
}
@@ -99,7 +99,7 @@ void MHTMLGenerationManager::FileCreated(int job_id,
renderer_file));
}
-void MHTMLGenerationManager::JobFinished(int job_id, bool success) {
+void MHTMLGenerationManager::JobFinished(int job_id, int64 file_size) {
IDToJobMap::iterator iter = id_to_job_.find(job_id);
if (iter == id_to_job_.end()) {
NOTREACHED();
@@ -112,7 +112,7 @@ void MHTMLGenerationManager::JobFinished(int job_id, bool success) {
if (rvh) {
NotificationDetails details;
details.file_path = job.file_path;
- details.success = success;
+ details.file_size = file_size;
NotificationService::current()->Notify(
content::NOTIFICATION_MHTML_GENERATED,
diff --git a/content/browser/download/mhtml_generation_manager.h b/content/browser/download/mhtml_generation_manager.h
index 9271327..47c847e 100644
--- a/content/browser/download/mhtml_generation_manager.h
+++ b/content/browser/download/mhtml_generation_manager.h
@@ -28,13 +28,15 @@ class CONTENT_EXPORT MHTMLGenerationManager
// page for |tab_contents|.
void GenerateMHTML(TabContents* tab_contents, const FilePath& file);
- // Notification from the renderer that the MHTML generation succeeded/failed.
- void MHTMLGenerated(int job_id, bool success);
+ // Notification from the renderer that the MHTML generation finished.
+ // |mhtml_data_size| contains the size in bytes of the generated MHTML data,
+ // or -1 in case of failure.
+ void MHTMLGenerated(int job_id, int64 mhtml_data_size);
// The details sent along with the MHTML_GENERATED notification.
struct NotificationDetails {
FilePath file_path;
- bool success;
+ int64 file_size;
};
private:
@@ -71,7 +73,8 @@ class CONTENT_EXPORT MHTMLGenerationManager
// Called on the UI thread when a job has been processed (successfully or
// not). Closes the file and removes the job from the job map.
- void JobFinished(int job_id, bool success);
+ // |mhtml_data_size| is -1 if the MHTML generation failed.
+ void JobFinished(int job_id, int64 mhtml_data_size);
typedef std::map<int, Job> IDToJobMap;
IDToJobMap id_to_job_;
diff --git a/content/browser/renderer_host/browser_render_process_host.cc b/content/browser/renderer_host/browser_render_process_host.cc
index 53ec7ba..d802c31 100644
--- a/content/browser/renderer_host/browser_render_process_host.cc
+++ b/content/browser/renderer_host/browser_render_process_host.cc
@@ -995,7 +995,7 @@ void BrowserRenderProcessHost::OnRevealFolderInOS(const FilePath& path) {
content::GetContentClient()->browser()->OpenItem(path);
}
-void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, bool success) {
+void BrowserRenderProcessHost::OnSavedPageAsMHTML(int job_id, int64 data_size) {
content::GetContentClient()->browser()->GetMHTMLGenerationManager()->
- MHTMLGenerated(job_id, success);
+ MHTMLGenerated(job_id, data_size);
}
diff --git a/content/browser/renderer_host/browser_render_process_host.h b/content/browser/renderer_host/browser_render_process_host.h
index 97297e9..456de48 100644
--- a/content/browser/renderer_host/browser_render_process_host.h
+++ b/content/browser/renderer_host/browser_render_process_host.h
@@ -96,7 +96,7 @@ class BrowserRenderProcessHost : public RenderProcessHost,
void SuddenTerminationChanged(bool enabled);
void OnUserMetricsRecordAction(const std::string& action);
void OnRevealFolderInOS(const FilePath& path);
- void OnSavedPageAsMHTML(int job_id, bool success);
+ void OnSavedPageAsMHTML(int job_id, int64 mhtml_file_size);
// Generates a command line to be used to spawn a renderer and appends the
// results to |*command_line|.