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_tabstrip.h" |
17 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" |
18 #include "chrome/browser/ui/select_file_dialog.h" | 19 #include "chrome/browser/ui/select_file_dialog.h" |
19 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
20 #include "chrome/common/extensions/api/file_browser_handler_internal.h" | 21 #include "chrome/common/extensions/api/file_browser_handler_internal.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "content/public/browser/child_process_security_policy.h" | 23 #include "content/public/browser/child_process_security_policy.h" |
23 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
24 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
25 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
26 #include "webkit/fileapi/file_system_context.h" | 27 #include "webkit/fileapi/file_system_context.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 113 } |
113 | 114 |
114 bool FileSelectorImpl::DoSelectFile(const FilePath& suggested_name, | 115 bool FileSelectorImpl::DoSelectFile(const FilePath& suggested_name, |
115 Browser* browser) { | 116 Browser* browser) { |
116 DCHECK(!dialog_.get()); | 117 DCHECK(!dialog_.get()); |
117 DCHECK(browser); | 118 DCHECK(browser); |
118 | 119 |
119 if (!browser->window()) | 120 if (!browser->window()) |
120 return false; | 121 return false; |
121 | 122 |
122 TabContents* tab_contents = browser->GetActiveTabContents(); | 123 TabContents* tab_contents = chrome::GetActiveTabContents(browser); |
123 if (!tab_contents) | 124 if (!tab_contents) |
124 return false; | 125 return false; |
125 | 126 |
126 dialog_ = SelectFileDialog::Create(this); | 127 dialog_ = SelectFileDialog::Create(this); |
127 dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, | 128 dialog_->SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE, |
128 string16() /* dialog title*/, suggested_name, | 129 string16() /* dialog title*/, suggested_name, |
129 NULL /* allowed file types */, 0 /* file type index */, | 130 NULL /* allowed file types */, 0 /* file type index */, |
130 std::string() /* default file extension */, tab_contents->web_contents(), | 131 std::string() /* default file extension */, tab_contents->web_contents(), |
131 browser->window()->GetNativeWindow(), NULL /* params */); | 132 browser->window()->GetNativeWindow(), NULL /* params */); |
132 | 133 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 result->set_function_for_test(this); | 316 result->set_function_for_test(this); |
316 return result; | 317 return result; |
317 } | 318 } |
318 return new FileSelectorImpl(this); | 319 return new FileSelectorImpl(this); |
319 } | 320 } |
320 | 321 |
321 FileSelector* FileHandlerSelectFileFunction::file_selector_for_test_ = NULL; | 322 FileSelector* FileHandlerSelectFileFunction::file_selector_for_test_ = NULL; |
322 | 323 |
323 bool FileHandlerSelectFileFunction::gesture_check_disabled_for_test_ = false; | 324 bool FileHandlerSelectFileFunction::gesture_check_disabled_for_test_ = false; |
324 | 325 |
OLD | NEW |