OLD | NEW |
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/extensions/startup_helper.h" | 5 #include "chrome/browser/extensions/startup_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
17 #include "chrome/browser/extensions/sandboxed_unpacker.h" | 17 #include "chrome/browser/extensions/sandboxed_unpacker.h" |
18 #include "chrome/browser/extensions/webstore_startup_installer.h" | 18 #include "chrome/browser/extensions/webstore_startup_installer.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/extensions/api/i18n/default_locale_handler.h" | 21 #include "chrome/common/extensions/chrome_manifest_handlers.h" |
22 #include "chrome/common/extensions/background_info.h" | |
23 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
24 #include "chrome/common/extensions/incognito_handler.h" | |
25 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" | 23 #include "chrome/common/extensions/permissions/chrome_api_permissions.h" |
26 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
27 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
28 #include "ipc/ipc_message.h" | 26 #include "ipc/ipc_message.h" |
29 | 27 |
30 using content::BrowserThread; | 28 using content::BrowserThread; |
31 | 29 |
32 namespace { | 30 namespace { |
33 | 31 |
34 void PrintPackExtensionMessage(const std::string& message) { | 32 void PrintPackExtensionMessage(const std::string& message) { |
35 printf("%s\n", message.c_str()); | 33 printf("%s\n", message.c_str()); |
36 } | 34 } |
37 | 35 |
38 } // namespace | 36 } // namespace |
39 | 37 |
40 namespace extensions { | 38 namespace extensions { |
41 | 39 |
42 StartupHelper::StartupHelper() : pack_job_succeeded_(false) { | 40 StartupHelper::StartupHelper() : pack_job_succeeded_(false) { |
43 PermissionsInfo::GetInstance()->InitializeWithDelegate( | 41 PermissionsInfo::GetInstance()->InitializeWithDelegate( |
44 ChromeAPIPermissions()); | 42 ChromeAPIPermissions()); |
45 (new DefaultLocaleHandler)->Register(); | 43 RegisterChromeManifestHandlers(); |
46 (new BackgroundManifestHandler)->Register(); | |
47 (new IncognitoHandler)->Register(); | |
48 } | 44 } |
49 | 45 |
50 void StartupHelper::OnPackSuccess( | 46 void StartupHelper::OnPackSuccess( |
51 const base::FilePath& crx_path, | 47 const base::FilePath& crx_path, |
52 const base::FilePath& output_private_key_path) { | 48 const base::FilePath& output_private_key_path) { |
53 pack_job_succeeded_ = true; | 49 pack_job_succeeded_ = true; |
54 PrintPackExtensionMessage( | 50 PrintPackExtensionMessage( |
55 UTF16ToUTF8( | 51 UTF16ToUTF8( |
56 PackExtensionJob::StandardSuccessMessage(crx_path, | 52 PackExtensionJob::StandardSuccessMessage(crx_path, |
57 output_private_key_path))); | 53 output_private_key_path))); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 } | 335 } |
340 return id; | 336 return id; |
341 } | 337 } |
342 | 338 |
343 StartupHelper::~StartupHelper() { | 339 StartupHelper::~StartupHelper() { |
344 if (pack_job_) | 340 if (pack_job_) |
345 pack_job_->ClearClient(); | 341 pack_job_->ClearClient(); |
346 } | 342 } |
347 | 343 |
348 } // namespace extensions | 344 } // namespace extensions |
OLD | NEW |