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/bundle_installer.h" | 5 #include "chrome/browser/extensions/bundle_installer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/i18n/rtl.h" | 13 #include "base/i18n/rtl.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "chrome/browser/extensions/crx_installer.h" | 16 #include "chrome/browser/extensions/crx_installer.h" |
16 #include "chrome/browser/extensions/permissions_updater.h" | 17 #include "chrome/browser/extensions/permissions_updater.h" |
17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 entry.first, | 179 entry.first, |
179 make_scoped_ptr(parsed_manifests_[entry.first]->DeepCopy()), | 180 make_scoped_ptr(parsed_manifests_[entry.first]->DeepCopy()), |
180 true)); | 181 true)); |
181 approval->use_app_installed_bubble = false; | 182 approval->use_app_installed_bubble = false; |
182 approval->skip_post_install_ui = true; | 183 approval->skip_post_install_ui = true; |
183 approval->authuser = authuser_; | 184 approval->authuser = authuser_; |
184 approval->installing_icon = | 185 approval->installing_icon = |
185 gfx::ImageSkia::CreateFrom1xBitmap(entry.second.icon); | 186 gfx::ImageSkia::CreateFrom1xBitmap(entry.second.icon); |
186 | 187 |
187 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( | 188 scoped_refptr<WebstoreInstaller> installer = new WebstoreInstaller( |
188 profile_, | 189 profile_, this, web_contents, entry.first, std::move(approval), |
189 this, | |
190 web_contents, | |
191 entry.first, | |
192 approval.Pass(), | |
193 WebstoreInstaller::INSTALL_SOURCE_OTHER); | 190 WebstoreInstaller::INSTALL_SOURCE_OTHER); |
194 installer->Start(); | 191 installer->Start(); |
195 } | 192 } |
196 } | 193 } |
197 | 194 |
198 base::string16 BundleInstaller::GetHeadingTextFor(Item::State state) const { | 195 base::string16 BundleInstaller::GetHeadingTextFor(Item::State state) const { |
199 // For STATE_FAILED, we can't tell if the items were apps or extensions | 196 // For STATE_FAILED, we can't tell if the items were apps or extensions |
200 // so we always show the same message. | 197 // so we always show the same message. |
201 if (state == Item::STATE_FAILED) { | 198 if (state == Item::STATE_FAILED) { |
202 if (HasItemWithState(state)) | 199 if (HasItemWithState(state)) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 if (delegated_username_.empty()) { | 288 if (delegated_username_.empty()) { |
292 prompt.reset(new ExtensionInstallPrompt::Prompt( | 289 prompt.reset(new ExtensionInstallPrompt::Prompt( |
293 ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT)); | 290 ExtensionInstallPrompt::BUNDLE_INSTALL_PROMPT)); |
294 } else { | 291 } else { |
295 prompt.reset(new ExtensionInstallPrompt::Prompt( | 292 prompt.reset(new ExtensionInstallPrompt::Prompt( |
296 ExtensionInstallPrompt::DELEGATED_BUNDLE_PERMISSIONS_PROMPT)); | 293 ExtensionInstallPrompt::DELEGATED_BUNDLE_PERMISSIONS_PROMPT)); |
297 prompt->set_delegated_username(delegated_username_); | 294 prompt->set_delegated_username(delegated_username_); |
298 } | 295 } |
299 prompt->set_bundle(this); | 296 prompt->set_bundle(this); |
300 install_ui_->ShowDialog( | 297 install_ui_->ShowDialog( |
301 this, nullptr, &icon_, prompt.Pass(), permissions.Pass(), | 298 this, nullptr, &icon_, std::move(prompt), std::move(permissions), |
302 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); | 299 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); |
303 } | 300 } |
304 } | 301 } |
305 | 302 |
306 void BundleInstaller::ShowInstalledBubbleIfDone() { | 303 void BundleInstaller::ShowInstalledBubbleIfDone() { |
307 // We're ready to show the installed bubble when no items are pending. | 304 // We're ready to show the installed bubble when no items are pending. |
308 if (HasItemWithState(Item::STATE_PENDING)) | 305 if (HasItemWithState(Item::STATE_PENDING)) |
309 return; | 306 return; |
310 | 307 |
311 if (browser_) | 308 if (browser_) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 | 366 |
370 ShowInstalledBubbleIfDone(); | 367 ShowInstalledBubbleIfDone(); |
371 } | 368 } |
372 | 369 |
373 void BundleInstaller::OnBrowserRemoved(Browser* browser) { | 370 void BundleInstaller::OnBrowserRemoved(Browser* browser) { |
374 if (browser_ == browser) | 371 if (browser_ == browser) |
375 browser_ = nullptr; | 372 browser_ = nullptr; |
376 } | 373 } |
377 | 374 |
378 } // namespace extensions | 375 } // namespace extensions |
OLD | NEW |