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

Side by Side Diff: chrome/browser/extensions/pending_extension_info.h

Issue 2054773002: Replace the WAS_INSTALLED_BY_CUSTODIAN creation flag with a pref (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing the build 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_
6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ 6 #define CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 16 matching lines...) Expand all
27 public: 27 public:
28 typedef bool (*ShouldAllowInstallPredicate)(const Extension*); 28 typedef bool (*ShouldAllowInstallPredicate)(const Extension*);
29 29
30 PendingExtensionInfo(const std::string& id, 30 PendingExtensionInfo(const std::string& id,
31 const std::string& install_parameter, 31 const std::string& install_parameter,
32 const GURL& update_url, 32 const GURL& update_url,
33 const Version& version, 33 const Version& version,
34 ShouldAllowInstallPredicate should_allow_install, 34 ShouldAllowInstallPredicate should_allow_install,
35 bool is_from_sync, 35 bool is_from_sync,
36 Manifest::Location install_source, 36 Manifest::Location install_source,
37 int creation_flags,
38 bool mark_acknowledged, 37 bool mark_acknowledged,
39 bool remote_install); 38 bool remote_install);
40 39
41 // Required for STL container membership. Should not be used directly. 40 // Required for STL container membership. Should not be used directly.
42 PendingExtensionInfo(); 41 PendingExtensionInfo();
43 42
44 PendingExtensionInfo(const PendingExtensionInfo& other); 43 PendingExtensionInfo(const PendingExtensionInfo& other);
45 44
46 ~PendingExtensionInfo(); 45 ~PendingExtensionInfo();
47 46
48 // Consider two PendingExtensionInfos equal if their ids are equal. 47 // Consider two PendingExtensionInfos equal if their ids are equal.
49 bool operator==(const PendingExtensionInfo& rhs) const; 48 bool operator==(const PendingExtensionInfo& rhs) const;
50 49
51 const std::string& id() const { return id_; } 50 const std::string& id() const { return id_; }
52 const GURL& update_url() const { return update_url_; } 51 const GURL& update_url() const { return update_url_; }
53 const Version& version() const { return version_; } 52 const Version& version() const { return version_; }
54 const std::string& install_parameter() const { return install_parameter_; } 53 const std::string& install_parameter() const { return install_parameter_; }
55 54
56 // ShouldAllowInstall() returns the result of running constructor argument 55 // ShouldAllowInstall() returns the result of running constructor argument
57 // |should_allow_install| on an extension. After an extension is unpacked, 56 // |should_allow_install| on an extension. After an extension is unpacked,
58 // this function is run. If it returns true, the extension is installed. 57 // this function is run. If it returns true, the extension is installed.
59 // If not, the extension is discarded. This allows creators of 58 // If not, the extension is discarded. This allows creators of
60 // PendingExtensionInfo objects to ensure that extensions meet some criteria 59 // PendingExtensionInfo objects to ensure that extensions meet some criteria
61 // that can only be tested once the extension is unpacked. 60 // that can only be tested once the extension is unpacked.
62 bool ShouldAllowInstall(const Extension* extension) const { 61 bool ShouldAllowInstall(const Extension* extension) const {
63 return should_allow_install_(extension); 62 return should_allow_install_(extension);
64 } 63 }
65 bool is_from_sync() const { return is_from_sync_; } 64 bool is_from_sync() const { return is_from_sync_; }
66 Manifest::Location install_source() const { return install_source_; } 65 Manifest::Location install_source() const { return install_source_; }
67 int creation_flags() const { return creation_flags_; }
68 bool mark_acknowledged() const { return mark_acknowledged_; } 66 bool mark_acknowledged() const { return mark_acknowledged_; }
69 bool remote_install() const { return remote_install_; } 67 bool remote_install() const { return remote_install_; }
70 68
71 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than 69 // Returns -1, 0 or 1 if |this| has lower, equal or higher precedence than
72 // |other|, respectively. "Equal" precedence means that the version and the 70 // |other|, respectively. "Equal" precedence means that the version and the
73 // install source match. "Higher" precedence means that the version is newer, 71 // install source match. "Higher" precedence means that the version is newer,
74 // or the version matches but the install source has higher priority. 72 // or the version matches but the install source has higher priority.
75 // It is only valid to invoke this when the ids match. 73 // It is only valid to invoke this when the ids match.
76 int CompareTo(const PendingExtensionInfo& other) const; 74 int CompareTo(const PendingExtensionInfo& other) const;
77 75
78 private: 76 private:
79 std::string id_; 77 std::string id_;
80 78
81 GURL update_url_; 79 GURL update_url_;
82 Version version_; 80 Version version_;
83 std::string install_parameter_; 81 std::string install_parameter_;
84 82
85 // When the extension is about to be installed, this function is 83 // When the extension is about to be installed, this function is
86 // called. If this function returns true, the install proceeds. If 84 // called. If this function returns true, the install proceeds. If
87 // this function returns false, the install is aborted. 85 // this function returns false, the install is aborted.
88 ShouldAllowInstallPredicate should_allow_install_; 86 ShouldAllowInstallPredicate should_allow_install_;
89 87
90 bool is_from_sync_; // This update check was initiated from sync. 88 bool is_from_sync_; // This update check was initiated from sync.
91 Manifest::Location install_source_; 89 Manifest::Location install_source_;
92 int creation_flags_;
93 bool mark_acknowledged_; 90 bool mark_acknowledged_;
94 bool remote_install_; 91 bool remote_install_;
95 92
96 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync); 93 FRIEND_TEST_ALL_PREFIXES(::ExtensionServiceTest, AddPendingExtensionFromSync);
97 }; 94 };
98 95
99 } // namespace extensions 96 } // namespace extensions
100 97
101 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_ 98 #endif // CHROME_BROWSER_EXTENSIONS_PENDING_EXTENSION_INFO_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_util.cc ('k') | chrome/browser/extensions/pending_extension_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698