| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/download/download_commands.h" | 5 #include "chrome/browser/download/download_commands.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 break; | 312 break; |
| 313 case COPY_TO_CLIPBOARD: | 313 case COPY_TO_CLIPBOARD: |
| 314 CopyFileAsImageToClipboard(); | 314 CopyFileAsImageToClipboard(); |
| 315 break; | 315 break; |
| 316 } | 316 } |
| 317 } | 317 } |
| 318 | 318 |
| 319 Browser* DownloadCommands::GetBrowser() const { | 319 Browser* DownloadCommands::GetBrowser() const { |
| 320 Profile* profile = | 320 Profile* profile = |
| 321 Profile::FromBrowserContext(download_item_->GetBrowserContext()); | 321 Profile::FromBrowserContext(download_item_->GetBrowserContext()); |
| 322 chrome::ScopedTabbedBrowserDisplayer browser_displayer( | 322 chrome::ScopedTabbedBrowserDisplayer browser_displayer(profile); |
| 323 profile, chrome::GetActiveDesktop()); | |
| 324 DCHECK(browser_displayer.browser()); | 323 DCHECK(browser_displayer.browser()); |
| 325 return browser_displayer.browser(); | 324 return browser_displayer.browser(); |
| 326 } | 325 } |
| 327 | 326 |
| 328 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 327 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
| 329 bool DownloadCommands::IsDownloadPdf() const { | 328 bool DownloadCommands::IsDownloadPdf() const { |
| 330 base::FilePath path = download_item_->GetTargetFilePath(); | 329 base::FilePath path = download_item_->GetTargetFilePath(); |
| 331 return path.MatchesExtension(FILE_PATH_LITERAL(".pdf")); | 330 return path.MatchesExtension(FILE_PATH_LITERAL(".pdf")); |
| 332 } | 331 } |
| 333 #endif | 332 #endif |
| (...skipping 30 matching lines...) Expand all Loading... |
| 364 &mime) || | 363 &mime) || |
| 365 !mime_util::IsSupportedImageMimeType(mime)) { | 364 !mime_util::IsSupportedImageMimeType(mime)) { |
| 366 // It seems a non-image file. | 365 // It seems a non-image file. |
| 367 return; | 366 return; |
| 368 } | 367 } |
| 369 } | 368 } |
| 370 | 369 |
| 371 base::FilePath file_path = download_item_->GetFullPath(); | 370 base::FilePath file_path = download_item_->GetFullPath(); |
| 372 ImageClipboardCopyManager::Start(file_path); | 371 ImageClipboardCopyManager::Start(file_path); |
| 373 } | 372 } |
| OLD | NEW |