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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/zip_file_creator.cc

Issue 18308004: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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
OLDNEW
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 #include "chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util_proxy.h" 9 #include "base/files/file_util_proxy.h"
10 #include "base/memory/scoped_handle.h" 10 #include "base/memory/scoped_handle.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 BrowserThread::IO, FROM_HERE, 89 BrowserThread::IO, FROM_HERE,
90 base::Bind(&ZipFileCreator::StartProcessOnIOThread, this, dest_file)); 90 base::Bind(&ZipFileCreator::StartProcessOnIOThread, this, dest_file));
91 } 91 }
92 92
93 void ZipFileCreator::StartProcessOnIOThread(base::PlatformFile dest_file) { 93 void ZipFileCreator::StartProcessOnIOThread(base::PlatformFile dest_file) {
94 base::FileDescriptor dest_fd; 94 base::FileDescriptor dest_fd;
95 dest_fd.fd = dest_file; 95 dest_fd.fd = dest_file;
96 dest_fd.auto_close = true; 96 dest_fd.auto_close = true;
97 97
98 UtilityProcessHost* host = UtilityProcessHost::Create( 98 UtilityProcessHost* host = UtilityProcessHost::Create(
99 this, BrowserThread::GetMessageLoopProxyForThread(thread_identifier_)); 99 this,
100 BrowserThread::GetMessageLoopProxyForThread(thread_identifier_).get());
100 host->Send(new ChromeUtilityMsg_CreateZipFile(src_dir_, src_relative_paths_, 101 host->Send(new ChromeUtilityMsg_CreateZipFile(src_dir_, src_relative_paths_,
101 dest_fd)); 102 dest_fd));
102 } 103 }
103 104
104 void ZipFileCreator::OnCreateZipFileSucceeded() { 105 void ZipFileCreator::OnCreateZipFileSucceeded() {
105 ReportDone(true); 106 ReportDone(true);
106 } 107 }
107 108
108 void ZipFileCreator::OnCreateZipFileFailed() { 109 void ZipFileCreator::OnCreateZipFileFailed() {
109 ReportDone(false); 110 ReportDone(false);
110 } 111 }
111 112
112 void ZipFileCreator::ReportDone(bool success) { 113 void ZipFileCreator::ReportDone(bool success) {
113 // Skip check for unittests. 114 // Skip check for unittests.
114 if (thread_identifier_ != BrowserThread::ID_COUNT) 115 if (thread_identifier_ != BrowserThread::ID_COUNT)
115 DCHECK(BrowserThread::CurrentlyOn(thread_identifier_)); 116 DCHECK(BrowserThread::CurrentlyOn(thread_identifier_));
116 117
117 // Guard against calling observer multiple times. 118 // Guard against calling observer multiple times.
118 if (got_response_) 119 if (got_response_)
119 return; 120 return;
120 121
121 got_response_ = true; 122 got_response_ = true;
122 observer_->OnZipDone(success); 123 observer_->OnZipDone(success);
123 } 124 }
124 125
125 } // namespace extensions 126 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698