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

Side by Side Diff: chrome/browser/local_discovery/pwg_raster_converter.cc

Issue 330083004: For PWG raster file creation, use FLAG_WRITE instead of FLAG_APPEND (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/local_discovery/pwg_raster_converter.h" 5 #include "chrome/browser/local_discovery/pwg_raster_converter.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/cancelable_callback.h" 8 #include "base/cancelable_callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 70
71 if (static_cast<int>(data->size()) != 71 if (static_cast<int>(data->size()) !=
72 base::WriteFile(GetPdfPath(), data->front_as<char>(), data->size())) { 72 base::WriteFile(GetPdfPath(), data->front_as<char>(), data->size())) {
73 return; 73 return;
74 } 74 }
75 75
76 // Reopen in read only mode. 76 // Reopen in read only mode.
77 pdf_file_.Initialize(GetPdfPath(), 77 pdf_file_.Initialize(GetPdfPath(),
78 base::File::FLAG_OPEN | base::File::FLAG_READ); 78 base::File::FLAG_OPEN | base::File::FLAG_READ);
79 pwg_file_.Initialize( 79 pwg_file_.Initialize(GetPwgPath(),
80 GetPwgPath(), 80 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
81 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_APPEND);
82 } 81 }
83 82
84 bool FileHandlers::IsValid() { 83 bool FileHandlers::IsValid() {
85 return pdf_file_.IsValid() && pwg_file_.IsValid(); 84 return pdf_file_.IsValid() && pwg_file_.IsValid();
86 } 85 }
87 86
88 // Converts PDF into PWG raster. 87 // Converts PDF into PWG raster.
89 // Class uses 3 threads: UI, IO and FILE. 88 // Class uses 3 threads: UI, IO and FILE.
90 // Internal workflow is following: 89 // Internal workflow is following:
91 // 1. Create instance on the UI thread. (files_, settings_,) 90 // 1. Create instance on the UI thread. (files_, settings_,)
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 276 }
278 277
279 } // namespace 278 } // namespace
280 279
281 // static 280 // static
282 scoped_ptr<PWGRasterConverter> PWGRasterConverter::CreateDefault() { 281 scoped_ptr<PWGRasterConverter> PWGRasterConverter::CreateDefault() {
283 return scoped_ptr<PWGRasterConverter>(new PWGRasterConverterImpl()); 282 return scoped_ptr<PWGRasterConverter>(new PWGRasterConverterImpl());
284 } 283 }
285 284
286 } // namespace local_discovery 285 } // namespace local_discovery
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698