| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 Profile* profile, | 185 Profile* profile, |
| 186 base::Callback<void()> done_callback) { | 186 base::Callback<void()> done_callback) { |
| 187 std::string id = WebStoreIdFromLimitedInstallCmdLine(cmd_line); | 187 std::string id = WebStoreIdFromLimitedInstallCmdLine(cmd_line); |
| 188 if (!Extension::IdIsValid(id)) { | 188 if (!Extension::IdIsValid(id)) { |
| 189 LOG(ERROR) << "Invalid index for " << switches::kLimitedInstallFromWebstore; | 189 LOG(ERROR) << "Invalid index for " << switches::kLimitedInstallFromWebstore; |
| 190 done_callback.Run(); | 190 done_callback.Run(); |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 | 193 |
| 194 AppInstallHelper* helper = new AppInstallHelper(); | 194 AppInstallHelper* helper = new AppInstallHelper(); |
| 195 helper->BeginInstall(profile, id, true /*show_prompt*/, | 195 helper->BeginInstall(profile, id, false /*show_prompt*/, |
| 196 base::Bind(&DeleteHelperAndRunCallback, | 196 base::Bind(&DeleteHelperAndRunCallback, |
| 197 helper, done_callback)); | 197 helper, done_callback)); |
| 198 } | 198 } |
| 199 | 199 |
| 200 std::string StartupHelper::WebStoreIdFromLimitedInstallCmdLine( | 200 std::string StartupHelper::WebStoreIdFromLimitedInstallCmdLine( |
| 201 const CommandLine& cmd_line) { | 201 const CommandLine& cmd_line) { |
| 202 std::string index = cmd_line.GetSwitchValueASCII( | 202 std::string index = cmd_line.GetSwitchValueASCII( |
| 203 switches::kLimitedInstallFromWebstore); | 203 switches::kLimitedInstallFromWebstore); |
| 204 std::string id; | 204 std::string id; |
| 205 if (index == "1") { | 205 if (index == "1") { |
| 206 id = "nckgahadagoaajjgafhacjanaoiihapd"; | 206 id = "nckgahadagoaajjgafhacjanaoiihapd"; |
| 207 } else if (index == "2") { | 207 } else if (index == "2") { |
| 208 id = "ecglahbcnmdpdciemllbhojghbkagdje"; | 208 id = "ecglahbcnmdpdciemllbhojghbkagdje"; |
| 209 } | 209 } |
| 210 return id; | 210 return id; |
| 211 } | 211 } |
| 212 | 212 |
| 213 StartupHelper::~StartupHelper() { | 213 StartupHelper::~StartupHelper() { |
| 214 if (pack_job_.get()) | 214 if (pack_job_.get()) |
| 215 pack_job_->ClearClient(); | 215 pack_job_->ClearClient(); |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace extensions | 218 } // namespace extensions |
| OLD | NEW |