Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_CHROMEOS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/platform_file.h" | |
| 10 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/ui/select_file_dialog.h" | 10 #include "chrome/browser/ui/select_file_dialog.h" |
| 11 #include "content/public/browser/download_manager_delegate.h" | |
| 12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
| 13 | 13 |
| 14 namespace gdata { | 14 namespace gdata { |
| 15 class GDataFileSystem; | 15 class GDataFileSystem; |
| 16 } | 16 } |
| 17 | 17 |
| 18 // Handles showing a dialog to the user to ask for the filename to save a page | 18 // Handles showing a dialog to the user to ask for the filename to save a page |
| 19 // on ChromeOS. | 19 // on ChromeOS. |
| 20 class SavePackageFilePickerChromeOS : public SelectFileDialog::Listener, | 20 class SavePackageFilePickerChromeOS : public SelectFileDialog::Listener, |
| 21 public content::WebContentsObserver { | 21 public content::WebContentsObserver { |
| 22 public: | 22 public: |
| 23 SavePackageFilePickerChromeOS(content::WebContents* web_contents, | 23 SavePackageFilePickerChromeOS( |
| 24 const FilePath& suggested_path); | 24 content::WebContents* web_contents, |
| 25 const FilePath& suggested_path, | |
| 26 content::SaveFilePathPickedCallback callback); | |
|
achuithb
2012/04/24 22:06:09
I would pass in a const reference.
benjhayden
2012/04/26 15:05:57
Done.
| |
| 25 | 27 |
| 26 private: | 28 private: |
| 27 virtual ~SavePackageFilePickerChromeOS(); | 29 virtual ~SavePackageFilePickerChromeOS(); |
| 28 | 30 |
| 29 // SelectFileDialog::Listener implementation. | 31 // SelectFileDialog::Listener implementation. |
| 30 virtual void FileSelected(const FilePath& path, | 32 virtual void FileSelected(const FilePath& path, |
| 31 int index, | 33 int index, |
| 32 void* params) OVERRIDE; | 34 void* params) OVERRIDE; |
| 33 virtual void FileSelectionCanceled(void* params) OVERRIDE; | 35 virtual void FileSelectionCanceled(void* params) OVERRIDE; |
| 34 | 36 |
| 35 // Calls WebContent::GenerateMHTML. | 37 content::SaveFilePathPickedCallback callback_; |
| 36 void GenerateMHTML(const FilePath* mhtml_path); | |
| 37 | |
| 38 // Callback for WebContents::GenerateMHTML. | |
| 39 void OnMHTMLGenerated(const FilePath& file_path, int64 file_size); | |
| 40 | |
| 41 // GDataFileSystem::TransferFile callback. | |
| 42 void OnTransferFile(base::PlatformFileError error); | |
| 43 | |
| 44 // Use web_contents() to get at GDataFileSystem. | |
| 45 gdata::GDataFileSystem* GetGDataFileSystem(); | |
| 46 | 38 |
| 47 // For managing select file dialogs. | 39 // For managing select file dialogs. |
| 48 scoped_refptr<SelectFileDialog> select_file_dialog_; | 40 scoped_refptr<SelectFileDialog> select_file_dialog_; |
| 49 FilePath selected_path_; | 41 FilePath selected_path_; |
| 50 | 42 |
| 51 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePickerChromeOS); | 43 DISALLOW_COPY_AND_ASSIGN(SavePackageFilePickerChromeOS); |
| 52 }; | 44 }; |
| 53 | 45 |
| 54 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_CHROMEOS_H_ | 46 #endif // CHROME_BROWSER_DOWNLOAD_SAVE_PACKAGE_FILE_PICKER_CHROMEOS_H_ |
| OLD | NEW |