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/ui/views/select_file_dialog_extension.h" | 5 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "chrome/browser/chromeos/extensions/file_browser_private_api.h" | 13 #include "chrome/browser/chromeos/extensions/file_browser_private_api.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/extensions/extension_host.h" | 15 #include "chrome/browser/extensions/extension_host.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/sessions/restore_tab_helper.h" | 17 #include "chrome/browser/sessions/restore_tab_helper.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/browser_finder.h" |
19 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
20 #include "chrome/browser/ui/browser_window.h" | 21 #include "chrome/browser/ui/browser_window.h" |
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
22 #include "chrome/browser/ui/views/extensions/extension_dialog.h" | 23 #include "chrome/browser/ui/views/extensions/extension_dialog.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/common/selected_file_info.h" | 25 #include "content/public/common/selected_file_info.h" |
25 | 26 |
26 using content::BrowserThread; | 27 using content::BrowserThread; |
27 | 28 |
28 namespace { | 29 namespace { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 int file_type_index, | 241 int file_type_index, |
241 const FilePath::StringType& default_extension, | 242 const FilePath::StringType& default_extension, |
242 gfx::NativeWindow owner_window, | 243 gfx::NativeWindow owner_window, |
243 void* params) { | 244 void* params) { |
244 if (owner_window_) { | 245 if (owner_window_) { |
245 LOG(ERROR) << "File dialog already in use!"; | 246 LOG(ERROR) << "File dialog already in use!"; |
246 return; | 247 return; |
247 } | 248 } |
248 // Extension background pages may not supply an owner_window. | 249 // Extension background pages may not supply an owner_window. |
249 owner_browser_ = (owner_window ? | 250 owner_browser_ = (owner_window ? |
250 BrowserList::FindBrowserWithWindow(owner_window) : | 251 browser::FindBrowserWithWindow(owner_window) : |
251 BrowserList::GetLastActive()); | 252 BrowserList::GetLastActive()); |
252 if (!owner_browser_) { | 253 if (!owner_browser_) { |
253 NOTREACHED() << "Can't find owning browser"; | 254 NOTREACHED() << "Can't find owning browser"; |
254 return; | 255 return; |
255 } | 256 } |
256 | 257 |
257 TabContentsWrapper* tab = owner_browser_->GetSelectedTabContentsWrapper(); | 258 TabContentsWrapper* tab = owner_browser_->GetSelectedTabContentsWrapper(); |
258 | 259 |
259 // Check if we have another dialog opened in the tab. It's unlikely, but | 260 // Check if we have another dialog opened in the tab. It's unlikely, but |
260 // possible. | 261 // possible. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 294 } |
294 | 295 |
295 // Connect our listener to FileDialogFunction's per-tab callbacks. | 296 // Connect our listener to FileDialogFunction's per-tab callbacks. |
296 AddPending(tab_id); | 297 AddPending(tab_id); |
297 | 298 |
298 extension_dialog_ = dialog; | 299 extension_dialog_ = dialog; |
299 params_ = params; | 300 params_ = params; |
300 tab_id_ = tab_id; | 301 tab_id_ = tab_id; |
301 owner_window_ = owner_window; | 302 owner_window_ = owner_window; |
302 } | 303 } |
OLD | NEW |