OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/unpacked_installer.h" | 5 #include "chrome/browser/extensions/unpacked_installer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 Profile* profile, | 52 Profile* profile, |
53 const base::Closure& callback); | 53 const base::Closure& callback); |
54 | 54 |
55 void ShowPrompt(); | 55 void ShowPrompt(); |
56 | 56 |
57 private: | 57 private: |
58 ~SimpleExtensionLoadPrompt(); // Manages its own lifetime. | 58 ~SimpleExtensionLoadPrompt(); // Manages its own lifetime. |
59 | 59 |
60 void OnInstallPromptDone(ExtensionInstallPrompt::Result result); | 60 void OnInstallPromptDone(ExtensionInstallPrompt::Result result); |
61 | 61 |
62 scoped_ptr<ExtensionInstallPrompt> install_ui_; | 62 std::unique_ptr<ExtensionInstallPrompt> install_ui_; |
63 scoped_refptr<const Extension> extension_; | 63 scoped_refptr<const Extension> extension_; |
64 base::Closure callback_; | 64 base::Closure callback_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(SimpleExtensionLoadPrompt); | 66 DISALLOW_COPY_AND_ASSIGN(SimpleExtensionLoadPrompt); |
67 }; | 67 }; |
68 | 68 |
69 SimpleExtensionLoadPrompt::SimpleExtensionLoadPrompt( | 69 SimpleExtensionLoadPrompt::SimpleExtensionLoadPrompt( |
70 const Extension* extension, | 70 const Extension* extension, |
71 Profile* profile, | 71 Profile* profile, |
72 const base::Closure& callback) | 72 const base::Closure& callback) |
73 : extension_(extension), callback_(callback) { | 73 : extension_(extension), callback_(callback) { |
74 scoped_ptr<extensions::ExtensionInstallUI> ui( | 74 std::unique_ptr<extensions::ExtensionInstallUI> ui( |
75 extensions::CreateExtensionInstallUI(profile)); | 75 extensions::CreateExtensionInstallUI(profile)); |
76 install_ui_.reset(new ExtensionInstallPrompt( | 76 install_ui_.reset(new ExtensionInstallPrompt( |
77 profile, ui->GetDefaultInstallDialogParent())); | 77 profile, ui->GetDefaultInstallDialogParent())); |
78 } | 78 } |
79 | 79 |
80 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() { | 80 SimpleExtensionLoadPrompt::~SimpleExtensionLoadPrompt() { |
81 } | 81 } |
82 | 82 |
83 void SimpleExtensionLoadPrompt::ShowPrompt() { | 83 void SimpleExtensionLoadPrompt::ShowPrompt() { |
84 // Unretained() is safe because this object manages its own lifetime. | 84 // Unretained() is safe because this object manages its own lifetime. |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 service_weak_->OnExtensionInstalled( | 361 service_weak_->OnExtensionInstalled( |
362 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); | 362 extension(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
363 | 363 |
364 if (!callback_.is_null()) { | 364 if (!callback_.is_null()) { |
365 callback_.Run(extension(), extension_path_, std::string()); | 365 callback_.Run(extension(), extension_path_, std::string()); |
366 callback_.Reset(); | 366 callback_.Reset(); |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 } // namespace extensions | 370 } // namespace extensions |
OLD | NEW |