OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
11 #include "chrome/browser/importer/external_process_importer_bridge.h" | 11 #include "chrome/browser/importer/external_process_importer_bridge.h" |
12 #include "chrome/browser/importer/importer.h" | 12 #include "chrome/browser/importer/importer.h" |
13 #include "chrome/browser/importer/profile_import_process_messages.h" | 13 #include "chrome/browser/importer/profile_import_process_messages.h" |
14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/common/chrome_utility_messages.h" | 15 #include "chrome/common/chrome_utility_messages.h" |
| 16 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/extension_l10n_util.h" | 17 #include "chrome/common/extensions/extension_l10n_util.h" |
17 #include "chrome/common/extensions/extension_unpacker.h" | 18 #include "chrome/common/extensions/extension_unpacker.h" |
18 #include "chrome/common/extensions/update_manifest.h" | 19 #include "chrome/common/extensions/update_manifest.h" |
19 #include "chrome/common/web_resource/web_resource_unpacker.h" | 20 #include "chrome/common/web_resource/web_resource_unpacker.h" |
20 #include "content/public/utility/utility_thread.h" | 21 #include "content/public/utility/utility_thread.h" |
21 #include "printing/backend/print_backend.h" | 22 #include "printing/backend/print_backend.h" |
22 #include "printing/page_range.h" | 23 #include "printing/page_range.h" |
23 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
24 #include "ui/base/ui_base_switches.h" | 25 #include "ui/base/ui_base_switches.h" |
25 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 IPC_MESSAGE_UNHANDLED(handled = false) | 87 IPC_MESSAGE_UNHANDLED(handled = false) |
87 IPC_END_MESSAGE_MAP() | 88 IPC_END_MESSAGE_MAP() |
88 return handled; | 89 return handled; |
89 } | 90 } |
90 | 91 |
91 bool ChromeContentUtilityClient::Send(IPC::Message* message) { | 92 bool ChromeContentUtilityClient::Send(IPC::Message* message) { |
92 return content::UtilityThread::Get()->Send(message); | 93 return content::UtilityThread::Get()->Send(message); |
93 } | 94 } |
94 | 95 |
95 void ChromeContentUtilityClient::OnUnpackExtension( | 96 void ChromeContentUtilityClient::OnUnpackExtension( |
96 const FilePath& extension_path) { | 97 const FilePath& extension_path, int location, int creation_flags) { |
97 ExtensionUnpacker unpacker(extension_path); | 98 CHECK(location > Extension::INVALID); |
| 99 CHECK(location < Extension::NUM_LOCATIONS); |
| 100 ExtensionUnpacker unpacker( |
| 101 extension_path, |
| 102 static_cast<Extension::Location>(location), |
| 103 creation_flags); |
98 if (unpacker.Run() && unpacker.DumpImagesToFile() && | 104 if (unpacker.Run() && unpacker.DumpImagesToFile() && |
99 unpacker.DumpMessageCatalogsToFile()) { | 105 unpacker.DumpMessageCatalogsToFile()) { |
100 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( | 106 Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded( |
101 *unpacker.parsed_manifest())); | 107 *unpacker.parsed_manifest())); |
102 } else { | 108 } else { |
103 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( | 109 Send(new ChromeUtilityHostMsg_UnpackExtension_Failed( |
104 unpacker.error_message())); | 110 unpacker.error_message())); |
105 } | 111 } |
106 | 112 |
107 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 113 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 | 415 |
410 void ChromeContentUtilityClient::ImporterCleanup() { | 416 void ChromeContentUtilityClient::ImporterCleanup() { |
411 importer_->Cancel(); | 417 importer_->Cancel(); |
412 importer_ = NULL; | 418 importer_ = NULL; |
413 bridge_ = NULL; | 419 bridge_ = NULL; |
414 import_thread_.reset(); | 420 import_thread_.reset(); |
415 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 421 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
416 } | 422 } |
417 | 423 |
418 } // namespace chrome | 424 } // namespace chrome |
OLD | NEW |