| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions/extensions_startup.h" | 5 #include "chrome/browser/extensions/extensions_startup.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extensions_service.h" | 10 #include "chrome/browser/extensions/extensions_service.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 FilePath src_dir = cmd_line.GetSwitchValuePath( | 76 FilePath src_dir = cmd_line.GetSwitchValuePath( |
| 77 switches::kPackExtension); | 77 switches::kPackExtension); |
| 78 FilePath private_key_path; | 78 FilePath private_key_path; |
| 79 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) { | 79 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) { |
| 80 private_key_path = cmd_line.GetSwitchValuePath( | 80 private_key_path = cmd_line.GetSwitchValuePath( |
| 81 switches::kPackExtensionKey); | 81 switches::kPackExtensionKey); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // Launch a job to perform the packing on the file thread. | 84 // Launch a job to perform the packing on the file thread. |
| 85 PackExtensionLogger pack_client; | 85 PackExtensionLogger pack_client; |
| 86 scoped_refptr<PackExtensionJob> pack_job = | 86 scoped_refptr<PackExtensionJob> pack_job( |
| 87 new PackExtensionJob(&pack_client, src_dir, private_key_path); | 87 new PackExtensionJob(&pack_client, src_dir, private_key_path)); |
| 88 pack_job->Start(); | 88 pack_job->Start(); |
| 89 | 89 |
| 90 // The job will post a notification task to the current thread's message | 90 // The job will post a notification task to the current thread's message |
| 91 // loop when it is finished. We manually run the loop here so that we | 91 // loop when it is finished. We manually run the loop here so that we |
| 92 // block and catch the notification. Otherwise, the process would exit; | 92 // block and catch the notification. Otherwise, the process would exit; |
| 93 // in particular, this would mean that |pack_client| would be destroyed | 93 // in particular, this would mean that |pack_client| would be destroyed |
| 94 // and we wouldn't be able to report success or failure back to the user. | 94 // and we wouldn't be able to report success or failure back to the user. |
| 95 // This call to |Run()| is matched by a call to |Quit()| in the | 95 // This call to |Run()| is matched by a call to |Quit()| in the |
| 96 // |PackExtensionLogger|'s notification handling code. | 96 // |PackExtensionLogger|'s notification handling code. |
| 97 MessageLoop::current()->Run(); | 97 MessageLoop::current()->Run(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 114 extension_id)) { | 114 extension_id)) { |
| 115 return true; | 115 return true; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 return false; | 120 return false; |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace extensions_startup | 123 } // namespace extensions_startup |
| OLD | NEW |