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

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

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/drive/drive_download_handler.h" 11 #include "chrome/browser/chromeos/drive/drive_download_handler.h"
12 #include "chrome/browser/chromeos/drive/drive_file_system_util.h" 12 #include "chrome/browser/chromeos/drive/drive_file_system_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" 15 #include "chrome/browser/ui/chrome_select_file_policy.h"
16 #include "content/public/browser/download_item.h" 16 #include "content/public/browser/download_item.h"
17 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
18 #include "content/public/browser/web_contents_view.h"
18 #include "ui/shell_dialogs/selected_file_info.h" 19 #include "ui/shell_dialogs/selected_file_info.h"
19 20
20 namespace { 21 namespace {
21 22
22 // If false, we don't prompt the user as to where to save the file. This 23 // If false, we don't prompt the user as to where to save the file. This
23 // exists only for testing. 24 // exists only for testing.
24 bool g_should_prompt_for_filename = true; 25 bool g_should_prompt_for_filename = true;
25 26
26 // Trampoline callback between SubstituteDriveDownloadPath() and |callback|. 27 // Trampoline callback between SubstituteDriveDownloadPath() and |callback|.
27 void ContinueSettingUpDriveDownload( 28 void ContinueSettingUpDriveDownload(
(...skipping 18 matching lines...) Expand all
46 content::WebContents* web_contents, 47 content::WebContents* web_contents,
47 const base::FilePath& suggested_path, 48 const base::FilePath& suggested_path,
48 const content::SavePackagePathPickedCallback& callback) 49 const content::SavePackagePathPickedCallback& callback)
49 : content::WebContentsObserver(web_contents), 50 : content::WebContentsObserver(web_contents),
50 callback_(callback) { 51 callback_(callback) {
51 if (g_should_prompt_for_filename) { 52 if (g_should_prompt_for_filename) {
52 select_file_dialog_ = ui::SelectFileDialog::Create( 53 select_file_dialog_ = ui::SelectFileDialog::Create(
53 this, new ChromeSelectFilePolicy(web_contents)); 54 this, new ChromeSelectFilePolicy(web_contents));
54 ui::SelectFileDialog::FileTypeInfo file_types; 55 ui::SelectFileDialog::FileTypeInfo file_types;
55 file_types.support_drive = true; 56 file_types.support_drive = true;
56 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, 57 select_file_dialog_->SelectFile(
57 string16(), 58 ui::SelectFileDialog::SELECT_SAVEAS_FILE,
58 suggested_path.ReplaceExtension("mhtml"), 59 string16(),
59 &file_types, 60 suggested_path.ReplaceExtension("mhtml"),
60 0, 61 &file_types,
61 "mhtml", 62 0,
62 platform_util::GetTopLevel( 63 "mhtml",
63 web_contents->GetNativeView()), 64 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()),
64 NULL); 65 NULL);
65 } else { 66 } else {
66 FileSelected(suggested_path.ReplaceExtension("mhtml"), 0, NULL); 67 FileSelected(suggested_path.ReplaceExtension("mhtml"), 0, NULL);
67 } 68 }
68 } 69 }
69 70
70 void SavePackageFilePickerChromeOS::SetShouldPromptUser(bool should_prompt) { 71 void SavePackageFilePickerChromeOS::SetShouldPromptUser(bool should_prompt) {
71 g_should_prompt_for_filename = should_prompt; 72 g_should_prompt_for_filename = should_prompt;
72 } 73 }
73 74
74 SavePackageFilePickerChromeOS::~SavePackageFilePickerChromeOS() { 75 SavePackageFilePickerChromeOS::~SavePackageFilePickerChromeOS() {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } else { 117 } else {
117 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML, 118 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML,
118 content::SavePackageDownloadCreatedCallback()); 119 content::SavePackageDownloadCreatedCallback());
119 } 120 }
120 delete this; 121 delete this;
121 } 122 }
122 123
123 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) { 124 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) {
124 delete this; 125 delete this;
125 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698