OLD | NEW |
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 "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" | 5 #include "chrome/browser/component_updater/component_patcher_operation_out_of_pr
ocess.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "chrome/common/chrome_utility_messages.h" | 12 #include "chrome/common/chrome_utility_messages.h" |
| 13 #include "chrome/grit/generated_resources.h" |
13 #include "components/component_updater/component_updater_service.h" | 14 #include "components/component_updater/component_updater_service.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/utility_process_host.h" | 16 #include "content/public/browser/utility_process_host.h" |
16 #include "content/public/browser/utility_process_host_client.h" | 17 #include "content/public/browser/utility_process_host_client.h" |
17 #include "courgette/courgette.h" | 18 #include "courgette/courgette.h" |
18 #include "courgette/third_party/bsdiff.h" | 19 #include "courgette/third_party/bsdiff.h" |
19 #include "ipc/ipc_message_macros.h" | 20 #include "ipc/ipc_message_macros.h" |
| 21 #include "ui/base/l10n/l10n_util.h" |
20 | 22 |
21 namespace component_updater { | 23 namespace component_updater { |
22 | 24 |
23 class PatchHost : public content::UtilityProcessHostClient { | 25 class PatchHost : public content::UtilityProcessHostClient { |
24 public: | 26 public: |
25 PatchHost(base::Callback<void(int result)> callback, | 27 PatchHost(base::Callback<void(int result)> callback, |
26 scoped_refptr<base::SequencedTaskRunner> task_runner); | 28 scoped_refptr<base::SequencedTaskRunner> task_runner); |
27 | 29 |
28 void StartProcess(scoped_ptr<IPC::Message> message); | 30 void StartProcess(scoped_ptr<IPC::Message> message); |
29 | 31 |
(...skipping 17 matching lines...) Expand all Loading... |
47 } | 49 } |
48 | 50 |
49 PatchHost::~PatchHost() { | 51 PatchHost::~PatchHost() { |
50 } | 52 } |
51 | 53 |
52 void PatchHost::StartProcess(scoped_ptr<IPC::Message> message) { | 54 void PatchHost::StartProcess(scoped_ptr<IPC::Message> message) { |
53 // The DeltaUpdateOpPatchHost is not responsible for deleting the | 55 // The DeltaUpdateOpPatchHost is not responsible for deleting the |
54 // UtilityProcessHost object. | 56 // UtilityProcessHost object. |
55 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( | 57 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( |
56 this, base::MessageLoopProxy::current().get()); | 58 this, base::MessageLoopProxy::current().get()); |
| 59 host->SetName(l10n_util::GetStringUTF16( |
| 60 IDS_UTILITY_PROCESS_COMPONENT_PATCHER_NAME)); |
57 host->DisableSandbox(); | 61 host->DisableSandbox(); |
58 host->Send(message.release()); | 62 host->Send(message.release()); |
59 } | 63 } |
60 | 64 |
61 bool PatchHost::OnMessageReceived(const IPC::Message& message) { | 65 bool PatchHost::OnMessageReceived(const IPC::Message& message) { |
62 bool handled = true; | 66 bool handled = true; |
63 IPC_BEGIN_MESSAGE_MAP(PatchHost, message) | 67 IPC_BEGIN_MESSAGE_MAP(PatchHost, message) |
64 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PatchFile_Finished, OnPatchFinished) | 68 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_PatchFile_Finished, OnPatchFinished) |
65 IPC_MESSAGE_UNHANDLED(handled = false) | 69 IPC_MESSAGE_UNHANDLED(handled = false) |
66 IPC_END_MESSAGE_MAP() | 70 IPC_END_MESSAGE_MAP() |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 111 } |
108 | 112 |
109 content::BrowserThread::PostTask( | 113 content::BrowserThread::PostTask( |
110 content::BrowserThread::IO, | 114 content::BrowserThread::IO, |
111 FROM_HERE, | 115 FROM_HERE, |
112 base::Bind( | 116 base::Bind( |
113 &PatchHost::StartProcess, host_, base::Passed(&patch_message))); | 117 &PatchHost::StartProcess, host_, base::Passed(&patch_message))); |
114 } | 118 } |
115 | 119 |
116 } // namespace component_updater | 120 } // namespace component_updater |
OLD | NEW |