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

Side by Side Diff: chrome/browser/download/save_package_file_picker_chromeos.cc

Issue 10698053: Breaks compile on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/download/save_package_file_picker_chromeos.h" 5 #include "chrome/browser/download/save_package_file_picker_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/i18n/file_util_icu.h" 9 #include "base/i18n/file_util_icu.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
11 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 11 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
12 #include "chrome/browser/chromeos/gdata/gdata_util.h" 12 #include "chrome/browser/chromeos/gdata/gdata_util.h"
13 #include "chrome/browser/platform_util.h" 13 #include "chrome/browser/platform_util.h"
14 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/browser/ui/chrome_select_file_policy.h"
16 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/download_item.h" 16 #include "content/public/browser/download_item.h"
18 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
19 18
20 namespace { 19 namespace {
21 20
22 // If false, we don't prompt the user as to where to save the file. This 21 // If false, we don't prompt the user as to where to save the file. This
23 // exists only for testing. 22 // exists only for testing.
24 bool g_should_prompt_for_filename = true; 23 bool g_should_prompt_for_filename = true;
25 24
26 // Trampoline callback between GetGDataTempDownloadPath() and |callback|. 25 // Trampoline callback between GetGDataTempDownloadPath() and |callback|.
27 void ContinueSettingUpGDataDownload( 26 void ContinueSettingUpGDataDownload(
28 const content::SavePackagePathPickedCallback& callback, 27 const content::SavePackagePathPickedCallback& callback,
29 const FilePath& gdata_path, 28 const FilePath& gdata_path,
30 const FilePath& gdata_tmp_download_path) { 29 const FilePath& gdata_tmp_download_path) {
31 callback.Run(gdata_tmp_download_path, content::SAVE_PAGE_TYPE_AS_MHTML, 30 callback.Run(gdata_tmp_download_path, content::SAVE_PAGE_TYPE_AS_MHTML,
32 base::Bind(&gdata::GDataDownloadObserver::SetDownloadParams, 31 base::Bind(&gdata::GDataDownloadObserver::SetDownloadParams,
33 gdata_path)); 32 gdata_path));
34 } 33 }
35 34
36 } // anonymous namespace 35 } // anonymous namespace
37 36
38 SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS( 37 SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS(
39 content::WebContents* web_contents, 38 content::WebContents* web_contents,
40 const FilePath& suggested_path, 39 const FilePath& suggested_path,
41 const content::SavePackagePathPickedCallback& callback) 40 const content::SavePackagePathPickedCallback& callback)
42 : content::WebContentsObserver(web_contents), 41 : content::WebContentsObserver(web_contents),
43 callback_(callback) { 42 callback_(callback) {
44 if (g_should_prompt_for_filename) { 43 if (g_should_prompt_for_filename) {
45 select_file_dialog_ = SelectFileDialog::Create( 44 select_file_dialog_ = SelectFileDialog::Create(this);
46 this, new ChromeSelectFilePolicy(web_contents));
47 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, 45 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE,
48 string16(), 46 string16(),
49 suggested_path.ReplaceExtension("mhtml"), 47 suggested_path.ReplaceExtension("mhtml"),
50 NULL, 48 NULL,
51 0, 49 0,
52 "mhtml", 50 "mhtml",
51 web_contents,
53 platform_util::GetTopLevel( 52 platform_util::GetTopLevel(
54 web_contents->GetNativeView()), 53 web_contents->GetNativeView()),
55 NULL); 54 NULL);
56 } else { 55 } else {
57 FileSelected(suggested_path.ReplaceExtension("mhtml"), 0, NULL); 56 FileSelected(suggested_path.ReplaceExtension("mhtml"), 0, NULL);
58 } 57 }
59 } 58 }
60 59
61 void SavePackageFilePickerChromeOS::SetShouldPromptUser(bool should_prompt) { 60 void SavePackageFilePickerChromeOS::SetShouldPromptUser(bool should_prompt) {
62 g_should_prompt_for_filename = should_prompt; 61 g_should_prompt_for_filename = should_prompt;
(...skipping 28 matching lines...) Expand all
91 } else { 90 } else {
92 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML, 91 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML,
93 content::SavePackageDownloadCreatedCallback()); 92 content::SavePackageDownloadCreatedCallback());
94 } 93 }
95 delete this; 94 delete this;
96 } 95 }
97 96
98 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) { 97 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) {
99 delete this; 98 delete this;
100 } 99 }
OLDNEW
« no previous file with comments | « chrome/browser/download/save_package_file_picker.cc ('k') | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698