OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_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_util.h" | 15 #include "app/win_util.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( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return pack_job_succeeded_; | 65 return pack_job_succeeded_; |
66 } | 66 } |
67 | 67 |
68 bool ExtensionsStartupUtil::UninstallExtension(const CommandLine& cmd_line, | 68 bool ExtensionsStartupUtil::UninstallExtension(const CommandLine& cmd_line, |
69 Profile* profile) { | 69 Profile* profile) { |
70 DCHECK(profile); | 70 DCHECK(profile); |
71 | 71 |
72 if (!cmd_line.HasSwitch(switches::kUninstallExtension)) | 72 if (!cmd_line.HasSwitch(switches::kUninstallExtension)) |
73 return false; | 73 return false; |
74 | 74 |
75 ExtensionsService* extensions_service = profile->GetExtensionsService(); | 75 ExtensionService* extension_service = profile->GetExtensionService(); |
76 if (!extensions_service) | 76 if (!extension_service) |
77 return false; | 77 return false; |
78 | 78 |
79 std::string extension_id = cmd_line.GetSwitchValueASCII( | 79 std::string extension_id = cmd_line.GetSwitchValueASCII( |
80 switches::kUninstallExtension); | 80 switches::kUninstallExtension); |
81 if (ExtensionsService::UninstallExtensionHelper(extensions_service, | 81 if (ExtensionService::UninstallExtensionHelper(extension_service, |
82 extension_id)) { | 82 extension_id)) { |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 return false; | 86 return false; |
87 } | 87 } |
88 | 88 |
89 ExtensionsStartupUtil::~ExtensionsStartupUtil() { | 89 ExtensionsStartupUtil::~ExtensionsStartupUtil() { |
90 if (pack_job_.get()) | 90 if (pack_job_.get()) |
91 pack_job_->ClearClient(); | 91 pack_job_->ClearClient(); |
92 } | 92 } |
OLD | NEW |