Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: chrome/browser/extensions/startup_helper.cc

Issue 10825333: extensions: Print to stdout on all platform with --pack-extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase and fix nit Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/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/browser/ui/simple_message_box.h"
13 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
14 13
14 namespace {
15
16 void PrintPackExtensionMessage(const std::string& message) {
17 base::StringPrintf("%s\n", message.c_str());
18 }
19
20 } // namespace
21
15 namespace extensions { 22 namespace extensions {
16 23
17 StartupHelper::StartupHelper() : pack_job_succeeded_(false) {} 24 StartupHelper::StartupHelper() : pack_job_succeeded_(false) {}
18 25
19 void StartupHelper::OnPackSuccess(const FilePath& crx_path, 26 void StartupHelper::OnPackSuccess(const FilePath& crx_path,
20 const FilePath& output_private_key_path) { 27 const FilePath& output_private_key_path) {
21 pack_job_succeeded_ = true; 28 pack_job_succeeded_ = true;
22 chrome::ShowMessageBox(NULL, ASCIIToUTF16("Extension Packaging Success"), 29 PrintPackExtensionMessage(
23 PackExtensionJob::StandardSuccessMessage(crx_path, 30 UTF16ToUTF8(
24 output_private_key_path), 31 PackExtensionJob::StandardSuccessMessage(crx_path,
25 chrome::MESSAGE_BOX_TYPE_INFORMATION); 32 output_private_key_path)));
26 } 33 }
27 34
28 void StartupHelper::OnPackFailure(const std::string& error_message, 35 void StartupHelper::OnPackFailure(const std::string& error_message,
29 ExtensionCreator::ErrorType type) { 36 ExtensionCreator::ErrorType type) {
30 chrome::ShowMessageBox(NULL, ASCIIToUTF16("Extension Packaging Error"), 37 PrintPackExtensionMessage(error_message);
31 UTF8ToUTF16(error_message), chrome::MESSAGE_BOX_TYPE_WARNING);
32 } 38 }
33 39
34 bool StartupHelper::PackExtension(const CommandLine& cmd_line) { 40 bool StartupHelper::PackExtension(const CommandLine& cmd_line) {
35 if (!cmd_line.HasSwitch(switches::kPackExtension)) 41 if (!cmd_line.HasSwitch(switches::kPackExtension))
36 return false; 42 return false;
37 43
38 // Input Paths. 44 // Input Paths.
39 FilePath src_dir = cmd_line.GetSwitchValuePath(switches::kPackExtension); 45 FilePath src_dir = cmd_line.GetSwitchValuePath(switches::kPackExtension);
40 FilePath private_key_path; 46 FilePath private_key_path;
41 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) { 47 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) {
(...skipping 26 matching lines...) Expand all
68 return ExtensionService::UninstallExtensionHelper(extension_service, 74 return ExtensionService::UninstallExtensionHelper(extension_service,
69 extension_id); 75 extension_id);
70 } 76 }
71 77
72 StartupHelper::~StartupHelper() { 78 StartupHelper::~StartupHelper() {
73 if (pack_job_.get()) 79 if (pack_job_.get())
74 pack_job_->ClearClient(); 80 pack_job_->ClearClient();
75 } 81 }
76 82
77 } // namespace extensions 83 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698