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

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_handler.cc

Issue 15984016: Call scoped_refptr<T>::get() rather than relying on implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 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
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/ui/webui/options/certificate_manager_handler.h" 5 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 CancelableTaskTracker::TaskId FileAccessProvider::StartRead( 252 CancelableTaskTracker::TaskId FileAccessProvider::StartRead(
253 const base::FilePath& path, 253 const base::FilePath& path,
254 const ReadCallback& callback, 254 const ReadCallback& callback,
255 CancelableTaskTracker* tracker) { 255 CancelableTaskTracker* tracker) {
256 // Owned by reply callback posted below. 256 // Owned by reply callback posted below.
257 int* saved_errno = new int(0); 257 int* saved_errno = new int(0);
258 std::string* data = new std::string(); 258 std::string* data = new std::string();
259 259
260 // Post task to file thread to read file. 260 // Post task to file thread to read file.
261 return tracker->PostTaskAndReply( 261 return tracker->PostTaskAndReply(
262 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 262 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
263 FROM_HERE, 263 FROM_HERE,
264 base::Bind(&FileAccessProvider::DoRead, this, path, saved_errno, data), 264 base::Bind(&FileAccessProvider::DoRead, this, path, saved_errno, data),
265 base::Bind(callback, base::Owned(saved_errno), base::Owned(data))); 265 base::Bind(callback, base::Owned(saved_errno), base::Owned(data)));
266 } 266 }
267 267
268 CancelableTaskTracker::TaskId FileAccessProvider::StartWrite( 268 CancelableTaskTracker::TaskId FileAccessProvider::StartWrite(
269 const base::FilePath& path, 269 const base::FilePath& path,
270 const std::string& data, 270 const std::string& data,
271 const WriteCallback& callback, 271 const WriteCallback& callback,
272 CancelableTaskTracker* tracker) { 272 CancelableTaskTracker* tracker) {
273 // Owned by reply callback posted below. 273 // Owned by reply callback posted below.
274 int* saved_errno = new int(0); 274 int* saved_errno = new int(0);
275 int* bytes_written = new int(0); 275 int* bytes_written = new int(0);
276 276
277 // Post task to file thread to write file. 277 // Post task to file thread to write file.
278 return tracker->PostTaskAndReply( 278 return tracker->PostTaskAndReply(
279 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), 279 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(),
280 FROM_HERE, 280 FROM_HERE,
281 base::Bind(&FileAccessProvider::DoWrite, this, 281 base::Bind(&FileAccessProvider::DoWrite,
282 path, data, saved_errno, bytes_written), 282 this,
283 base::Bind(callback, 283 path,
284 base::Owned(saved_errno), base::Owned(bytes_written))); 284 data,
285 saved_errno,
286 bytes_written),
287 base::Bind(
288 callback, base::Owned(saved_errno), base::Owned(bytes_written)));
285 } 289 }
286 290
287 void FileAccessProvider::DoRead(const base::FilePath& path, 291 void FileAccessProvider::DoRead(const base::FilePath& path,
288 int* saved_errno, 292 int* saved_errno,
289 std::string* data) { 293 std::string* data) {
290 bool success = file_util::ReadFileToString(path, data); 294 bool success = file_util::ReadFileToString(path, data);
291 *saved_errno = success ? 0 : errno; 295 *saved_errno = success ? 0 : errno;
292 } 296 }
293 297
294 void FileAccessProvider::DoWrite(const base::FilePath& path, 298 void FileAccessProvider::DoWrite(const base::FilePath& path,
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", 1146 web_ui()->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady",
1143 ready); 1147 ready);
1144 } 1148 }
1145 #endif 1149 #endif
1146 1150
1147 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { 1151 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const {
1148 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow(); 1152 return web_ui()->GetWebContents()->GetView()->GetTopLevelNativeWindow();
1149 } 1153 }
1150 1154
1151 } // namespace options 1155 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/net_internals/net_internals_ui.cc ('k') | chrome/browser/ui/webui/options/content_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698