Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: chrome/browser/download/download_commands.cc

Issue 1542413002: Switch to standard integer types in chrome/browser/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/macros.h"
11 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "build/build_config.h"
13 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/download/download_crx_util.h" 16 #include "chrome/browser/download/download_crx_util.h"
15 #include "chrome/browser/download/download_extensions.h" 17 #include "chrome/browser/download/download_extensions.h"
16 #include "chrome/browser/download/download_item_model.h" 18 #include "chrome/browser/download/download_item_model.h"
17 #include "chrome/browser/download/download_prefs.h" 19 #include "chrome/browser/download/download_prefs.h"
18 #include "chrome/browser/image_decoder.h" 20 #include "chrome/browser/image_decoder.h"
19 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/safe_browsing/download_protection_service.h" 22 #include "chrome/browser/safe_browsing/download_protection_service.h"
21 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 23 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
22 #include "chrome/browser/ui/browser_finder.h" 24 #include "chrome/browser/ui/browser_finder.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 FROM_HERE, 60 FROM_HERE,
59 base::Bind(&ImageClipboardCopyManager::StartDecoding, 61 base::Bind(&ImageClipboardCopyManager::StartDecoding,
60 base::Unretained(this))); 62 base::Unretained(this)));
61 } 63 }
62 64
63 void StartDecoding() { 65 void StartDecoding() {
64 DCHECK(content::BrowserThread::GetBlockingPool()-> 66 DCHECK(content::BrowserThread::GetBlockingPool()->
65 RunsTasksOnCurrentThread()); 67 RunsTasksOnCurrentThread());
66 68
67 // Re-check the filesize since the file may be modified after downloaded. 69 // Re-check the filesize since the file may be modified after downloaded.
68 int64 filesize; 70 int64_t filesize;
69 if (!GetFileSize(file_path_, &filesize) || 71 if (!GetFileSize(file_path_, &filesize) ||
70 filesize > kMaxImageClipboardSize) { 72 filesize > kMaxImageClipboardSize) {
71 OnFailedBeforeDecoding(); 73 OnFailedBeforeDecoding();
72 return; 74 return;
73 } 75 }
74 76
75 std::string data; 77 std::string data;
76 bool ret = base::ReadFileToString(file_path_, &data); 78 bool ret = base::ReadFileToString(file_path_, &data);
77 if (!ret || data.empty()) { 79 if (!ret || data.empty()) {
78 OnFailedBeforeDecoding(); 80 OnFailedBeforeDecoding();
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 &mime) || 364 &mime) ||
363 !mime_util::IsSupportedImageMimeType(mime)) { 365 !mime_util::IsSupportedImageMimeType(mime)) {
364 // It seems a non-image file. 366 // It seems a non-image file.
365 return; 367 return;
366 } 368 }
367 } 369 }
368 370
369 base::FilePath file_path = download_item_->GetFullPath(); 371 base::FilePath file_path = download_item_->GetFullPath();
370 ImageClipboardCopyManager::Start(file_path); 372 ImageClipboardCopyManager::Start(file_path);
371 } 373 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_commands.h ('k') | chrome/browser/download/download_completion_blocker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698