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

Side by Side Diff: chrome/common/extensions/manifest_handlers/app_launch_info.cc

Issue 93793010: Update uses of UTF conversions in chrome/common to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/common/extensions/manifest_handlers/app_launch_info.h" 5 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return true; 111 return true;
112 } 112 }
113 113
114 bool AppLaunchInfo::LoadLaunchURL(Extension* extension, base::string16* error) { 114 bool AppLaunchInfo::LoadLaunchURL(Extension* extension, base::string16* error) {
115 const base::Value* temp = NULL; 115 const base::Value* temp = NULL;
116 116
117 // Launch URL can be either local (to chrome-extension:// root) or an absolute 117 // Launch URL can be either local (to chrome-extension:// root) or an absolute
118 // web URL. 118 // web URL.
119 if (extension->manifest()->Get(keys::kLaunchLocalPath, &temp)) { 119 if (extension->manifest()->Get(keys::kLaunchLocalPath, &temp)) {
120 if (extension->manifest()->Get(keys::kLaunchWebURL, NULL)) { 120 if (extension->manifest()->Get(keys::kLaunchWebURL, NULL)) {
121 *error = ASCIIToUTF16(errors::kLaunchPathAndURLAreExclusive); 121 *error = base::ASCIIToUTF16(errors::kLaunchPathAndURLAreExclusive);
122 return false; 122 return false;
123 } 123 }
124 124
125 if (extension->manifest()->Get(keys::kWebURLs, NULL)) { 125 if (extension->manifest()->Get(keys::kWebURLs, NULL)) {
126 *error = ASCIIToUTF16(errors::kLaunchPathAndExtentAreExclusive); 126 *error = base::ASCIIToUTF16(errors::kLaunchPathAndExtentAreExclusive);
127 return false; 127 return false;
128 } 128 }
129 129
130 std::string launch_path; 130 std::string launch_path;
131 if (!temp->GetAsString(&launch_path)) { 131 if (!temp->GetAsString(&launch_path)) {
132 *error = ErrorUtils::FormatErrorMessageUTF16( 132 *error = ErrorUtils::FormatErrorMessageUTF16(
133 errors::kInvalidLaunchValue, 133 errors::kInvalidLaunchValue,
134 keys::kLaunchLocalPath); 134 keys::kLaunchLocalPath);
135 return false; 135 return false;
136 } 136 }
(...skipping 22 matching lines...) Expand all
159 URLPattern pattern(Extension::kValidWebExtentSchemes); 159 URLPattern pattern(Extension::kValidWebExtentSchemes);
160 if (!url.is_valid() || !pattern.SetScheme(url.scheme())) { 160 if (!url.is_valid() || !pattern.SetScheme(url.scheme())) {
161 *error = ErrorUtils::FormatErrorMessageUTF16( 161 *error = ErrorUtils::FormatErrorMessageUTF16(
162 errors::kInvalidLaunchValue, 162 errors::kInvalidLaunchValue,
163 keys::kLaunchWebURL); 163 keys::kLaunchWebURL);
164 return false; 164 return false;
165 } 165 }
166 166
167 launch_web_url_ = url; 167 launch_web_url_ = url;
168 } else if (extension->is_legacy_packaged_app()) { 168 } else if (extension->is_legacy_packaged_app()) {
169 *error = ASCIIToUTF16(errors::kLaunchURLRequired); 169 *error = base::ASCIIToUTF16(errors::kLaunchURLRequired);
170 return false; 170 return false;
171 } 171 }
172 172
173 // For the Chrome component app, override launch url to new tab. 173 // For the Chrome component app, override launch url to new tab.
174 if (extension->id() == extension_misc::kChromeAppId) { 174 if (extension->id() == extension_misc::kChromeAppId) {
175 launch_web_url_ = GURL(chrome::kChromeUINewTabURL); 175 launch_web_url_ = GURL(chrome::kChromeUINewTabURL);
176 return true; 176 return true;
177 } 177 }
178 178
179 // If there is no extent, we default the extent based on the launch URL. 179 // If there is no extent, we default the extent based on the launch URL.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 bool AppLaunchInfo::LoadLaunchContainer(Extension* extension, 227 bool AppLaunchInfo::LoadLaunchContainer(Extension* extension,
228 base::string16* error) { 228 base::string16* error) {
229 const base::Value* tmp_launcher_container = NULL; 229 const base::Value* tmp_launcher_container = NULL;
230 if (!extension->manifest()->Get(keys::kLaunchContainer, 230 if (!extension->manifest()->Get(keys::kLaunchContainer,
231 &tmp_launcher_container)) 231 &tmp_launcher_container))
232 return true; 232 return true;
233 233
234 std::string launch_container_string; 234 std::string launch_container_string;
235 if (!tmp_launcher_container->GetAsString(&launch_container_string)) { 235 if (!tmp_launcher_container->GetAsString(&launch_container_string)) {
236 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); 236 *error = base::ASCIIToUTF16(errors::kInvalidLaunchContainer);
237 return false; 237 return false;
238 } 238 }
239 239
240 if (launch_container_string == values::kLaunchContainerPanel) { 240 if (launch_container_string == values::kLaunchContainerPanel) {
241 launch_container_ = LAUNCH_CONTAINER_PANEL; 241 launch_container_ = LAUNCH_CONTAINER_PANEL;
242 } else if (launch_container_string == values::kLaunchContainerTab) { 242 } else if (launch_container_string == values::kLaunchContainerTab) {
243 launch_container_ = LAUNCH_CONTAINER_TAB; 243 launch_container_ = LAUNCH_CONTAINER_TAB;
244 } else { 244 } else {
245 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); 245 *error = base::ASCIIToUTF16(errors::kInvalidLaunchContainer);
246 return false; 246 return false;
247 } 247 }
248 248
249 bool can_specify_initial_size = launch_container_ == LAUNCH_CONTAINER_PANEL; 249 bool can_specify_initial_size = launch_container_ == LAUNCH_CONTAINER_PANEL;
250 250
251 // Validate the container width if present. 251 // Validate the container width if present.
252 if (!ReadLaunchDimension(extension->manifest(), 252 if (!ReadLaunchDimension(extension->manifest(),
253 keys::kLaunchWidth, 253 keys::kLaunchWidth,
254 &launch_width_, 254 &launch_width_,
255 can_specify_initial_size, 255 can_specify_initial_size,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 keys::kLaunchLocalPath, 317 keys::kLaunchLocalPath,
318 keys::kLaunchWebURL, 318 keys::kLaunchWebURL,
319 keys::kLaunchContainer, 319 keys::kLaunchContainer,
320 keys::kLaunchHeight, 320 keys::kLaunchHeight,
321 keys::kLaunchWidth 321 keys::kLaunchWidth
322 }; 322 };
323 return std::vector<std::string>(keys, keys + arraysize(keys)); 323 return std::vector<std::string>(keys, keys + arraysize(keys));
324 } 324 }
325 325
326 } // namespace extensions 326 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698