| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/arc/print/arc_print_service.h" | 5 #include "chrome/browser/chromeos/arc/print/arc_print_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shell_delegate.h" | 9 #include "ash/common/shell_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/optional.h" | 14 #include "base/optional.h" |
| 15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "components/arc/arc_bridge_service.h" | 16 #include "components/arc/arc_bridge_service.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "mojo/edk/embedder/embedder.h" | 18 #include "mojo/edk/embedder/embedder.h" |
| 19 #include "net/base/filename_util.h" | 19 #include "net/base/filename_util.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 return file_path; | 42 return file_path; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void OpenPdf(base::Optional<base::FilePath> file_path) { | 45 void OpenPdf(base::Optional<base::FilePath> file_path) { |
| 46 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 46 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 47 if (!file_path) | 47 if (!file_path) |
| 48 return; | 48 return; |
| 49 | 49 |
| 50 GURL gurl = net::FilePathToFileURL(file_path.value()); | 50 GURL gurl = net::FilePathToFileURL(file_path.value()); |
| 51 ash::WmShell::Get()->delegate()->OpenUrlFromArc(gurl); | 51 ash::Shell::Get()->shell_delegate()->OpenUrlFromArc(gurl); |
| 52 // TODO(poromov) Delete file after printing. (http://crbug.com/629843) | 52 // TODO(poromov) Delete file after printing. (http://crbug.com/629843) |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 namespace arc { | 57 namespace arc { |
| 58 | 58 |
| 59 ArcPrintService::ArcPrintService(ArcBridgeService* bridge_service) | 59 ArcPrintService::ArcPrintService(ArcBridgeService* bridge_service) |
| 60 : ArcService(bridge_service), binding_(this) { | 60 : ArcService(bridge_service), binding_(this) { |
| 61 arc_bridge_service()->print()->AddObserver(this); | 61 arc_bridge_service()->print()->AddObserver(this); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 base::File file(scoped_platform_handle.release().handle); | 89 base::File file(scoped_platform_handle.release().handle); |
| 90 | 90 |
| 91 content::BrowserThread::PostTaskAndReplyWithResult( | 91 content::BrowserThread::PostTaskAndReplyWithResult( |
| 92 content::BrowserThread::FILE, FROM_HERE, | 92 content::BrowserThread::FILE, FROM_HERE, |
| 93 base::Bind(&SavePdf, base::Passed(&file)), base::Bind(&OpenPdf)); | 93 base::Bind(&SavePdf, base::Passed(&file)), base::Bind(&OpenPdf)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace arc | 96 } // namespace arc |
| OLD | NEW |