OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/api/webstore_widget_private/webstore_widget_
private_api.h" | 5 #include "chrome/browser/extensions/api/webstore_widget_private/webstore_widget_
private_api.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
8 #include "base/values.h" | 9 #include "base/values.h" |
9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/file_manager/app_id.h" | 11 #include "chrome/browser/chromeos/file_manager/app_id.h" |
11 #include "chrome/browser/extensions/api/webstore_widget_private/app_installer.h" | 12 #include "chrome/browser/extensions/api/webstore_widget_private/app_installer.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/extensions/api/webstore_widget_private.h" | 14 #include "chrome/common/extensions/api/webstore_widget_private.h" |
14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/base/webui/web_ui_util.h" | 17 #include "ui/base/webui/web_ui_util.h" |
17 | 18 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 WebstoreWidgetPrivateInstallWebstoreItemFunction:: | 64 WebstoreWidgetPrivateInstallWebstoreItemFunction:: |
64 WebstoreWidgetPrivateInstallWebstoreItemFunction() { | 65 WebstoreWidgetPrivateInstallWebstoreItemFunction() { |
65 } | 66 } |
66 | 67 |
67 WebstoreWidgetPrivateInstallWebstoreItemFunction:: | 68 WebstoreWidgetPrivateInstallWebstoreItemFunction:: |
68 ~WebstoreWidgetPrivateInstallWebstoreItemFunction() { | 69 ~WebstoreWidgetPrivateInstallWebstoreItemFunction() { |
69 } | 70 } |
70 | 71 |
71 ExtensionFunction::ResponseAction | 72 ExtensionFunction::ResponseAction |
72 WebstoreWidgetPrivateInstallWebstoreItemFunction::Run() { | 73 WebstoreWidgetPrivateInstallWebstoreItemFunction::Run() { |
73 const scoped_ptr<webstore_widget_private::InstallWebstoreItem::Params> params( | 74 const std::unique_ptr<webstore_widget_private::InstallWebstoreItem::Params> |
74 webstore_widget_private::InstallWebstoreItem::Params::Create(*args_)); | 75 params( |
| 76 webstore_widget_private::InstallWebstoreItem::Params::Create(*args_)); |
75 EXTENSION_FUNCTION_VALIDATE(params); | 77 EXTENSION_FUNCTION_VALIDATE(params); |
76 | 78 |
77 if (params->item_id.empty()) | 79 if (params->item_id.empty()) |
78 return RespondNow(Error("App ID empty.")); | 80 return RespondNow(Error("App ID empty.")); |
79 | 81 |
80 bool allow_silent_install = | 82 bool allow_silent_install = |
81 extension()->id() == file_manager::kVideoPlayerAppId && | 83 extension()->id() == file_manager::kVideoPlayerAppId && |
82 params->item_id == kGoogleCastApiExtensionId; | 84 params->item_id == kGoogleCastApiExtensionId; |
83 if (params->silent_installation && !allow_silent_install) | 85 if (params->silent_installation && !allow_silent_install) |
84 return RespondNow(Error("Silent installation not allowed.")); | 86 return RespondNow(Error("Silent installation not allowed.")); |
(...skipping 18 matching lines...) Expand all Loading... |
103 const std::string& error, | 105 const std::string& error, |
104 extensions::webstore_install::Result result) { | 106 extensions::webstore_install::Result result) { |
105 if (!success) | 107 if (!success) |
106 SetError(error); | 108 SetError(error); |
107 | 109 |
108 SendResponse(success); | 110 SendResponse(success); |
109 } | 111 } |
110 | 112 |
111 } // namespace api | 113 } // namespace api |
112 } // namespace extensions | 114 } // namespace extensions |
OLD | NEW |