| 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/location.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/app_mode/app_mode_utils.h" | 15 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 14 #include "chrome/browser/apps/app_window_registry_util.h" | 16 #include "chrome/browser/apps/app_window_registry_util.h" |
| 15 #include "chrome/browser/chromeos/file_manager/app_id.h" | 17 #include "chrome/browser/chromeos/file_manager/app_id.h" |
| 16 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" | 18 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 17 #include "chrome/browser/chromeos/file_manager/select_file_dialog_util.h" | 19 #include "chrome/browser/chromeos/file_manager/select_file_dialog_util.h" |
| 18 #include "chrome/browser/chromeos/file_manager/url_util.h" | 20 #include "chrome/browser/chromeos/file_manager/url_util.h" |
| 19 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" | 21 #include "chrome/browser/chromeos/login/ui/login_web_dialog.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/extensions/extension_view_host.h" | 23 #include "chrome/browser/extensions/extension_view_host.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // yet. We don't want to try to reload the extension only to have the Unload | 212 // yet. We don't want to try to reload the extension only to have the Unload |
| 211 // code execute after us and re-unload the extension. | 213 // code execute after us and re-unload the extension. |
| 212 // | 214 // |
| 213 // TODO(rkc): This is ugly. The ideal solution is that we shouldn't need to | 215 // TODO(rkc): This is ugly. The ideal solution is that we shouldn't need to |
| 214 // reload the extension at all - when we try to open the extension the next | 216 // reload the extension at all - when we try to open the extension the next |
| 215 // time, the extension subsystem would automatically reload it for us. At | 217 // time, the extension subsystem would automatically reload it for us. At |
| 216 // this time though this is broken because of some faulty wiring in | 218 // this time though this is broken because of some faulty wiring in |
| 217 // extensions::ProcessManager::CreateViewHost. Once that is fixed, remove | 219 // extensions::ProcessManager::CreateViewHost. Once that is fixed, remove |
| 218 // this. | 220 // this. |
| 219 if (profile_) { | 221 if (profile_) { |
| 220 base::MessageLoop::current()->PostTask( | 222 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 221 FROM_HERE, | 223 FROM_HERE, |
| 222 base::Bind(&ExtensionService::ReloadExtension, | 224 base::Bind(&ExtensionService::ReloadExtension, |
| 223 base::Unretained(extensions::ExtensionSystem::Get(profile_) | 225 base::Unretained(extensions::ExtensionSystem::Get(profile_) |
| 224 ->extension_service()), | 226 ->extension_service()), |
| 225 extension_id)); | 227 extension_id)); |
| 226 } | 228 } |
| 227 | 229 |
| 228 dialog->GetWidget()->Close(); | 230 dialog->GetWidget()->Close(); |
| 229 } | 231 } |
| 230 | 232 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 } | 420 } |
| 419 | 421 |
| 420 // Connect our listener to FileDialogFunction's per-tab callbacks. | 422 // Connect our listener to FileDialogFunction's per-tab callbacks. |
| 421 AddPending(routing_id); | 423 AddPending(routing_id); |
| 422 | 424 |
| 423 extension_dialog_ = dialog; | 425 extension_dialog_ = dialog; |
| 424 params_ = params; | 426 params_ = params; |
| 425 routing_id_ = routing_id; | 427 routing_id_ = routing_id; |
| 426 owner_window_ = owner_window; | 428 owner_window_ = owner_window; |
| 427 } | 429 } |
| OLD | NEW |