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 #import "content/browser/web_contents/web_drag_source_mac.h" | 5 #import "content/browser/web_contents/web_drag_source_mac.h" |
6 | 6 |
7 #include <sys/param.h> | 7 #include <sys/param.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 // This helper's sole task is to write out data for a promised file; the caller | 79 // This helper's sole task is to write out data for a promised file; the caller |
80 // is responsible for opening the file. It takes the drop data and an open file | 80 // is responsible for opening the file. It takes the drop data and an open file |
81 // stream. | 81 // stream. |
82 void PromiseWriterHelper(const WebDropData& drop_data, | 82 void PromiseWriterHelper(const WebDropData& drop_data, |
83 FileStream* file_stream) { | 83 FileStream* file_stream) { |
84 DCHECK(file_stream); | 84 DCHECK(file_stream); |
85 file_stream->WriteSync(drop_data.file_contents.data(), | 85 file_stream->WriteSync(drop_data.file_contents.data(), |
86 drop_data.file_contents.length()); | 86 drop_data.file_contents.length()); |
87 | |
88 if (file_stream) | |
89 file_stream->CloseSync(); | |
90 } | 87 } |
91 | 88 |
92 } // namespace | 89 } // namespace |
93 | 90 |
94 | 91 |
95 @interface WebDragSource(Private) | 92 @interface WebDragSource(Private) |
96 | 93 |
97 - (void)fillPasteboard; | 94 - (void)fillPasteboard; |
98 - (NSImage*)dragImage; | 95 - (NSImage*)dragImage; |
99 | 96 |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 - (NSImage*)dragImage { | 461 - (NSImage*)dragImage { |
465 if (dragImage_) | 462 if (dragImage_) |
466 return dragImage_; | 463 return dragImage_; |
467 | 464 |
468 // Default to returning a generic image. | 465 // Default to returning a generic image. |
469 return content::GetContentClient()->GetNativeImageNamed( | 466 return content::GetContentClient()->GetNativeImageNamed( |
470 IDR_DEFAULT_FAVICON).ToNSImage(); | 467 IDR_DEFAULT_FAVICON).ToNSImage(); |
471 } | 468 } |
472 | 469 |
473 @end // @implementation WebDragSource (Private) | 470 @end // @implementation WebDragSource (Private) |
OLD | NEW |