| OLD | NEW |
| 1 // Copyright (c) 2010 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/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/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 | 13 |
| 14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 15 #include "app/win/win_util.h" | 15 #include "ui/base/message_box_win.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 ExtensionsStartupUtil::ExtensionsStartupUtil() : pack_job_succeeded_(false) {} | 18 ExtensionsStartupUtil::ExtensionsStartupUtil() : pack_job_succeeded_(false) {} |
| 19 | 19 |
| 20 void ExtensionsStartupUtil::OnPackSuccess( | 20 void ExtensionsStartupUtil::OnPackSuccess( |
| 21 const FilePath& crx_path, | 21 const FilePath& crx_path, |
| 22 const FilePath& output_private_key_path) { | 22 const FilePath& output_private_key_path) { |
| 23 pack_job_succeeded_ = true; | 23 pack_job_succeeded_ = true; |
| 24 ShowPackExtensionMessage( | 24 ShowPackExtensionMessage( |
| 25 L"Extension Packaging Success", | 25 L"Extension Packaging Success", |
| 26 UTF16ToWideHack(PackExtensionJob::StandardSuccessMessage( | 26 UTF16ToWideHack(PackExtensionJob::StandardSuccessMessage( |
| 27 crx_path, output_private_key_path))); | 27 crx_path, output_private_key_path))); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void ExtensionsStartupUtil::OnPackFailure(const std::string& error_message) { | 30 void ExtensionsStartupUtil::OnPackFailure(const std::string& error_message) { |
| 31 ShowPackExtensionMessage(L"Extension Packaging Error", | 31 ShowPackExtensionMessage(L"Extension Packaging Error", |
| 32 UTF8ToWide(error_message)); | 32 UTF8ToWide(error_message)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void ExtensionsStartupUtil::ShowPackExtensionMessage( | 35 void ExtensionsStartupUtil::ShowPackExtensionMessage( |
| 36 const std::wstring& caption, | 36 const std::wstring& caption, |
| 37 const std::wstring& message) { | 37 const std::wstring& message) { |
| 38 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 39 app::win::MessageBox(NULL, message, caption, MB_OK | MB_SETFOREGROUND); | 39 ui::MessageBox(NULL, message, caption, MB_OK | MB_SETFOREGROUND); |
| 40 #else | 40 #else |
| 41 // Just send caption & text to stdout on mac & linux. | 41 // Just send caption & text to stdout on mac & linux. |
| 42 std::string out_text = WideToASCII(caption); | 42 std::string out_text = WideToASCII(caption); |
| 43 out_text.append("\n\n"); | 43 out_text.append("\n\n"); |
| 44 out_text.append(WideToASCII(message)); | 44 out_text.append(WideToASCII(message)); |
| 45 out_text.append("\n"); | 45 out_text.append("\n"); |
| 46 base::StringPrintf("%s", out_text.c_str()); | 46 base::StringPrintf("%s", out_text.c_str()); |
| 47 #endif | 47 #endif |
| 48 } | 48 } |
| 49 | 49 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 ExtensionsStartupUtil::~ExtensionsStartupUtil() { | 90 ExtensionsStartupUtil::~ExtensionsStartupUtil() { |
| 91 if (pack_job_.get()) | 91 if (pack_job_.get()) |
| 92 pack_job_->ClearClient(); | 92 pack_job_->ClearClient(); |
| 93 } | 93 } |
| OLD | NEW |