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

Side by Side Diff: chrome/browser/extensions/api/image_writer_private/image_writer_utility_client.cc

Issue 1923653002: Wire up process launch error codes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix debug and clang Created 4 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/strings/stringprintf.h"
7 #include "base/thread_task_runner_handle.h" 8 #include "base/thread_task_runner_handle.h"
8 #include "build/build_config.h" 9 #include "build/build_config.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/api/image_writer_private/image_writer_utilit y_client.h" 11 #include "chrome/browser/extensions/api/image_writer_private/image_writer_utilit y_client.h"
11 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" 12 #include "chrome/common/extensions/chrome_utility_extensions_messages.h"
12 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
13 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
14 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
15 16
16 using content::BrowserThread; 17 using content::BrowserThread;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 utility_process_host_->ElevatePrivileges(); 103 utility_process_host_->ElevatePrivileges();
103 #else 104 #else
104 utility_process_host_->DisableSandbox(); 105 utility_process_host_->DisableSandbox();
105 #endif 106 #endif
106 utility_process_host_->StartBatchMode(); 107 utility_process_host_->StartBatchMode();
107 } 108 }
108 } 109 }
109 110
110 void ImageWriterUtilityClient::OnProcessCrashed(int exit_code) { 111 void ImageWriterUtilityClient::OnProcessCrashed(int exit_code) {
111 task_runner_->PostTask( 112 task_runner_->PostTask(
112 FROM_HERE, base::Bind(error_callback_, "Utility process crashed.")); 113 FROM_HERE,
114 base::Bind(error_callback_,
115 base::StringPrintf("Utility process crashed with code %08x.",
116 exit_code)));
113 } 117 }
114 118
115 void ImageWriterUtilityClient::OnProcessLaunchFailed() { 119 void ImageWriterUtilityClient::OnProcessLaunchFailed(int error_code) {
116 task_runner_->PostTask( 120 task_runner_->PostTask(
117 FROM_HERE, base::Bind(error_callback_, "Process launch failed.")); 121 FROM_HERE,
122 base::Bind(error_callback_,
123 base::StringPrintf("Process launch failed with code %08x.",
124 error_code)));
118 } 125 }
119 126
120 bool ImageWriterUtilityClient::OnMessageReceived(const IPC::Message& message) { 127 bool ImageWriterUtilityClient::OnMessageReceived(const IPC::Message& message) {
121 bool handled = true; 128 bool handled = true;
122 IPC_BEGIN_MESSAGE_MAP(ImageWriterUtilityClient, message) 129 IPC_BEGIN_MESSAGE_MAP(ImageWriterUtilityClient, message)
123 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ImageWriter_Succeeded, 130 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ImageWriter_Succeeded,
124 OnWriteImageSucceeded) 131 OnWriteImageSucceeded)
125 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ImageWriter_Cancelled, 132 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ImageWriter_Cancelled,
126 OnWriteImageCancelled) 133 OnWriteImageCancelled)
127 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ImageWriter_Failed, 134 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ImageWriter_Failed,
(...skipping 25 matching lines...) Expand all
153 if (!error_callback_.is_null()) { 160 if (!error_callback_.is_null()) {
154 task_runner_->PostTask(FROM_HERE, base::Bind(error_callback_, message)); 161 task_runner_->PostTask(FROM_HERE, base::Bind(error_callback_, message));
155 } 162 }
156 } 163 }
157 164
158 void ImageWriterUtilityClient::OnWriteImageProgress(int64_t progress) { 165 void ImageWriterUtilityClient::OnWriteImageProgress(int64_t progress) {
159 if (!progress_callback_.is_null()) { 166 if (!progress_callback_.is_null()) {
160 task_runner_->PostTask(FROM_HERE, base::Bind(progress_callback_, progress)); 167 task_runner_->PostTask(FROM_HERE, base::Bind(progress_callback_, progress));
161 } 168 }
162 } 169 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698