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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 // This helper's sole task is to write out data for a promised file; the caller | 81 // This helper's sole task is to write out data for a promised file; the caller |
82 // is responsible for opening the file. It takes the drop data and an open file | 82 // is responsible for opening the file. It takes the drop data and an open file |
83 // stream. | 83 // stream. |
84 void PromiseWriterHelper(const WebDropData& drop_data, | 84 void PromiseWriterHelper(const WebDropData& drop_data, |
85 scoped_ptr<FileStream> file_stream) { | 85 scoped_ptr<FileStream> file_stream) { |
86 DCHECK(file_stream); | 86 DCHECK(file_stream); |
87 file_stream->WriteSync(drop_data.file_contents.data(), | 87 file_stream->WriteSync(drop_data.file_contents.data(), |
88 drop_data.file_contents.length()); | 88 drop_data.file_contents.length()); |
89 | |
90 if (file_stream) | |
91 file_stream->CloseSync(); | |
92 } | 89 } |
93 | 90 |
94 } // namespace | 91 } // namespace |
95 | 92 |
96 | 93 |
97 @interface WebDragSource(Private) | 94 @interface WebDragSource(Private) |
98 | 95 |
99 - (void)fillPasteboard; | 96 - (void)fillPasteboard; |
100 - (NSImage*)dragImage; | 97 - (NSImage*)dragImage; |
101 | 98 |
(...skipping 362 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 |