summaryrefslogtreecommitdiffstats
path: root/content/public/browser
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 16:48:16 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-20 16:48:16 +0000
commita53209b21cb9aeae11f33463f83edee913ce1a71 (patch)
tree5bcb1df406f192219f0532536ccca10b5dc7aeaf /content/public/browser
parent4a68e24b2b9eddab3a254177d6dd033f0c61b711 (diff)
downloadchromium_src-a53209b21cb9aeae11f33463f83edee913ce1a71.zip
chromium_src-a53209b21cb9aeae11f33463f83edee913ce1a71.tar.gz
chromium_src-a53209b21cb9aeae11f33463f83edee913ce1a71.tar.bz2
Get rid of SavePackage usage in Chrome. I've moved IsSavableContents onto WebContents itself, IsSavableURL to a file in chrome, and made Chrome's DownloadManagerDelegate give SavePackage the file path through a callback.
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9254051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118452 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/browser')
-rw-r--r--content/public/browser/DEPS1
-rw-r--r--content/public/browser/download_manager_delegate.h20
-rw-r--r--content/public/browser/save_page_type.h22
-rw-r--r--content/public/browser/web_contents.h8
4 files changed, 40 insertions, 11 deletions
diff --git a/content/public/browser/DEPS b/content/public/browser/DEPS
index 85dabc6..6013335 100644
--- a/content/public/browser/DEPS
+++ b/content/public/browser/DEPS
@@ -5,7 +5,6 @@ include_rules = [
# TODO(jam): remove
"+content/browser/download/download_id.h",
"+content/browser/download/download_state_info.h",
- "+content/browser/download/save_package.h",
"+content/browser/download/interrupt_reasons.h",
"+content/browser/javascript_dialogs.h",
"+content/browser/tab_contents/navigation_controller.h",
diff --git a/content/public/browser/download_manager_delegate.h b/content/public/browser/download_manager_delegate.h
index a92301e..722aac7 100644
--- a/content/public/browser/download_manager_delegate.h
+++ b/content/public/browser/download_manager_delegate.h
@@ -7,17 +7,19 @@
#pragma once
#include "base/basictypes.h"
-#include "base/memory/weak_ptr.h"
+#include "base/callback.h"
+#include "base/file_path.h"
#include "base/time.h"
-
-class FilePath;
-class SavePackage;
+#include "content/public/browser/save_page_type.h"
namespace content {
class DownloadItem;
class WebContents;
+typedef base::Callback<void(const FilePath&, content::SavePageType)>
+ SaveFilePathPickedCallback;
+
// Browser's download manager: manages all downloads and destination view.
class DownloadManagerDelegate {
public:
@@ -106,11 +108,13 @@ class DownloadManagerDelegate {
FilePath* website_save_dir,
FilePath* download_save_dir) = 0;
- // Asks the user for the path to save a page. The delegate calls
- // SavePackage::OnPathPicked to give the answer.
- virtual void ChooseSavePath(const base::WeakPtr<SavePackage>& save_package,
+ // Asks the user for the path to save a page. The delegate calls the callback
+ // to give the answer.
+ virtual void ChooseSavePath(WebContents* web_contents,
const FilePath& suggested_path,
- bool can_save_as_complete) = 0;
+ const FilePath::StringType& default_extension,
+ bool can_save_as_complete,
+ SaveFilePathPickedCallback callback) = 0;
// Informs the delegate that the progress of downloads has changed.
virtual void DownloadProgressUpdated() = 0;
diff --git a/content/public/browser/save_page_type.h b/content/public/browser/save_page_type.h
new file mode 100644
index 0000000..81c7803
--- /dev/null
+++ b/content/public/browser/save_page_type.h
@@ -0,0 +1,22 @@
+// 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.
+
+#ifndef CONTENT_PUBLIC_BROWSER_SAVE_PAGE_TYPE_H_
+#define CONTENT_PUBLIC_BROWSER_SAVE_PAGE_TYPE_H_
+#pragma once
+
+namespace content {
+
+enum SavePageType {
+ // The value of the save type before its set by the user.
+ SAVE_PAGE_TYPE_UNKNOWN = -1,
+ // User chose to save only the HTML of the page.
+ SAVE_PAGE_TYPE_AS_ONLY_HTML = 0,
+ // User chose to save complete-html page.
+ SAVE_PAGE_TYPE_AS_COMPLETE_HTML = 1
+};
+
+}
+
+#endif // CONTENT_PUBLIC_BROWSER_SAVE_PAGE_TYPE_H_
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index acb2623..393f984 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -9,9 +9,9 @@
#include "base/basictypes.h"
#include "base/process_util.h"
#include "base/string16.h"
-#include "content/browser/download/save_package.h"
#include "content/common/content_export.h"
#include "content/public/browser/page_navigator.h"
+#include "content/public/browser/save_page_type.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/view_type.h"
#include "ui/gfx/native_widget_types.h"
@@ -262,6 +262,10 @@ class WebContents : public PageNavigator {
// Misc state & callbacks ----------------------------------------------------
+ // Check whether we can do the saving page operation this page given its MIME
+ // type.
+ virtual bool IsSavable() = 0;
+
// Prepare for saving the current web page to disk.
virtual void OnSavePage() = 0;
@@ -270,7 +274,7 @@ class WebContents : public PageNavigator {
// saving process has been initiated successfully.
virtual bool SavePage(const FilePath& main_file,
const FilePath& dir_path,
- SavePackage::SavePackageType save_type) = 0;
+ SavePageType save_type) = 0;
// Returns true if the active NavigationEntry's page_id equals page_id.
virtual bool IsActiveEntry(int32 page_id) = 0;