| 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/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/process/kill.h" | 10 #include "base/process/kill.h" |
| 11 #include "base/process/launch.h" | 11 #include "base/process/launch.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/task_scheduler/post_task.h" |
| 15 #include "base/version.h" | 15 #include "base/version.h" |
| 16 #include "chrome/browser/platform_util_internal.h" | 16 #include "chrome/browser/platform_util_internal.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 | 21 |
| 22 namespace platform_util { | 22 namespace platform_util { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 case SHOW_ITEM_IN_FOLDER: | 153 case SHOW_ITEM_IN_FOLDER: |
| 154 ShowFileInNautilus(path.DirName(), path.value()); | 154 ShowFileInNautilus(path.DirName(), path.value()); |
| 155 break; | 155 break; |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace internal | 159 } // namespace internal |
| 160 | 160 |
| 161 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { | 161 void ShowItemInFolder(Profile* profile, const base::FilePath& full_path) { |
| 162 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 162 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 163 base::PostTaskAndReplyWithResult(content::BrowserThread::GetBlockingPool(), | 163 base::PostTaskWithTraitsAndReplyWithResult( |
| 164 FROM_HERE, | 164 FROM_HERE, |
| 165 base::Bind(&CheckNautilusIsDefault), | 165 {base::WithBaseSyncPrimitives(), base::MayBlock(), |
| 166 base::Bind(&ShowItem, profile, full_path)); | 166 base::TaskPriority::USER_BLOCKING}, |
| 167 base::BindOnce(&CheckNautilusIsDefault), |
| 168 base::BindOnce(&ShowItem, profile, full_path)); |
| 167 } | 169 } |
| 168 | 170 |
| 169 void OpenExternal(Profile* profile, const GURL& url) { | 171 void OpenExternal(Profile* profile, const GURL& url) { |
| 170 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 172 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 171 if (url.SchemeIs("mailto")) | 173 if (url.SchemeIs("mailto")) |
| 172 XDGEmail(url.spec()); | 174 XDGEmail(url.spec()); |
| 173 else | 175 else |
| 174 XDGOpen(base::FilePath(), url.spec()); | 176 XDGOpen(base::FilePath(), url.spec()); |
| 175 } | 177 } |
| 176 | 178 |
| 177 } // namespace platform_util | 179 } // namespace platform_util |
| OLD | NEW |