Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: chrome/browser/extensions/api/webstore_widget_private/webstore_widget_private_api.cc

Issue 2025103003: ExtensionFunction: don't pass ownership of base::Value by raw pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
8 9
9 #include "base/values.h" 10 #include "base/values.h"
10 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chromeos/file_manager/app_id.h" 12 #include "chrome/browser/chromeos/file_manager/app_id.h"
12 #include "chrome/browser/extensions/api/webstore_widget_private/app_installer.h" 13 #include "chrome/browser/extensions/api/webstore_widget_private/app_installer.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/common/extensions/api/webstore_widget_private.h" 15 #include "chrome/common/extensions/api/webstore_widget_private.h"
15 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/webui/web_ui_util.h" 18 #include "ui/base/webui/web_ui_util.h"
(...skipping 15 matching lines...) Expand all
33 WebstoreWidgetPrivateGetStringsFunction:: 34 WebstoreWidgetPrivateGetStringsFunction::
34 WebstoreWidgetPrivateGetStringsFunction() { 35 WebstoreWidgetPrivateGetStringsFunction() {
35 } 36 }
36 37
37 WebstoreWidgetPrivateGetStringsFunction:: 38 WebstoreWidgetPrivateGetStringsFunction::
38 ~WebstoreWidgetPrivateGetStringsFunction() { 39 ~WebstoreWidgetPrivateGetStringsFunction() {
39 } 40 }
40 41
41 ExtensionFunction::ResponseAction 42 ExtensionFunction::ResponseAction
42 WebstoreWidgetPrivateGetStringsFunction::Run() { 43 WebstoreWidgetPrivateGetStringsFunction::Run() {
43 base::DictionaryValue* dict = new base::DictionaryValue(); 44 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
44 45
45 SetL10nString(dict, "TITLE_PRINTER_PROVIDERS", 46 SetL10nString(dict.get(), "TITLE_PRINTER_PROVIDERS",
46 IDS_WEBSTORE_WIDGET_TITLE_PRINTER_PROVIDERS); 47 IDS_WEBSTORE_WIDGET_TITLE_PRINTER_PROVIDERS);
47 SetL10nString(dict, "DEFAULT_ERROR_MESSAGE", 48 SetL10nString(dict.get(), "DEFAULT_ERROR_MESSAGE",
48 IDS_WEBSTORE_WIDGET_DEFAULT_ERROR); 49 IDS_WEBSTORE_WIDGET_DEFAULT_ERROR);
49 SetL10nString(dict, "OK_BUTTON", IDS_FILE_BROWSER_OK_LABEL); 50 SetL10nString(dict.get(), "OK_BUTTON", IDS_FILE_BROWSER_OK_LABEL);
50 SetL10nString(dict, "INSTALLATION_FAILED_MESSAGE", 51 SetL10nString(dict.get(), "INSTALLATION_FAILED_MESSAGE",
51 IDS_FILE_BROWSER_SUGGEST_DIALOG_INSTALLATION_FAILED); 52 IDS_FILE_BROWSER_SUGGEST_DIALOG_INSTALLATION_FAILED);
52 SetL10nString(dict, "LINK_TO_WEBSTORE", 53 SetL10nString(dict.get(), "LINK_TO_WEBSTORE",
53 IDS_FILE_BROWSER_SUGGEST_DIALOG_LINK_TO_WEBSTORE); 54 IDS_FILE_BROWSER_SUGGEST_DIALOG_LINK_TO_WEBSTORE);
54 SetL10nString(dict, "LOADING_SPINNER_ALT", 55 SetL10nString(dict.get(), "LOADING_SPINNER_ALT",
55 IDS_WEBSTORE_WIDGET_LOADING_SPINNER_ALT); 56 IDS_WEBSTORE_WIDGET_LOADING_SPINNER_ALT);
56 SetL10nString(dict, "INSTALLING_SPINNER_ALT", 57 SetL10nString(dict.get(), "INSTALLING_SPINNER_ALT",
57 IDS_WEBSTORE_WIDGET_INSTALLING_SPINNER_ALT); 58 IDS_WEBSTORE_WIDGET_INSTALLING_SPINNER_ALT);
58 59
59 const std::string& app_locale = g_browser_process->GetApplicationLocale(); 60 const std::string& app_locale = g_browser_process->GetApplicationLocale();
60 webui::SetLoadTimeDataDefaults(app_locale, dict); 61 webui::SetLoadTimeDataDefaults(app_locale, dict.get());
61 return RespondNow(OneArgument(dict)); 62 return RespondNow(OneArgument(std::move(dict)));
62 } 63 }
63 64
64 WebstoreWidgetPrivateInstallWebstoreItemFunction:: 65 WebstoreWidgetPrivateInstallWebstoreItemFunction::
65 WebstoreWidgetPrivateInstallWebstoreItemFunction() { 66 WebstoreWidgetPrivateInstallWebstoreItemFunction() {
66 } 67 }
67 68
68 WebstoreWidgetPrivateInstallWebstoreItemFunction:: 69 WebstoreWidgetPrivateInstallWebstoreItemFunction::
69 ~WebstoreWidgetPrivateInstallWebstoreItemFunction() { 70 ~WebstoreWidgetPrivateInstallWebstoreItemFunction() {
70 } 71 }
71 72
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 const std::string& error, 106 const std::string& error,
106 extensions::webstore_install::Result result) { 107 extensions::webstore_install::Result result) {
107 if (!success) 108 if (!success)
108 SetError(error); 109 SetError(error);
109 110
110 SendResponse(success); 111 SendResponse(success);
111 } 112 }
112 113
113 } // namespace api 114 } // namespace api
114 } // namespace extensions 115 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/settings_private/settings_private_api.cc ('k') | extensions/browser/api/hid/hid_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698