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

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

Issue 10836088: Make the manifest_ member of Extension into a scoped_ptr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 } else { 1286 } else {
1287 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer); 1287 *error = ASCIIToUTF16(errors::kInvalidLaunchContainer);
1288 return false; 1288 return false;
1289 } 1289 }
1290 1290
1291 bool can_specify_initial_size = 1291 bool can_specify_initial_size =
1292 launch_container_ == extension_misc::LAUNCH_PANEL || 1292 launch_container_ == extension_misc::LAUNCH_PANEL ||
1293 launch_container_ == extension_misc::LAUNCH_WINDOW; 1293 launch_container_ == extension_misc::LAUNCH_WINDOW;
1294 1294
1295 // Validate the container width if present. 1295 // Validate the container width if present.
1296 if (!ReadLaunchDimension(manifest_, 1296 if (!ReadLaunchDimension(manifest_.get(),
1297 keys::kLaunchWidth, 1297 keys::kLaunchWidth,
1298 &launch_width_, 1298 &launch_width_,
1299 can_specify_initial_size, 1299 can_specify_initial_size,
1300 error)) 1300 error))
1301 return false; 1301 return false;
1302 1302
1303 // Validate container height if present. 1303 // Validate container height if present.
1304 if (!ReadLaunchDimension(manifest_, 1304 if (!ReadLaunchDimension(manifest_.get(),
1305 keys::kLaunchHeight, 1305 keys::kLaunchHeight,
1306 &launch_height_, 1306 &launch_height_,
1307 can_specify_initial_size, 1307 can_specify_initial_size,
1308 error)) 1308 error))
1309 return false; 1309 return false;
1310 1310
1311 return true; 1311 return true;
1312 } 1312 }
1313 1313
1314 bool Extension::LoadSharedFeatures( 1314 bool Extension::LoadSharedFeatures(
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 launch_container_(extension_misc::LAUNCH_TAB), 2918 launch_container_(extension_misc::LAUNCH_TAB),
2919 launch_width_(0), 2919 launch_width_(0),
2920 launch_height_(0), 2920 launch_height_(0),
2921 wants_file_access_(false), 2921 wants_file_access_(false),
2922 creation_flags_(0) { 2922 creation_flags_(0) {
2923 DCHECK(path.empty() || path.IsAbsolute()); 2923 DCHECK(path.empty() || path.IsAbsolute());
2924 path_ = MaybeNormalizePath(path); 2924 path_ = MaybeNormalizePath(path);
2925 } 2925 }
2926 2926
2927 Extension::~Extension() { 2927 Extension::~Extension() {
2928 if (manifest_)
2929 delete manifest_;
2930 } 2928 }
2931 2929
2932 ExtensionResource Extension::GetResource( 2930 ExtensionResource Extension::GetResource(
2933 const std::string& relative_path) const { 2931 const std::string& relative_path) const {
2934 std::string new_path = relative_path; 2932 std::string new_path = relative_path;
2935 // We have some legacy data where resources have leading slashes. 2933 // We have some legacy data where resources have leading slashes.
2936 // See: http://crbug.com/121164 2934 // See: http://crbug.com/121164
2937 if (!new_path.empty() && new_path.at(0) == '/') 2935 if (!new_path.empty() && new_path.at(0) == '/')
2938 new_path.erase(0, 1); 2936 new_path.erase(0, 1);
2939 #if defined(OS_POSIX) 2937 #if defined(OS_POSIX)
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
3915 3913
3916 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3914 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3917 const Extension* extension, 3915 const Extension* extension,
3918 const PermissionSet* permissions, 3916 const PermissionSet* permissions,
3919 Reason reason) 3917 Reason reason)
3920 : reason(reason), 3918 : reason(reason),
3921 extension(extension), 3919 extension(extension),
3922 permissions(permissions) {} 3920 permissions(permissions) {}
3923 3921
3924 } // namespace extensions 3922 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698