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

Side by Side Diff: chrome/browser/extensions/extensions_startup.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: 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/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/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& title,
Aaron Boodman 2012/08/14 01:32:01 You can remove all the title strings. Just print t
tfarina 2012/08/14 01:48:58 Done.
17 const std::string& message) {
18 std::string out_text(title);
19 out_text.append("\n\n");
20 out_text.append(message);
21 out_text.append("\n");
22 base::StringPrintf("%s", out_text.c_str());
23 }
24
25 } // namespace
26
15 ExtensionsStartupUtil::ExtensionsStartupUtil() : pack_job_succeeded_(false) {} 27 ExtensionsStartupUtil::ExtensionsStartupUtil() : pack_job_succeeded_(false) {}
16 28
17 void ExtensionsStartupUtil::OnPackSuccess( 29 void ExtensionsStartupUtil::OnPackSuccess(
18 const FilePath& crx_path, 30 const FilePath& crx_path,
19 const FilePath& output_private_key_path) { 31 const FilePath& output_private_key_path) {
20 pack_job_succeeded_ = true; 32 pack_job_succeeded_ = true;
21 chrome::ShowMessageBox(NULL, ASCIIToUTF16("Extension Packaging Success"), 33 PrintPackExtensionMessage(std::string("Extension Packaging Success"),
22 PackExtensionJob::StandardSuccessMessage(crx_path, 34 UTF16ToUTF8(PackExtensionJob::StandardSuccessMessage(crx_path,
23 output_private_key_path), 35 output_private_key_path)));
24 chrome::MESSAGE_BOX_TYPE_INFORMATION);
25 } 36 }
26 37
27 void ExtensionsStartupUtil::OnPackFailure( 38 void ExtensionsStartupUtil::OnPackFailure(
28 const std::string& error_message, 39 const std::string& error_message,
29 extensions::ExtensionCreator::ErrorType type) { 40 extensions::ExtensionCreator::ErrorType type) {
30 chrome::ShowMessageBox(NULL, ASCIIToUTF16("Extension Packaging Error"), 41 PrintPackExtensionMessage(std::string("Extension Packaging Error"),
31 UTF8ToUTF16(error_message), chrome::MESSAGE_BOX_TYPE_WARNING); 42 error_message);
32 } 43 }
33 44
34 bool ExtensionsStartupUtil::PackExtension(const CommandLine& cmd_line) { 45 bool ExtensionsStartupUtil::PackExtension(const CommandLine& cmd_line) {
35 if (!cmd_line.HasSwitch(switches::kPackExtension)) 46 if (!cmd_line.HasSwitch(switches::kPackExtension))
36 return false; 47 return false;
37 48
38 // Input Paths. 49 // Input Paths.
39 FilePath src_dir = cmd_line.GetSwitchValuePath(switches::kPackExtension); 50 FilePath src_dir = cmd_line.GetSwitchValuePath(switches::kPackExtension);
40 FilePath private_key_path; 51 FilePath private_key_path;
41 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) { 52 if (cmd_line.HasSwitch(switches::kPackExtensionKey)) {
(...skipping 24 matching lines...) Expand all
66 std::string extension_id = cmd_line.GetSwitchValueASCII( 77 std::string extension_id = cmd_line.GetSwitchValueASCII(
67 switches::kUninstallExtension); 78 switches::kUninstallExtension);
68 return ExtensionService::UninstallExtensionHelper(extension_service, 79 return ExtensionService::UninstallExtensionHelper(extension_service,
69 extension_id); 80 extension_id);
70 } 81 }
71 82
72 ExtensionsStartupUtil::~ExtensionsStartupUtil() { 83 ExtensionsStartupUtil::~ExtensionsStartupUtil() {
73 if (pack_job_.get()) 84 if (pack_job_.get())
74 pack_job_->ClearClient(); 85 pack_job_->ClearClient();
75 } 86 }
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