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

Side by Side Diff: extensions/common/extension.h

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 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
« no previous file with comments | « extensions/common/event_matcher.cc ('k') | extensions/common/extension.cc » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #ifndef EXTENSIONS_COMMON_EXTENSION_H_ 5 #ifndef EXTENSIONS_COMMON_EXTENSION_H_
6 #define EXTENSIONS_COMMON_EXTENSION_H_ 6 #define EXTENSIONS_COMMON_EXTENSION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <set> 10 #include <set>
10 #include <string> 11 #include <string>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/linked_ptr.h" 16 #include "base/memory/linked_ptr.h"
16 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "extensions/common/extension_resource.h" 19 #include "extensions/common/extension_resource.h"
20 #include "extensions/common/install_warning.h" 20 #include "extensions/common/install_warning.h"
21 #include "extensions/common/manifest.h" 21 #include "extensions/common/manifest.h"
22 #include "extensions/common/url_pattern_set.h" 22 #include "extensions/common/url_pattern_set.h"
23 #include "url/gurl.h" 23 #include "url/gurl.h"
24 24
25 #if !defined(ENABLE_EXTENSIONS) 25 #if !defined(ENABLE_EXTENSIONS)
26 #error "Extensions must be enabled" 26 #error "Extensions must be enabled"
27 #endif 27 #endif
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 // Chooses the extension ID for an extension based on a variety of criteria. 353 // Chooses the extension ID for an extension based on a variety of criteria.
354 // The chosen ID will be set in |manifest|. 354 // The chosen ID will be set in |manifest|.
355 static bool InitExtensionID(extensions::Manifest* manifest, 355 static bool InitExtensionID(extensions::Manifest* manifest,
356 const base::FilePath& path, 356 const base::FilePath& path,
357 const ExtensionId& explicit_id, 357 const ExtensionId& explicit_id,
358 int creation_flags, 358 int creation_flags,
359 base::string16* error); 359 base::string16* error);
360 360
361 Extension(const base::FilePath& path, 361 Extension(const base::FilePath& path,
362 scoped_ptr<extensions::Manifest> manifest); 362 std::unique_ptr<extensions::Manifest> manifest);
363 virtual ~Extension(); 363 virtual ~Extension();
364 364
365 // Initialize the extension from a parsed manifest. 365 // Initialize the extension from a parsed manifest.
366 // TODO(aa): Rename to just Init()? There's no Value here anymore. 366 // TODO(aa): Rename to just Init()? There's no Value here anymore.
367 // TODO(aa): It is really weird the way this class essentially contains a copy 367 // TODO(aa): It is really weird the way this class essentially contains a copy
368 // of the underlying DictionaryValue in its members. We should decide to 368 // of the underlying DictionaryValue in its members. We should decide to
369 // either wrap the DictionaryValue and go with that only, or we should parse 369 // either wrap the DictionaryValue and go with that only, or we should parse
370 // into strong types and discard the value. But doing both is bad. 370 // into strong types and discard the value. But doing both is bad.
371 bool InitFromValue(int flags, base::string16* error); 371 bool InitFromValue(int flags, base::string16* error);
372 372
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 417
418 // The absolute path to the directory the extension is stored in. 418 // The absolute path to the directory the extension is stored in.
419 base::FilePath path_; 419 base::FilePath path_;
420 420
421 // Defines the set of URLs in the extension's web content. 421 // Defines the set of URLs in the extension's web content.
422 URLPatternSet extent_; 422 URLPatternSet extent_;
423 423
424 // The parser for the manifest's permissions. This is NULL anytime not during 424 // The parser for the manifest's permissions. This is NULL anytime not during
425 // initialization. 425 // initialization.
426 // TODO(rdevlin.cronin): This doesn't really belong here. 426 // TODO(rdevlin.cronin): This doesn't really belong here.
427 scoped_ptr<PermissionsParser> permissions_parser_; 427 std::unique_ptr<PermissionsParser> permissions_parser_;
428 428
429 // The active permissions for the extension. 429 // The active permissions for the extension.
430 scoped_ptr<PermissionsData> permissions_data_; 430 std::unique_ptr<PermissionsData> permissions_data_;
431 431
432 // Any warnings that occurred when trying to create/parse the extension. 432 // Any warnings that occurred when trying to create/parse the extension.
433 std::vector<InstallWarning> install_warnings_; 433 std::vector<InstallWarning> install_warnings_;
434 434
435 // The base extension url for the extension. 435 // The base extension url for the extension.
436 GURL extension_url_; 436 GURL extension_url_;
437 437
438 // The extension's version. 438 // The extension's version.
439 scoped_ptr<base::Version> version_; 439 std::unique_ptr<base::Version> version_;
440 440
441 // The extension's user visible version name. 441 // The extension's user visible version name.
442 std::string version_name_; 442 std::string version_name_;
443 443
444 // An optional longer description of the extension. 444 // An optional longer description of the extension.
445 std::string description_; 445 std::string description_;
446 446
447 // True if the extension was generated from a user script. (We show slightly 447 // True if the extension was generated from a user script. (We show slightly
448 // different UI if so). 448 // different UI if so).
449 bool converted_from_user_script_; 449 bool converted_from_user_script_;
450 450
451 // The public key used to sign the contents of the crx package. 451 // The public key used to sign the contents of the crx package.
452 std::string public_key_; 452 std::string public_key_;
453 453
454 // The manifest from which this extension was created. 454 // The manifest from which this extension was created.
455 scoped_ptr<Manifest> manifest_; 455 std::unique_ptr<Manifest> manifest_;
456 456
457 // Stored parsed manifest data. 457 // Stored parsed manifest data.
458 using ManifestDataMap = std::map<std::string, scoped_ptr<ManifestData>>; 458 using ManifestDataMap = std::map<std::string, std::unique_ptr<ManifestData>>;
459 ManifestDataMap manifest_data_; 459 ManifestDataMap manifest_data_;
460 460
461 // Set to true at the end of InitValue when initialization is finished. 461 // Set to true at the end of InitValue when initialization is finished.
462 bool finished_parsing_manifest_; 462 bool finished_parsing_manifest_;
463 463
464 // Ensures that any call to GetManifestData() prior to finishing 464 // Ensures that any call to GetManifestData() prior to finishing
465 // initialization happens from the same thread (this can happen when certain 465 // initialization happens from the same thread (this can happen when certain
466 // parts of the initialization process need information from previous parts). 466 // parts of the initialization process need information from previous parts).
467 base::ThreadChecker thread_checker_; 467 base::ThreadChecker thread_checker_;
468 468
(...skipping 19 matching lines...) Expand all
488 typedef std::vector<ExtensionId> ExtensionIdList; 488 typedef std::vector<ExtensionId> ExtensionIdList;
489 489
490 // Handy struct to pass core extension info around. 490 // Handy struct to pass core extension info around.
491 struct ExtensionInfo { 491 struct ExtensionInfo {
492 ExtensionInfo(const base::DictionaryValue* manifest, 492 ExtensionInfo(const base::DictionaryValue* manifest,
493 const ExtensionId& id, 493 const ExtensionId& id,
494 const base::FilePath& path, 494 const base::FilePath& path,
495 Manifest::Location location); 495 Manifest::Location location);
496 ~ExtensionInfo(); 496 ~ExtensionInfo();
497 497
498 scoped_ptr<base::DictionaryValue> extension_manifest; 498 std::unique_ptr<base::DictionaryValue> extension_manifest;
499 ExtensionId extension_id; 499 ExtensionId extension_id;
500 base::FilePath extension_path; 500 base::FilePath extension_path;
501 Manifest::Location extension_location; 501 Manifest::Location extension_location;
502 502
503 private: 503 private:
504 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo); 504 DISALLOW_COPY_AND_ASSIGN(ExtensionInfo);
505 }; 505 };
506 506
507 struct InstalledExtensionInfo { 507 struct InstalledExtensionInfo {
508 // The extension being installed - this should always be non-NULL. 508 // The extension being installed - this should always be non-NULL.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 const PermissionSet& permissions; 566 const PermissionSet& permissions;
567 567
568 UpdatedExtensionPermissionsInfo(const Extension* extension, 568 UpdatedExtensionPermissionsInfo(const Extension* extension,
569 const PermissionSet& permissions, 569 const PermissionSet& permissions,
570 Reason reason); 570 Reason reason);
571 }; 571 };
572 572
573 } // namespace extensions 573 } // namespace extensions
574 574
575 #endif // EXTENSIONS_COMMON_EXTENSION_H_ 575 #endif // EXTENSIONS_COMMON_EXTENSION_H_
OLDNEW
« no previous file with comments | « extensions/common/event_matcher.cc ('k') | extensions/common/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698