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 <memory> | 7 #include <memory> |
8 #include <utility> | |
9 | 8 |
10 #include "base/values.h" | 9 #include "base/values.h" |
11 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chromeos/file_manager/app_id.h" | 11 #include "chrome/browser/chromeos/file_manager/app_id.h" |
13 #include "chrome/browser/extensions/api/webstore_widget_private/app_installer.h" | 12 #include "chrome/browser/extensions/api/webstore_widget_private/app_installer.h" |
14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/extensions/api/webstore_widget_private.h" | 14 #include "chrome/common/extensions/api/webstore_widget_private.h" |
16 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
17 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
18 #include "ui/base/webui/web_ui_util.h" | 17 #include "ui/base/webui/web_ui_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
34 WebstoreWidgetPrivateGetStringsFunction:: | 33 WebstoreWidgetPrivateGetStringsFunction:: |
35 WebstoreWidgetPrivateGetStringsFunction() { | 34 WebstoreWidgetPrivateGetStringsFunction() { |
36 } | 35 } |
37 | 36 |
38 WebstoreWidgetPrivateGetStringsFunction:: | 37 WebstoreWidgetPrivateGetStringsFunction:: |
39 ~WebstoreWidgetPrivateGetStringsFunction() { | 38 ~WebstoreWidgetPrivateGetStringsFunction() { |
40 } | 39 } |
41 | 40 |
42 ExtensionFunction::ResponseAction | 41 ExtensionFunction::ResponseAction |
43 WebstoreWidgetPrivateGetStringsFunction::Run() { | 42 WebstoreWidgetPrivateGetStringsFunction::Run() { |
44 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 43 base::DictionaryValue* dict = new base::DictionaryValue(); |
45 | 44 |
46 SetL10nString(dict.get(), "TITLE_PRINTER_PROVIDERS", | 45 SetL10nString(dict, "TITLE_PRINTER_PROVIDERS", |
47 IDS_WEBSTORE_WIDGET_TITLE_PRINTER_PROVIDERS); | 46 IDS_WEBSTORE_WIDGET_TITLE_PRINTER_PROVIDERS); |
48 SetL10nString(dict.get(), "DEFAULT_ERROR_MESSAGE", | 47 SetL10nString(dict, "DEFAULT_ERROR_MESSAGE", |
49 IDS_WEBSTORE_WIDGET_DEFAULT_ERROR); | 48 IDS_WEBSTORE_WIDGET_DEFAULT_ERROR); |
50 SetL10nString(dict.get(), "OK_BUTTON", IDS_FILE_BROWSER_OK_LABEL); | 49 SetL10nString(dict, "OK_BUTTON", IDS_FILE_BROWSER_OK_LABEL); |
51 SetL10nString(dict.get(), "INSTALLATION_FAILED_MESSAGE", | 50 SetL10nString(dict, "INSTALLATION_FAILED_MESSAGE", |
52 IDS_FILE_BROWSER_SUGGEST_DIALOG_INSTALLATION_FAILED); | 51 IDS_FILE_BROWSER_SUGGEST_DIALOG_INSTALLATION_FAILED); |
53 SetL10nString(dict.get(), "LINK_TO_WEBSTORE", | 52 SetL10nString(dict, "LINK_TO_WEBSTORE", |
54 IDS_FILE_BROWSER_SUGGEST_DIALOG_LINK_TO_WEBSTORE); | 53 IDS_FILE_BROWSER_SUGGEST_DIALOG_LINK_TO_WEBSTORE); |
55 SetL10nString(dict.get(), "LOADING_SPINNER_ALT", | 54 SetL10nString(dict, "LOADING_SPINNER_ALT", |
56 IDS_WEBSTORE_WIDGET_LOADING_SPINNER_ALT); | 55 IDS_WEBSTORE_WIDGET_LOADING_SPINNER_ALT); |
57 SetL10nString(dict.get(), "INSTALLING_SPINNER_ALT", | 56 SetL10nString(dict, "INSTALLING_SPINNER_ALT", |
58 IDS_WEBSTORE_WIDGET_INSTALLING_SPINNER_ALT); | 57 IDS_WEBSTORE_WIDGET_INSTALLING_SPINNER_ALT); |
59 | 58 |
60 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 59 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
61 webui::SetLoadTimeDataDefaults(app_locale, dict.get()); | 60 webui::SetLoadTimeDataDefaults(app_locale, dict); |
62 return RespondNow(OneArgument(std::move(dict))); | 61 return RespondNow(OneArgument(dict)); |
63 } | 62 } |
64 | 63 |
65 WebstoreWidgetPrivateInstallWebstoreItemFunction:: | 64 WebstoreWidgetPrivateInstallWebstoreItemFunction:: |
66 WebstoreWidgetPrivateInstallWebstoreItemFunction() { | 65 WebstoreWidgetPrivateInstallWebstoreItemFunction() { |
67 } | 66 } |
68 | 67 |
69 WebstoreWidgetPrivateInstallWebstoreItemFunction:: | 68 WebstoreWidgetPrivateInstallWebstoreItemFunction:: |
70 ~WebstoreWidgetPrivateInstallWebstoreItemFunction() { | 69 ~WebstoreWidgetPrivateInstallWebstoreItemFunction() { |
71 } | 70 } |
72 | 71 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const std::string& error, | 105 const std::string& error, |
107 extensions::webstore_install::Result result) { | 106 extensions::webstore_install::Result result) { |
108 if (!success) | 107 if (!success) |
109 SetError(error); | 108 SetError(error); |
110 | 109 |
111 SendResponse(success); | 110 SendResponse(success); |
112 } | 111 } |
113 | 112 |
114 } // namespace api | 113 } // namespace api |
115 } // namespace extensions | 114 } // namespace extensions |
OLD | NEW |