| 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 #include "chrome/browser/chromeos/extensions/file_browser_handler_api.h" | 5 #include "chrome/browser/chromeos/extensions/file_browser_handler_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| 11 #include "base/platform_file.h" | 11 #include "base/platform_file.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/chromeos/extensions/file_handler_util.h" | 13 #include "chrome/browser/chromeos/extensions/file_handler_util.h" |
| 14 #include "chrome/browser/chromeos/extensions/file_manager_util.h" | 14 #include "chrome/browser/chromeos/extensions/file_manager_util.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/select_file_dialog.h" | 18 #include "chrome/browser/ui/select_file_dialog.h" |
| 19 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 19 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 20 #include "chrome/common/extensions/api/file_browser_handler.h" | 20 #include "chrome/common/extensions/api/file_browser_handler.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "content/public/browser/child_process_security_policy.h" | 22 #include "content/public/browser/child_process_security_policy.h" |
| 23 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
| 24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
| 25 #include "googleurl/src/gurl.h" | 25 #include "googleurl/src/gurl.h" |
| 26 #include "webkit/fileapi/file_system_context.h" | 26 #include "webkit/fileapi/file_system_context.h" |
| 27 #include "webkit/fileapi/file_system_mount_point_provider.h" | 27 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 28 | 28 |
| 29 using content::BrowserContext; | 29 using content::BrowserContext; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool FileSelectorImpl::DoSelectFile(const FilePath& suggested_name, | 101 bool FileSelectorImpl::DoSelectFile(const FilePath& suggested_name, |
| 102 Browser* browser) { | 102 Browser* browser) { |
| 103 DCHECK(!dialog_.get()); | 103 DCHECK(!dialog_.get()); |
| 104 DCHECK(browser); | 104 DCHECK(browser); |
| 105 | 105 |
| 106 if (!browser->window()) | 106 if (!browser->window()) |
| 107 return false; | 107 return false; |
| 108 | 108 |
| 109 TabContentsWrapper* tab_contents = browser->GetSelectedTabContentsWrapper(); | 109 TabContents* tab_contents = browser->GetActiveTabContents(); |
| 110 if (!tab_contents) | 110 if (!tab_contents) |
| 111 return false; | 111 return false; |
| 112 | 112 |
| 113 dialog_ = SelectFileDialog::Create(this); | 113 dialog_ = SelectFileDialog::Create(this); |
| 114 dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, | 114 dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, |
| 115 string16() /* dialog title*/, suggested_name, | 115 string16() /* dialog title*/, suggested_name, |
| 116 NULL /* allowed file types */, 0 /* file type index */, | 116 NULL /* allowed file types */, 0 /* file type index */, |
| 117 std::string() /* default file extension */, tab_contents->web_contents(), | 117 std::string() /* default file extension */, tab_contents->web_contents(), |
| 118 browser->window()->GetNativeHandle(), NULL /* params */); | 118 browser->window()->GetNativeHandle(), NULL /* params */); |
| 119 | 119 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 scoped_ptr<SelectFile::Result::Result> result( | 261 scoped_ptr<SelectFile::Result::Result> result( |
| 262 new SelectFile::Result::Result()); | 262 new SelectFile::Result::Result()); |
| 263 result->success = success; | 263 result->success = success; |
| 264 result->file_url = file_url.spec(); | 264 result->file_url = file_url.spec(); |
| 265 | 265 |
| 266 result_.reset(SelectFile::Result::Create(*result)); | 266 result_.reset(SelectFile::Result::Create(*result)); |
| 267 SendResponse(true); | 267 SendResponse(true); |
| 268 } | 268 } |
| 269 | 269 |
| OLD | NEW |