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

Side by Side Diff: chrome/common/extensions/manifest_url_handler.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_url_handler.h" 5 #include "chrome/common/extensions/manifest_url_handler.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.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/string_util.h" 10 #include "base/string_util.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 HomepageURLHandler::~HomepageURLHandler() { 120 HomepageURLHandler::~HomepageURLHandler() {
121 } 121 }
122 122
123 bool HomepageURLHandler::Parse(Extension* extension, string16* error) { 123 bool HomepageURLHandler::Parse(Extension* extension, string16* error) {
124 scoped_ptr<ManifestURL> manifest_url(new ManifestURL); 124 scoped_ptr<ManifestURL> manifest_url(new ManifestURL);
125 std::string homepage_url_str; 125 std::string homepage_url_str;
126 if (!extension->manifest()->GetString(keys::kHomepageURL, 126 if (!extension->manifest()->GetString(keys::kHomepageURL,
127 &homepage_url_str)) { 127 &homepage_url_str)) {
128 *error = ErrorUtils::FormatErrorMessageUTF16( 128 *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidHomepageURL,
129 errors::kInvalidHomepageURL, ""); 129 std::string());
130 return false; 130 return false;
131 } 131 }
132 manifest_url->url_ = GURL(homepage_url_str); 132 manifest_url->url_ = GURL(homepage_url_str);
133 if (!manifest_url->url_.is_valid() || 133 if (!manifest_url->url_.is_valid() ||
134 (!manifest_url->url_.SchemeIs("http") && 134 (!manifest_url->url_.SchemeIs("http") &&
135 !manifest_url->url_.SchemeIs("https"))) { 135 !manifest_url->url_.SchemeIs("https"))) {
136 *error = ErrorUtils::FormatErrorMessageUTF16( 136 *error = ErrorUtils::FormatErrorMessageUTF16(
137 errors::kInvalidHomepageURL, homepage_url_str); 137 errors::kInvalidHomepageURL, homepage_url_str);
138 return false; 138 return false;
139 } 139 }
140 extension->SetManifestData(keys::kHomepageURL, manifest_url.release()); 140 extension->SetManifestData(keys::kHomepageURL, manifest_url.release());
141 return true; 141 return true;
142 } 142 }
143 143
144 const std::vector<std::string> HomepageURLHandler::Keys() const { 144 const std::vector<std::string> HomepageURLHandler::Keys() const {
145 return SingleKey(keys::kHomepageURL); 145 return SingleKey(keys::kHomepageURL);
146 } 146 }
147 147
148 UpdateURLHandler::UpdateURLHandler() { 148 UpdateURLHandler::UpdateURLHandler() {
149 } 149 }
150 150
151 UpdateURLHandler::~UpdateURLHandler() { 151 UpdateURLHandler::~UpdateURLHandler() {
152 } 152 }
153 153
154 bool UpdateURLHandler::Parse(Extension* extension, string16* error) { 154 bool UpdateURLHandler::Parse(Extension* extension, string16* error) {
155 scoped_ptr<ManifestURL> manifest_url(new ManifestURL); 155 scoped_ptr<ManifestURL> manifest_url(new ManifestURL);
156 std::string tmp_update_url; 156 std::string tmp_update_url;
157 157
158 if (!extension->manifest()->GetString(keys::kUpdateURL, &tmp_update_url)) { 158 if (!extension->manifest()->GetString(keys::kUpdateURL, &tmp_update_url)) {
159 *error = ErrorUtils::FormatErrorMessageUTF16( 159 *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidUpdateURL,
160 errors::kInvalidUpdateURL, ""); 160 std::string());
161 return false; 161 return false;
162 } 162 }
163 163
164 manifest_url->url_ = GURL(tmp_update_url); 164 manifest_url->url_ = GURL(tmp_update_url);
165 if (!manifest_url->url_.is_valid() || 165 if (!manifest_url->url_.is_valid() ||
166 manifest_url->url_.has_ref()) { 166 manifest_url->url_.has_ref()) {
167 *error = ErrorUtils::FormatErrorMessageUTF16( 167 *error = ErrorUtils::FormatErrorMessageUTF16(
168 errors::kInvalidUpdateURL, tmp_update_url); 168 errors::kInvalidUpdateURL, tmp_update_url);
169 return false; 169 return false;
170 } 170 }
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 extension->SetManifestData(keys::kChromeURLOverrides, 307 extension->SetManifestData(keys::kChromeURLOverrides,
308 url_overrides.release()); 308 url_overrides.release());
309 return true; 309 return true;
310 } 310 }
311 311
312 const std::vector<std::string> URLOverridesHandler::Keys() const { 312 const std::vector<std::string> URLOverridesHandler::Keys() const {
313 return SingleKey(keys::kChromeURLOverrides); 313 return SingleKey(keys::kChromeURLOverrides);
314 } 314 }
315 315
316 } // namespace extensions 316 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698